Search completed in 1.24 seconds.
3188 results for "properties":
Your results are loading. Please wait...
Shorthand properties - CSS: Cascading Style Sheets
Shorthand properties are CSS properties that let you 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. Tricky edge cases Even if they are very convenient to use, there are a few edge cases to kee...
...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. Only the individual properties values can inherit. As missing values are replaced by their initial value, it is impossible to allow inheritance of individual properties by omitting them. The keyword inherit can be applied to a property, but only as a whole, not as a keyword for one value or another. That means that the only way to make some specific value to be inherited is to use the longhand property with the keyword inherit...
...nherit. As missing values are replaced by their initial value, it is impossible to allow inheritance of individual properties by omitting them. The keyword inherit can be applied to a property, but only as a whole, not as a keyword for one value or another. That means that the only way to make some specific value to be inherited is to use the longhand property with the keyword inherit. Shorthand properties try not to force a specific order for the values of the properties they replace. This works well when these properties use values of different types, as the order has no importance, but this does not work as easily when several properties can have identical values. ...
...And 12 more matches
Logical properties for floating and positioning - CSS: Cascading Style Sheets
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. ...
...They assume a horizontal writing-mode, with a left-to-right direction. ...
... Logical property Purpose inset-inline Sets both of the above inset values for the inline dimension simultaneously. inset-block Sets both of the above inset values for...
...And 9 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
An additional benefit is semantic identifiers. ...
...t 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 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...
...ustom 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 in. A common best practice is to define custom properties on the :root pseudo-class, so that 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. As mentioned earl...
...And 9 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. ...
...Therefore we describe boxes as having a width and height, position items from the top and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. The Logical Properties and Values specification defines mappings for these physical values to their logical, or flow relative, counterparts -- e.g. ...
...duces the specification, and explains flow relative properties and values. Why do we need logical properties? CSS traditionally has sized things according to the physical dimensions of the screen. Therefore we describe boxes as having a width and height, position items from the top and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. The Logical Properties and Values specification defines mappings for these physical values to their logical, or flow relative, counterparts -- e.g. start and end as opposed to left and right/top and bottom. An example of why these mappings might be needed is as follows. I have a Layout using CSS Grid, the grid container has a width applied and I am using the align-self and justify-self properties to align the items. T...
...And 7 more matches
Object.defineProperties() - JavaScript
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). ...
... 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). ...
...Each value in props must be either a data descriptor or an accessor descriptor; it cannot be both (see Object.defineProperty() for more details). ...
...And 7 more matches
Private Properties - Archive of obsolete content
A private property is a property that is only accessible to member functions of instances of the same class. Unlike other languages, JavaScript does not have native support for private properties. People have come up with several ways to emulate private properties using existing language features. This article discusses two common techniques: one using prefixes, the other closures. Both approaches have drawbacks, they are either not restrictive enough or too restrictive, respectively. A better alternative is to use WeakMap objects, which solve both these problems. ...
...g prefixes, the other closures. Both approaches have drawbacks, they are either not restrictive enough or too restrictive, respectively. A better alternative is to use WeakMap objects, which solve both these problems. However, note that WeakMaps might not be supported by all implementations yet. Also shown here is how to generalize the idea of using WeakMaps, from associating one or more private properties with an object, to associating one or more namespaces with each object. A namespace is simply an object on which one or more private properties are defined. The SDK uses namespaces internally to implement private properties. The final section explains how to work with the particular namespace implementation used by the SDK. It is possible to read this section on its own, but to fully appreciate ...
...SDK uses namespaces internally to implement private properties. The final section explains how to work with the particular namespace implementation used by the SDK. It is possible to read this section on its own, but to fully appreciate how namespaces work, and the problem they set out to solve, it is recommended to read the entire article. Using Prefixes A common technique to implement private properties is to prefix each private property name with an underscore. Consider the following example: function Point(x, y) { this._x = x; this._y = y; } The properties _x and _y are intended to be private, and should only be accessed by member functions. To make a private property readable/writable from any function, it's common to define getter/setter functions for the property, respectively: ...
...And 6 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
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. ...
...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. ...
...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. ...
...And 5 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
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. ...
... border-inline-style Sets border-style for both inline borders. border-inline-width Sets border-width for both inline borders. margin-block Sets all the block margins. margin-inline Sets all the inline margins. padding-block Sets the block padding. padding-inline Sets the inline padding. Margin examples The mapped margin properties of margin-inline-start, margin-inline-end, margin-block-start, and margin-inline-end can be used instead of their physical counterparts. In the example below I have created two boxes and added different sized margins to each edge. I have added an extra container with a border in order to make the margin more obvious to see. One box uses physical properties and the other logical properties. Try ...
...here 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. ...
...And 5 more matches
CSS Logical Properties and Values - CSS: Cascading Style Sheets
The module also defines logical properties and values for properties previously defined in CSS 2.1. Logical properties define direction-relative equivalents of their corresponding physical properties. Block vs. inline Logical properties and values use the abstract terms block and inline to describe the direction in which they flow. 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. Block dimension The dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes. ...
...And 5 more matches
Enumerability and ownership of properties - JavaScript
Some sample code follows which demonstrates how to obtain the missing categories. ...
...Some sample code follows which demonstrates how to obtain the missing categories. ...
...Some sample code follows which demonstrates how to obtain the missing categories. ...
...And 4 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. 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. ...
...s 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. stroke Expose the stroke value set on the image to the embedded SVG. fill-opacity Expose the fill-opacity value set on the image to the embedded SVG. ...
...e applied to it, for example as a background-image, border-image, or list-style-image.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax none | [ fill | fill-opacity | stroke | stroke-opacity ]# Examples Exposing fill and stroke to an SVG image In this example we have a simple SVG embedded using an <img> element. ...
...And 3 more matches
Animating CSS properties - Firefox Developer Tools
The Frame rate and Waterfall can give you insight into the work the browser's doing in a CSS animation, to help diagnose performance problems. With CSS animations you specify a number of keyframes, each of which uses CSS to define the appearance of the element at a particular stage of the animation. The browser creates the animation as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. ...
...as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. They can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary. However, the performance cost of modifying a CSS property can vary from one property to another. Animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. The CSS rendering waterfall The process the browser uses to update the page when a CSS property has changed can be described as a waterfall consisting of the following steps: Recalculate Style: every time a CSS property for an element changes, the browser must recalculate computed styles. Layout: next, the browser use...
...alled "Composition". This sequence needs to fit into a single frame, since the screen isn't updated until it is complete. It's commonly accepted that 60 frames per second is the rate at which animations will appear smooth. For a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow. CSS property cost In the context of the rendering waterfall, some properties are more expensive than others: Property type Cost Examples Properties that affect an element's geometry or position trigger a style recalculation, a layout and a repaint. left max-width border-width margin-left font-size Properties that don't affect geometry or position, but are not rendered in their own layer, do n...
...And 2 more matches
Using the CSS properties and values API - Web APIs
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. ...
... 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. ...
...terProperty 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. ...
...And 2 more matches
TypeError: "x" has no properties - JavaScript
The JavaScript exception "null (or undefined) has no properties" occurs when you attempt to access properties of null and undefined. They don't have any. Message TypeError: Unable to get property {x} of undefined or null reference (Edge) TypeError: null has no properties (Firefox) TypeError: undefined has no properties (Firefox) Error type TypeError. What went wrong? ...
...ipt exception "null (or undefined) has no properties" occurs when you attempt to access properties of null and undefined. They don't have any. Message TypeError: Unable to get property {x} of undefined or null reference (Edge) TypeError: null has no properties (Firefox) TypeError: undefined has no properties (Firefox) Error type TypeError. What went wrong? ...
...ou attempt to access properties of null and undefined. They don't have any. Message TypeError: Unable to get property {x} of undefined or null reference (Edge) TypeError: null has no properties (Firefox) TypeError: undefined has no properties (Firefox) Error type TypeError. What went wrong? ...
...And 2 more matches
Using Vue computed properties - Learn web development
These work similarly to methods, but only re-run when one of their dependencies changes. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. ...
...e components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to use Vue computed properties. Using computed properties The aim here is to add a summary count of our to-do list. This can be useful for users, while also serving to label the list for assistive technology. If we have 2 of 5 items completed in our to-do list, our summary could read "3 items completed out of 5". While it might be tempting to do something like this: <h2>{{ToDoItems.filter(item => item.done).length}} ...
... tempting to do something like this: <h2>{{ToDoItems.filter(item => item.done).length}} out of {{ToDoItems.length}} items completed</h2> It would be recalculated on every render. For a small app like this, that probably doesn't matter too much. For bigger apps, or when the expression is more complicated, that could cause a serious performance problem. A better solution is to use Vue's computed properties. Computed Properties work similarly to methods, but only re-run when one of their dependencies changes. In our case, this would only re-run when the ToDoItems array changes. To create a computed property, we need to add a computed property to our component object, much like the methods property we've used previously. Adding a summary counter Add the following code to your App component object,...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
JS_DefineProperties
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. ...
...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. ...
...perties for a single object. Syntax bool JS_DefineProperties(JSContext *cx, JS::HandleObject obj, const JSPropertySpec *ps); Name Type Description cx JSContext * The context in which to define the properties. 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 properti...
...ersions 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 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_DefineP...
CSS Properties and Values API - Web APIs
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. ...
... 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. ...
... 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. ...
... ...
Using ARIA: Roles, states, and properties - Accessibility
Addition of ARIA semantics only exposes extra information to a browser's accessibility API, and does not affect a page's DOM. ...
...Addition of ARIA semantics only exposes extra information to a browser's accessibility API, and does not affect a page's DOM. ...
...inition directory document feed figure group heading img list listitem math none note presentation row rowgroup rowheader separator table term textbox toolbar tooltip Landmark roles banner complementary contentinfo form main navigation region search Live Region Roles alert log marquee status timer Window Roles 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-valuetex...
...ria-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-posinset aria-rowcount aria-rowindex aria-rowspan aria-setsize MicrosoftEdge-specific properties x-ms-aria-flowfrom ...
Test your skills: Writing Modes and Logical Properties - Learn web development
The things you need to know to complete these tasks are covered in the lesson on Handling different text directions. 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 The box in the example is displayed with a horizontal writing mode. ...
... Can you add a line of CSS to change it so it uses a vertical writing mode with right to left text? Your example should look like the image below. 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 the example below use logical properties to replace width and height in order to maintain the aspect ratio of the box as it is turned vertically. Your end result should look like the image below. Try updating the live code below to recreate the example as displayed in the image: 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 Three Use l...
...he aspect ratio of the box as it is turned vertically. Your end result should look like the image below. Try updating the live code below to recreate the example as displayed in the image: 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 Three Use logical versions of the margin, border, and padding properties so that the edges of the box relate to the text rather than following top, left, bottom and right. You can see how this should look in the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can p...
Components.utils.importGlobalProperties
s various objects into a system scope. System scopes such as JSMs and frame scripts don't have certain objects, such as indexedDB and XMLHttpRequest, that are available to DOM window globals. Using this API you can import these objects into such a system scope. This function is not intended for sandboxes but for system-privileged scopes. To import these objects into a sandbox, use the wantGlobalProperties option in the Sandbox constructor. This function is passed an array of strings. Each string is the name of an object to import, and will be defined on the importing scope's global. The following strings are supported: String/Object XPCOM Component atob Blob btoa crypto CSS fetch File...
... TextDecoder TextEncoder URL URLSearchParams XMLHttpRequest nsIXMLHttpRequest Obsolete since Gecko 60 For string/object in table without a minimum firefox version, it is not exactly known since when it was available, however it is guranteed available from Firefox 28 and up. ...
...ly known since when it was available, however it is guranteed available from Firefox 28 and up. Syntax void Components.utils.importGlobalProperties([string1, string2, ...]); Parameters [string1, string2, ...] An array of strings. Each string is the name of an object to import. Example Components.utils.import("resource://gre/modules/devtools/Console.jsm"); Components.utils.importGlobalProperties(["atob", "btoa"]); var encoded = btoa("Hello"); console.log(encoded); // "SGVsbG8=" console.log(atob(encoded)); // "Hello" Alternative Methods If importGlobalProperties does not support the targeted Firefox version, here are some alternative methods to import these objects. Import from JSM This method worked until Blob and File were no longer apart of JSM modules. It is ...
BluetoothCharacteristicProperties - Web APIs
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. ...
...es The following example shows how tell if a GATT characteristic supports value change notifications. let device = await navigator.bluetooth.requestDevice({ filters: [{services: ['heart_rate']}] }); let gatt = await device.gatt.connect(); let service = await gatt.getPrimaryService('heart_rate'); let characteristic = await service.getCharacteristic('heart_rate_measurement'); if (characteristic.properties.notify) { characteristics.addEventListener('characteristicvaluechanged', function(event) { console.log(`Received heart rate measurement: ${event.target.value}`); } await characteristic.startNotifications(); } Specifications Specification Status Comment Web BluetoothThe definition of 'BluetoothCharacteristicProperties' in that specification. Draft I...
...er 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 InternetBluetoothCharacteristicProperties ExperimentalChrome Full support 56Notes Full support 56Notes Notes ChromeOS and macOS only. Full support 56Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 56: this feature is behind the #enable-experimental-web-platform-fe...
CSS Custom Properties for Cascading Variables - CSS: Cascading Style Sheets
CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
... CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
... CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
properties - Archive of obsolete content
For more information, see Styling a Tree. ...
...For more information, see Styling a Tree. ...
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 declaration can...
... Candidate Recommendation Initial definition. ...
Logical properties for sizing - CSS: Cascading Style Sheets
In this guide we will explain the flow-relative mappings between physical dimension properties and logical properties used for sizing elements on our pages. When specifying the size of an item, the Logical Properties and Values specification gives you the ability to indicate sizing as it relates to the flow of text (inline and block) rather than physical sizing which relates to the physical dimensions of horizontal and vertical (e.g. left and right). While these flow relative mappings may well become the default for many of us, in a design you may well use both physical and logical sizing. You might want some features to always relate to the physical dimensions whatever the writing mode. Mappings for dimensions The table below provides mappings between logical and physical properties. These mapp...
... the same size in each dimension, despite the text becoming vertical. The second example -- which uses inline-size and block-size -- will follow the text direction as if the entire block has rotated. Min-width and min-height example There are also mappings for min-width and min-height -- these are min-inline-size and min-block-size. These work in the same way as the inline-size and block-size properties, but setting a minimum rather than a fixed size. Try changing the example below to vertical-rl, as with the first example, to see the effect it has. 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...
CSS Properties Reference - CSS: Cascading Style Sheets
For more CSS properties see The main CSS reference and Mozilla CSS Extensions. The reference articles also include examples on how to use all the properties. ...
... Common CSS Properties Reference The following is a basic list of the most common CSS properties with the equivalent of the DOM notation which is usually accessed from JavaScript: Note: This list is incomplete. For more CSS properties see The main CSS reference and Mozilla CSS Extensions. The reference articles also include examples on how to use all the properties. CSS JavaScript background background background-attachment backgroundAttachment background-color backgroundColor background-image backgroundImage background-position backgroundPosition background-repeat backgroundRepeat border border border-bottom borderBottom border-bottom-color borderBottomColor ...
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. ...
... 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. ...
Properties - Archive of obsolete content
e.g. major version of Netscape 6 is "6" minor Second most siginificant element of the InstallVersion object.e.g. minor version of Netscape Communicator 4.7 is "7" release Second least siginificant element of the InstallVersion object. build Least siginificant element of the InstallVersion object.e.g. buildID of Netscape 6 is represented by a time stamp of teh format:YYYYMMDDHH: 2001031808 means in the year 2001, in the month of March, on the 18th day of the month, at 8:00am. the product was built. ...
Properties - Archive of obsolete content
Parts of this page 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. 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 #). No...
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 string ...
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. ...
BluetoothRemoteGATTCharacteristic.properties - Web APIs
The BluetoothRemoteGATTCharacteristic.properties read-only property returns a BluetoothCharacteristicProperties instance containing the properties of this characteristic. Syntax var properties = BluetoothRemoteGATTCharacteristic.properties Returns The properties of this characteristic. Specifications Specification Status Comment Web BluetoothThe definition of 'properties' in that specification. Draft Initial definition. ...
Index - Web APIs
Web › API › Index
nce, offset, startOffset The read-only startOffset property of the AbstractRange interface returns the offset into the start node of the range's start position. 22 AbstractWorker API, Abstract, AbstractWorker, Interface, Reference, SharedWorker, Web Workers, Web Workers API, Worker The AbstractWorker interface of the Web Workers API is an abstract interface that defines properties and methods that are common to all types of worker, including not only the basic Worker, but also ServiceWorker and SharedWorker. 23 AbstractWorker.onerror API, AbstractWorker, EventHandler, Property, Reference, Web Workers, Workers, onerror The AbstractWorker.onerror property of the AbstractWorker interface represents an EventHandler, that is a function to be called when the...
...ike KeyframeEffect, which can be passed to Animation objects for playing, and KeyframeEffectReadOnly (which is used by CSS Animations and Transitions). 83 AnimationEffect.getComputedTiming() API, Animation, Experimental, Method, Reference, getComputedTiming, waapi, web animations api The getComputedTiming() method of the AnimationEffect interface returns the calculated timing properties for this animation effect. 84 AnimationEffect.getTiming() API, Animation, Experimental, Method, Reference, Timing, waapi, web animations api The AnimationEffect.getTiming() method of the AnimationEffect interface returns an EffectTiming object containing the timing properties for the Animation Effect. 85 AnimationEffect.updateTiming() API, Animation, Experiment...
... 86 AnimationEvent API, Experimental, Interface, Reference, Web Animations The AnimationEvent interface represents events providing information related to animations. ...
...And 178 more matches
Index - Archive of obsolete content
boundaries between them. Unfortunately, JavaScript does not yet have native support for modules: it has to rely on the host application to provide it with functionality such as loading subscripts, and exporting/ importing names. We will show how to do each of these things using the built-in Components object provided by Xulrunner application such as Firefox and Thunderbird. 28 Private Properties People have come up with several ways to emulate private properties using existing language features. This article discusses two common techniques: one using prefixes, the other closures. 29 Firefox Compatibility Add-on SDK No summary! 30 Module structure of the SDK Add-on SDK No summary! 32 Porting the Library Detector Add-on SD...
...a can be thought of as a decapitating tool for slaying CFGs. Currently Dehydra does not provide the CFG functionality, this functionality is now provided by Treehydra. 417 Dehydra Function Reference The following functions may be provided by the analysis script and will be called by Dehydra while compiling. See the Dehydra object reference for details on the available object properties. 418 Dehydra Object Reference Dehydra represents C++ types and variables as JavaScript objects. The objects are designed to distill that type system to the minimum such that it can be easy to match on. 419 Installing Dehydra Dehydra It is recommended that you use SpiderMonkey revision AURORA_BASE_20110705 when building Dehydra. 420 Using Dehyd...
... bound document using a single tag can then be constructed out of multiple child elements, and this implementation is hidden from the bound document. 697 Binding Attachment and Detachment XBL Bindings can be attached to elements through CSS using the -moz-binding property. 698 Binding Implementations Mozilla, Reference, XBL Bindings can define methods and properties on a bound element using the implementation tag. A binding implementation provides a new set of methods and properties that can be invoked directly from the bound element. 699 DOM Interfaces No summary! 700 Elements XBL This section is tested and adjusted for the current Firefox implementation. Please edit only if an actual behavior differs from the desc...
...And 75 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
ary! 298 primary XUL Attributes, XUL Reference No summary! 299 priority XUL Attributes, XUL Reference No summary! 300 progressmeter.max No summary! 301 progressmeter.mode XUL Attributes, XUL Reference No summary! 302 progressmeter.value XUL Attributes, XUL Reference No summary! 303 properties XUL Attributes, XUL Reference No summary! 304 query.name XUL Attributes, XUL Reference No summary! 305 query.type XUL Attributes, XUL Reference No summary! 306 querytype XUL Attributes, XUL Reference No summary! 307 readonly XUL Attributes, XUL Reference No summary! 308 ref XUL Attributes,...
...ion. When the mouse is moved again, the tooltip disappears. This is a useful means of providing additional details about a user interface without cluttering up the main interface. 613 Printing from a XUL App Guide, NeedsContent, XUL This document will talk about PrintUtils, and the ways that XUL applications can trigger print-related behaviors. ...
...means of providing additional details about a user interface without cluttering up the main interface. 613 Printing from a XUL App Guide, NeedsContent, XUL This document will talk about PrintUtils, and the ways that XUL applications can trigger print-related behaviors. ...
...And 60 more matches
Working with objects - JavaScript
<< PreviousNext >> JavaScript is designed on a simple object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a method. 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. Objects overview Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects. In JavaScript, an object is a standalone entity, with properties and type. Compare it with a ...
... methods, and how to create your own objects. Objects overview Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects. In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup, for example. A cup is an object, with properties. A cup has a color, a design, weight, a material it is made of, etc. ...
...languages, can be compared to objects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects. In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup, for example. A cup is an object, with properties. A cup has a color, a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties, which define their characteristics. Objects and properties A JavaScript object has properties associated with it. A property of an object can be explained as a variable that is attached to the object. Object properties are basically the same as ordinary JavaScript variables, except for the attachment to objects. The properties of an object define the characteristics of the object. You access t...
...And 28 more matches
Details of the object model - JavaScript
<< PreviousNext >> JavaScript is an object-based language based on prototypes, rather than being class-based. Because of this different basis, it can be less apparent how JavaScript allows you to create hierarchies of objects and to have inheritance of properties and their values. 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. ...
...hapter 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. prototype-based languages Class-based object-oriented languages, such as Java and C++, are founded on the concept of two distinct entities: classes and instances. A class defines all of the properties that characterize a certain set of objects (considering methods and fields in Java, or members in C++, to be properties). A class is abstract rather than any particular member in a set of objects it describes. For example, the Employee class could represent the set of all employees. An instance, on the other hand, is the instantiation of a class; that is. For example, Victoria could be an instan...
...operties). A class is abstract rather than any particular member in a set of objects it describes. For example, the Employee class could represent the set of all employees. An instance, on the other hand, is the instantiation of a class; that is. For example, Victoria could be an instance of the Employee class, representing a particular individual as an employee. An instance has exactly the same properties of its parent class (no more, no less). A prototype-based language, such as JavaScript, does not make this distinction: it simply has objects. A prototype-based language has the notion of a prototypical object, an object used as a template from which to get the initial properties for a new object. Any object can specify its own properties, either when you create it or at run time. In addition, ...
...And 27 more matches
Index
wningCompileOptions and JS::CompileOptions return the instance itself to allow method chain. 35 JS::Construct JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::Construct calls a specified function as a constructor, fun. 36 JS::CreateError JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::CreateError creates an Error object with specified properties. 37 JS::CurrentGlobalOrNull JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::CurrentGlobalOrNull() returns the global object for whatever function is currently running on the context. In other words, it returns the global object on the current scope chain. 38 JS::DeflateStringToUTF8Buffer JSAPI Reference, Refere, SpiderMonkey JS::DeflateStringTo...
...JSNative is the this argument, not the custom object that was called! 92 JSClass.flags JSAPI Reference, SpiderMonkey The flags field is of type uint32_t. Its value is the logical OR of zero or more of the following constants: 93 JSConstDoubleSpec JSAPI Reference, SpiderMonkey JSConstDoubleSpecs is used to define a set of double values that are assigned as properties to an object using JS_DefineConstDoubles. 94 JSConvertOp JSAPI Reference, Reference, Reference(2), SpiderMonkey 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. 95 JSDeletePropertyOp JSAPI Reference, Reference, Spi...
...hat applications may install to be called at some point during property access. A JSDeletePropertyOp may be installed on a JSClass to hook property deletes. 96 JSEnumerateOp JSAPI Reference, SpiderMonkey JSEnumerateOp is called just before an object is enumerated (via a for...in statement, an array comprehension, or a call to JS_Enumerate). It should define any remaining lazy properties that should be enumerable but are not yet defined in obj. This hook does not implement iteration: once the properties are defined, the JavaScript engine can enumerate them. 97 JSErrorFormatString JSAPI Reference, Reference, Reference(2), SpiderMonkey JSErrorFormatString is a struct to represent error message and type, returned by JS_ReportErrorNumber function. 98 J...
...And 19 more matches
Capabilities, constraints, and settings - Web APIs
ious things work or not and determining what errors occur, 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 (...
...ou 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). ...
...s.getSupportedConstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. This isn't always necessary, since any that aren't known will simply be ignored when you specify them--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 ...
...And 19 more matches
Repackaging Firefox - Archive of obsolete content
o get started is probably to look at a simple DEX and modify it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. ...
...look at a simple DEX and modify it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. ...
...fy it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. ...
...And 17 more matches
Debugger.Object - Firefox Developer Tools
Debugger.Object A Debugger.Object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. The referent's properties do not appear directly as properties of the Debugger.Object instance; the debugger can access them only through methods like Debugger.Object.prototype.getOwnPropertyDescriptor and Debugger.Object.prototype.defineProperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. SpiderMonkey creates exactly one Debugger.Object instance for each debuggee object it presents to a given Debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), SpiderMonkey presents the same Debugger.Object instance to ...
...sents to a given Debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), SpiderMonkey presents the same Debugger.Object instance to the debugger each time. This means that the debugger can use the == operator to recognize when two Debugger.Object instances refer to the same debuggee object, and place its own properties on a Debugger.Object instance to store metadata about particular debuggee objects. JavaScript code in different compartments can have different views of the same object. For example, in Firefox, code in privileged compartments sees content DOM element objects without redefinitions or extensions made to that object's properties by content code. (In Firefox terminology, privileged code sees the el...
...debugger came across the referent. As a consequence, a single Debugger instance may actually have several Debugger.Object instances: one for each compartment from which the referent is viewed. If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Object instance for 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.pro...
...And 17 more matches
JSAPI User Guide
cated. Every JSContext and every object in an application lives within a JSRuntime. They cannot travel to other runtimes or be shared across runtimes. You will need at least one JSRuntime per thread that uses the JSAPI. Contexts. A JSContext, or context, is like a little machine that can do many things involving JavaScript code and objects. It can compile and execute scripts, get and set object properties, call JavaScript functions, convert JavaScript data from one type to another, create objects, and so on. Almost all JSAPI functions require a JSContext * as the first argument, just like most <stdio.h> functions require a FILE *. Global objects. Lastly, the global object contains all the classes, functions, and variables that are available for JavaScript code to use. Whenever JavaScript code doe...
... argument, just like most <stdio.h> functions require a FILE *. Global objects. Lastly, the global object contains all the classes, functions, and variables that are available for JavaScript code to use. Whenever JavaScript code does something like window.open("http://www.mozilla.org/"), it is accessing a global property, in this case window. JSAPI applications have full control over what global properties scripts can see. The application starts out by creating an object and populating it with the standard JavaScript classes, like Array and Object. Then it adds whatever custom classes, functions, and variables (like window) the application wants to provide; see Custom objects below. Each time the application runs a JS script (using, for example, JS_EvaluateScript), it provides the global object for...
...whatever custom classes, functions, and variables (like window) the application wants to provide; see Custom objects below. Each time the application runs a JS script (using, for example, JS_EvaluateScript), it provides the global object for that script to use. As the script runs, it can create global functions and variables of its own. All of these functions, classes, and variables are stored as properties of the global object. A minimal example Each of the three key elements described in the previous section requires a few JSAPI calls: The runtime: Use JS_NewRuntime to create it and JS_DestroyRuntime to clean it up when you're done. When your application is done with SpiderMonkey altogether, use JS_ShutDown to free any remaining cached resources. (This is a mere nicety if the process is ab...
...And 16 more matches
Using the CSS Painting API - Web APIs
ow, and then call fillRect() to create a rectangle of that color. The fillRect() parameters are, in order, x-axis origin, y-axis origin, width, and height. fillRect(0, 15, 200, 20) results in the creation of a rectangle that is 200 units wide by 20 units tall, positioned 0 units from the left and 15 units from the top of the content box. We can use the CSS background-size and background-position properties to re-size or relocate this background image, but this is the default size and placement of the yellow box we created in our paint worklet. We tried to keep the example simple. For more options, look at the canvas documentation. We also add a little bit of complexity later in this tutorial. Using the paint worklet To use the paint worklet, we need to register it using addModule() and include i...
...e 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); } .half { width: 50%; } <h1 class="fancy">Largest Header</h1> <h6 class="fancy">Smallest Header</h6> <h3 class="fancy half">50% width header</h3> Whil...
...half { width: 50%; } <h1 class="fancy">Largest Header</h1> <h6 class="fancy">Smallest Header</h6> <h3 class="fancy half">50% width header</h3> While you can't play with the worklet's script, you can alter the element's font-size and width to change the size of the background image. In browsers that support the CSS Paint API, the example below should appear like the image above. Custom properties In addition to accessing the size of the element, the worklet can also have access to CSS custom properties and regular CSS properties. registerPaint('cssPaintFunctionName', class { static get inputProperties() { return ['PropertyName1', '--customPropertyName2']; } static get inputArguments() { return ['<color>']; } static get contextOptions() { return {alpha: true}; } pain...
...And 15 more matches
CSS3 - Archive of obsolete content
h specific OpenType features via the CSS font-feature-settings property. The control of the aspect ratio 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...
...bility to define the hotspot of a cursor as well as the new none, context-menu, cell, vertical-text, alias, copy, no-drop, not-allowed, nesw-resize, nwse-resize, col-resize, row-resize, all-scroll, zoom-in, zoom-out, extending the cursor property. The ability to specify the sequential navigation order (that is the tabbing order ) using the CSS nav-index, nav-up, nav-right, nav-left, nav-down properties. At risk: due to insufficient browser support, standardization of the navigation properties may be postponed to the next iteration of this module. The ability to control the usage of an IME editor, using the CSS ime-mode property. At risk: due to insufficient browser support, standardization of the ime-mode property may be postponed to the next iteration of this module. ...
...andidate Recommendation Adds: Support, on backgrounds, for any type of <image>, and not only for uri() defined ones. Support for multiple background images. The background-repeat space and round values, and for the 2-value syntax of this CSS property. The background-attachment local value. The CSS background-origin, background-size, and background-clip properties. Support for curved border corners, with the CSS border-radius, border-top-left-radius, border-top-right-radius, border-bottom-left-radius, and border-bottom-right-radius properties. Support for the use of an <image> as the border with the CSS border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, and border-image-repeat properties. Support ...
...And 14 more matches
TPS Bookmark Lists
folder ("menu", "toolbar", and "unfiled" are all children of this) Sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu". TPS does not support forward slashes as part of a folder name. Folder contents The contents for a folder are given as an array of objects, representing various bookmark types, described below. Bookmark objects Valid properties are: uri: the bookmark uri. Required. title: the bookmark title. Optional. Defaults to the bookmark uri. loadInSidebar: true or false. Optional. Toggles the "load in sidebar" property. description: the bookmark description. Optional. tags: an array of tags for the bookmark. Optional. keyword: the keyword for the bookmark. Optional. after: the title of the bookmark item expected to be found AFTER...
... description. Optional. tags: an array of tags for the bookmark. Optional. keyword: the keyword for the bookmark. Optional. after: the title of the bookmark item expected to be found AFTER this bookmark; used only in verify and modify actions. before: the title of the bookmark item expected to be found BEFORE this bookmark; used only in verify and modify actions. ...
...ord for the bookmark. Optional. after: the title of the bookmark item expected to be found AFTER this bookmark; used only in verify and modify actions. before: the title of the bookmark item expected to be found BEFORE this bookmark; used only in verify and modify actions. changes: an object containing new properties to be set for this bookmark when this asset list is used in a modify action. ...
...And 14 more matches
ui/button/toggle - Archive of obsolete content
nsole.log("You clicked '" + state.label + "' again"); } function firstChange(state) { console.log("You changed '" + state.label + "'"); button.removeListener("change", firstChange); button.on("change", subsequentChanges); } function subsequentChanges(state) { console.log("You changed '" + state.label + "' again"); } The listener is passed a state object that contains all the button's properties. You can generate click and change events programmatically with the button's click() method. Attaching panels to buttons You can attach panels to buttons by passing the button as the position option to the panel's show() method or the panel's constructor: var { ToggleButton } = require('sdk/ui/button/toggle'); var panels = require("sdk/panel"); var self = require("sdk/self"); var button = To...
...eChange(state) { if (state.checked) { panel.show({ position: button }); } } function handleHide() { button.state('window', {checked: false}); } Disabling buttons You can disable a button by setting its disabled property to true. A disabled button will not generate click or change events and its icon will appear disabled: Updating state You can update all the button's properties, except for its id. Depending on your application, you might want a button to have different state in different browser windows or different tabs. For example, you might want to give it a different appearance when the current page is being served over HTTPS. The 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 e...
...To set state like this, call state() with 2 parameters: the first parameter is a window or tab object or as a shorthand, the string "window" for the currently active window, or the string "tab" for the currently active ta...
...And 12 more matches
source-editor.jsm
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 Ele...
..., 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 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 ...
...rposes of undo operations. void endCompoundChange(); Parameters None. find() Finds a string in the editor's text. Number find( [optional] String aString [optional] Object aOptions ); Parameters aString Optional The string for which to search. If not specified, the currently selected text in the editor is used as the search string. ...
...And 12 more matches
Styling a Tree - Archive of obsolete content
ee. Adding a style to the treecol element does not cause the style to be applied to the column but only to the header. The body of the tree must be styled in a somewhat different way than other elements. This is because the tree body is stored in a different way to other elements. The outer treechildren is the only real element in the tree body. The inner elements are just placeholders. Setting Properties Instead, you must use the properties attribute on the rows or cells to set one or more named properties. This can be used with trees with static content, RDF built content or with those with a custom view. Let's say we want a particular row to have a blue background color. This would be used to implement Mozilla Mail's labels feature. We'll use a property called 'makeItBlue'. You can use whateve...
... attribute on the rows or cells to set one or more named properties. This can be used with trees with static content, RDF built content or with those with a custom view. Let's say we want a particular row to have a blue background color. This would be used to implement Mozilla Mail's labels feature. We'll use a property called 'makeItBlue'. You can use whatever name you want. You can set multiple properties by separating them with spaces. Set the property on a row or cell, as in the following example: <treerow properties="makeItBlue"> CSS Selectors for the Tree The style sheet can take this property and use it to change the appearance of the row for unread messages or labels. ...
...This is because you can specify the style for a number of parts of the cell individually. You can style not only the cell and its text, but the twisty and indentation. ...
...And 11 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
a trusted user and sends a website unwanted commands. 55 CSS CSS, CodingScripting, Glossary, Web, l10n:priority CSS (Cascading Style Sheets) is a declarative language that controls how webpages look in the browser. 56 CSS Object Model (CSSOM) CSS, CSSOM, DOM, Glossary, Web Performance The CSS Object Model (CSSOM) is a map of all CSS selectors and relevant properties for each selector in the form of a tree, with a root node, sibling, descendant, child, and other relationship. The CSSOM is very similar to the Document Object Model (DOM). Both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. 57 CSS pixel CSS, CSS Pixel, Glossary, height, length, pixel, size, unit, width ...
...pher and the right secret (usually a key), reproducing the original cleartext. A ciphertext's security, and therefore the secrecy of the contained information, depends on using a secure cipher and keeping the key secret. 78 Class CodingScripting, Glossary In object-oriented programming, a class defines an object's characteristics. Class is a template definition of an object's properties and methods, the "blueprint" from which other more specific instances of the object are drawn. 79 Client hints Client hints, Glossary, Performance, Reference, Web Performance Client Hints are a set of HTTP request header fields for proactive content negotiation allowing clients to indicate a list of device and agent specific preferences. 80 Closure CodingScrip...
...is, the "<!DOCTYPE html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications. 117 Document directive CSP, Directive, Document, Glossary, HTTP, Security CSP document directives are used in a Content-Security-Policy header and govern the properties of a document or worker environment to which a policy applies. 118 Domain Browser, Domain, Glossary, Infrastructure, Networking A domain is an authority within the internet that controls its own resources. Its "domain name" is a way to address this authority as part of the hierarchy in a URL - usually the most memorable part of it, for instance a brand name. 119 Do...
...And 11 more matches
The box model - Learn web development
ms of page flow, and in relation to other boxes on the page: If a box is defined as a block, it will behave in the following ways: The box will break onto a new line. The box will extend in the inline direction to fill the space available in its container. In most cases this means that the box will become as wide as its container, filling up 100% of the space available. ...
... Vertical padding, margins, 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. ...
...ed in the box model. The model defines how the different parts of a box -- margin, border, padding, and content -- work together to create a box that you can see on the page. To add some additional complexity, there is a standard and an alternate box model. Parts of a box Making up a block box in CSS we have the: Content box: The area where your content is displayed, which can be sized using properties like width and height. Padding box: The padding sits around the content as white space; its size can be controlled using padding and related properties. Border box: The border box wraps the content and any padding. Its size and style can be controlled using border and related properties. Margin box: The margin is the outermost layer, wrapping the content, padding and border as whitespace betwe...
...And 11 more matches
Fundamental text and font styling - Learn web development
th CSS. Here we'll go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. Prerequisites: Basic computer literacy, HTML basics (study Introduction to HTML), CSS basics (study Introduction to CSS). Objective: To learn the fundamental properties and techniques needed to style text on web pages. What is involved in styling text in CSS? As you'll have already experienced in your work with HTML and CSS, text inside an element is laid out inside the element's content box. It starts at the top left of the content area (or the top right, in the case of RTL language content), and flows towards the end of the line. Once it reaches the en...
...e a series of inline elements, being laid out on lines adjacent to one another, and not creating line breaks until the end of the line is reached, or unless you force a line break manually using the <br> element. Note: If the above paragraph leaves you feeling confused, then no matter -- go back and review our Box model article, to brush up on the box model theory, before carrying on. The CSS properties used to style text generally fall into two categories, which we'll look at separately in this article: Font styles: Properties that affect the font that is applied to the text, affecting what font is applied, how big it is, whether it is bold, italic, etc. Text layout styles: Properties that affect the spacing and other layout features of the text, allowing manipulation of, for example, the s...
...Many a fat alley rat had met its demise while staring point blank d...
...And 11 more matches
Index
Mozilla › Tech › XPCOM › Index
de 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:Language Bindings, XPConnect Components.classesByID is a read-only object whose properties are classes indexed by CID. 22 Components.interfaces XPCOM:Language Bindings, XPConnect Components.interfaces is a read-only object whose properties are interfaces indexed by their names. 23 ...
...y! 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 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 nsIS...
...g object. 40 Components.utils.import NeedsContent, XPCOM:Language Bindings, XPConnect Components.utils.import was introduced in Firefox 3 and is used for sharing code between different scopes easily. For example, you can import XPCOMUtils.jsm to avoid copy/pasting long XPCOM component registration boilerplate in your component files. 41 Components.utils.importGlobalProperties Imports various objects into a system scope. 42 Components.utils.isXrayWrapper When privileged JavaScript in Gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "Xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways. For example...
...And 11 more matches
Debugger.Object - Firefox Developer Tools
Debugger.Object A Debugger.Object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. The referent's properties do not appear directly as properties of the Debugger.Object instance; the debugger can access them only through methods like Debugger.Object.prototype.getOwnPropertyDescriptor and Debugger.Object.prototype.defineProperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. SpiderMonkey creates exactly one Debugger.Object instance for each debuggee object it presents to a given Debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), SpiderMonkey presents the same Debugger.Object instance to ...
...sents to a given Debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), SpiderMonkey presents the same Debugger.Object instance to the debugger each time. This means that the debugger can use the == operator to recognize when two Debugger.Object instances refer to the same debuggee object, and place its own properties on a Debugger.Object instance to store metadata about particular debuggee objects. JavaScript code in different compartments can have different views of the same object. For example, in Firefox, code in privileged compartments sees content DOM element objects without redefinitions or extensions made to that object's properties by content code. (In Firefox terminology, privileged code sees the el...
...debugger came across the referent. As a consequence, a single Debugger instance may actually have several Debugger.Object instances: one for each compartment from which the referent is viewed. If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Object instance for 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.pro...
...And 11 more matches
Using the CSS Typed Object Model - Web APIs
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 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 JavaSc...
... all the default CSS property values impacting the link using computedStyleMap(). ...
...Element = document.querySelector('a'); // get the <dl> we'll be populating const stylesList = document.querySelector('#regurgitation'); // Retrieve all computed styles with computedStyleMap() const defaultComputedStyles = myElement.computedStyleMap(); // iterate thru the map of all the properties and values, adding a <dt> and <dd> for each for (const [prop, val] of defaultComputedStyles) { // 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); } The computedStyleMap() method returns a StylePropertyMapReadOnly object containing the size property, ...
...And 11 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
bilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. Alignment of text is now covered by the Inline Layout and CSS Text modules, and for the first time in Box Alignment we have full horizontal and vertical alignment capabilities. If you initially learned Flexbox then you may consider these properties to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of Flexbox. However the specification notes that the Box Alignment specification should be referred to as it may add additional capabilities over what is currently in Flexbox. Basic examples The following examples demonstrate how some of the Box Alignment Properties are applied in Grid and Flexbox. ...
...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 easier to discuss these alignment properties outside of their implementation within a particular layout method. There are also some key concepts which are common to all layout methods. Relationship to writing modes Alignment is linked to writing modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left. Instead we describe alignment in terms of the start and...
...modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left. Instead we describe alignment in terms of the start and end of the particular dimension we are working with. This ensures that alignment works in the same way whichever writing mode the document has. Two dimensions of alignment When using the box alignment properties you will align content on one of two axes -- the inline (or main) axis, and the block (or cross) axis. The inline axis is the axis along which words in a sentence flow in the writing mode being used -- for English, for example, the inline axis is horizontal. The block axis is the axis along which blocks, such as paragraph elements, are laid out and it runs across the Inline axis. When aligning...
...And 11 more matches
tabs - Archive of obsolete content
tabs.on('open', function onOpen(tab) { myOpenTabs.push(tab); }); // Listen for tab content loads. ...
...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 hos...
...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 acce...
...And 10 more matches
Localization - Archive of obsolete content
metadata the title and description fields of your add-on's preferences. It doesn't, yet, support localization of CSS or content scripts, or the add-on's title and description that appear in the Add-ons Manager. See Limitations below. Localized strings Translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
... fields of your add-on's preferences. It doesn't, yet, support localization of CSS or content scripts, or the add-on's title and description that appear in the Add-ons Manager. See Limitations below. Localized strings Translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...ormat identifier=translation need to use UTF-8 without BOM encoding Lines starting with "#" (after optional whitespace) are comments Suppose your add-on contains a single localizable string, represented in English as "Hello!", and you want to supply US English and French French localizations. You'd add two files to the "locale" directory: my-addon/ data lib locale/ en-US.properties fr.properties "en-US.properties" contains this: hello_id= Hello! "fr.properties" contains this: hello_id= Bonjour ! Now whenever your JavaScript or HTML asks the localization system for the translation of the hello_id identifier, it will get the correct translation for the current locale. Using localized strings in HTML This example uses the action button API, which is only ava...
...And 10 more matches
XPIDL
s Guide (Not as out of date) Explanation of IDL semantics A full guide to the syntax can be found at XPIDL:Syntax, which is written in an ABNF form. An xpidl file is essentially just a series of declarations. At the top level, we can define typedefs, native types, or interfaces. Interfaces may furthermore contain typedefs, natives, methods, constants, or attributes. Most declarations can have properties applied to them. Types There are three ways to make types: a typedef, a native, or an interface. In addition, there are a few built-in native types. The built-in native types are those listed under the type_spec production above. The following is the correspondence table: Table 1: Standard IDL types IDL C++ in parameter C++ out parameter JS type Notes boolean...
... The contents of the parentheses of a native type declaration (although native declarations without parentheses are parsable, I do not trust that they are properly handled by the xpidl handlers) is a string equivalent to the C++ type. XPIDL itself does not interpret this string, it just literally pastes it anywhere the native type is used. The interpretation of the type can be modified by having properties on the native declaration: Table 3: Native type definitions astring This is an nsAString declaration. Overrides native string. cstring This is an nsACString declaration. Overrides native string. jsval This type gets const when an in type. Special in typelib. nsid This type gets const when an in type. Special in typelib. ptr The type is...
...declaration. Overrides native string. jsval This type gets const when an in type. Special in typelib. nsid This type gets const when an in type. Special in typelib. ptr The type is really (native str)* ref The type is really (native str)& utf8string This is an nsACString declaration whose text is UTF-8. As far as I can tell, these properties also apply to typedefs. Need to verify. WebIDL interfaces are also valid XPIDL types. To declare a WebIDL interface in XPIDL, write webidl InterfaceName;. WebIDL types will be passed as mozilla::dom::InterfaceName* when used as in-parameters, as mozilla::dom::InterfaceName** when used as out or inout-parameters, and as RefPtr<mozilla::dom::InterfaceName> when used as an array element. Other We...
...And 10 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; } <div cla...
...et 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; } <div class="container"> <div class="item">Item</div> </div> Another place you might see physical keywords in use, is when using text-align: right to align text to the right. There are also physical properties in CSS. We add margins, padding, and borders using these physical properties of margin-left, padding-left, and so on. We call these keywords and properties physical because they relate to the screen you are looking at. Left is always left, no matter what direction your text is running. This can become an issue when developing a site that has to work in multiple languages, including languages th...
... 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 the container. F...
...And 10 more matches
border-inline-end - CSS: Cascading Style Sheets
rder-inline-end CSS property is a shorthand property for setting the individual logical inline-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. Constituent properties This property is a shorthand for the following CSS properties: border-inline-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. It corresponds to the b...
...er-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. 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. ...
... 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 10 more matches
Microformats - HTML: Hypertext Markup Language
mantics & 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 learning new attributes. Microformats are supp...
...arser encounters this data, it will know that this page contains a "card" which describes a person or organization named Alice Blogger with a URL of http://alice.example.com/. The 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...
...rarchical 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 top-level root classes usually indicate a type and corresponding expected vocabulary of properties. For example: h-card describes a person or organization h-entry describes episodic or date stamped online content like a blog post h-feed describes a stream or feed of posts You can find many more vocabularies on the microformats2 wiki. "p-*" for plain (text) properties, e.g. "p-name", "p-summary" Generic plain text parsing, element text in general. On certain HTML elements, u...
...And 10 more matches
Object.create() - JavaScript
The Object.create() method creates a new object, using an existing object as the prototype of the newly created 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.create(proto, [propertiesObject]) Parameters proto The object which should be the prototype of the newly-created object. propertiesObject 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...
... 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. ...
...y-created object. propertiesObject 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...
...And 10 more matches
jspage - Archive of obsolete content
f(Array[a]){return;}Elements.implement(a,function(){var c=[],g=true;for(var e=0,d=this.length;e<d;e++){var f=this[e][a].apply(this[e],arguments);c.push(f); if(g){g=($type(f)=="element");}}return(g)?new Elements(c):c;});}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var f=Array.link(arguments,{properties:Object.type,iframe:$defined}); var d=f.properties||{};var c=document.id(f.iframe);var e=d.onload||$empty;delete d.onload;d.id=d.name=$pick(d.id,d.name,c?(c.id||c.name):"IFrame_"+$time()); c=new Element(c||"iframe",d);var b=function(){var g=$try(function(){return c.contentWindow.location.host;});if(!g||g==window.location.host){var h=new Window(c.contentWindow); new Document(c.contentWindow.documen...
...rtBefore(m,n):l.appendChild(m);}};a.inside=a.bottom;Hash.each(a,function(l,m){m=m.capitalize();Element.implement("inject"+m,function(n){l(this,document.id(n,true)); return this;});Element.implement("grab"+m,function(n){l(document.id(n,true),this);return this;});});Element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]); }break;case"string":var l=Element.Properties.get(o);(l&&l.set)?l.set.apply(this,Array.slice(arguments,1)):this.setProperty(o,m);}return this;},get:function(m){var l=Element.Properties.get(m); return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m); return this;},setProperty:function(m,n){var l=e[m];if(n==undefi...
...){var l=Element.Properties.get(m); return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m); return this;},setProperty:function(m,n){var l=e[m];if(n==undefined){return this.removeProperty(m);}if(l&&b[m]){n=!!n;}(l)?this[l]=n:this.setAttribute(m,""+n); return this;},setProperties:function(l){for(var m in l){this.setProperty(m,l[m]);}return this;},getProperty:function(m){var l=e[m];var n=(l)?this[l]:this.getAttribute(m,2); return(b[m])?!!n:(l)?n:n||null;},getProperties:function(){var l=$A(arguments);return l.map(this.getProperty,this).associate(l);},removeProperty:function(m){var l=e[m]; (l)?this[l]=(l&&b[m])?false:"":this.removeAttribute(m);return this;},removeProperties:...
...And 9 more matches
Places utilities for JavaScript
showAddLivemarkUI(nsIURI aFeedURI, nsIURI aSiteURI, string aTitle, string aDescription, int aDefaultInsertionPoint, boolean aShowPicker); boolean showMinimalAddLivemarkUI(nsIURI aFeedURI, nsIURI aSiteURI, string aTitle, string aDescription, int aDefaultInsertionPoint, boolean aShowPicker); boolean showMinimalAddMultiBookmarkUI(array nsIURI aURIList); boolean showBookmarkProperties(int aId); boolean showFolderProperties(int aId); boolean showAddFolderUI(string aTitle, int aDefaultInsertionPoint, boolean aShowPicker); array object getAnnotationsForURI(nsIURI aURI); array object getAnnotationsForItem(int aItemId); void setAnnotationsForURI(nsIURI aURI, object aAnnos); void setAnnotationsForURI(int aItemId, object aAnnos); ...
...stitute into the bundle at designated points See XUL:stringbundle for more information. Return type Returns a string from the default places stringbundle. getString() string getString(string key) Parameters key The name of the string to get. Return type Returns a string from the default places stringbundle. nodeIs() There are a ton of nodeIs(something) functions in here to check properties of a bookmark node. The all take in the same argument and return a boolean true or false, so I'm just going to list them all in one lump: boolean nodeIsFolder(aNode) Determines whether or not a ResultNode is a Bookmark folder or not. boolean nodeIsBookmark(aNode) Determines whether or not a ResultNode represents a bookmarked URI. boolean nodeIsSeparator(aNode) Determines whether or not a ...
...sed on the left places pane so you just get a folder hierarchy. [optional] expandQueries True to make query items expand as new containers. For managing,you want this to be false, for menus and such, you want this to be true. Return type Returns a nsINavHistoryResult containing the contents of the folder. The result.root is guaranteed to be open. Bookmark Dialog Methods to show the bookmarkProperties dialog in its various modes. The showMinimalAdd methods open the dialog by its alternative URI. Thus they persist the dialog dimensions separately from the showAdd methods. Note these variants also do not return the dialog "performed" state since they may not open the dialog modally. showAddBookmarkUI() Shows the "Add Bookmark" dialog. showAddBookmarkUI(aURI, aTitle, ...
...And 9 more matches
Debugger - Firefox Developer Tools
The Debugger Object When called 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. Th...
...rt of backstop, even if imperfect, will make life easier for debugger developers. For example, an uncaught exception hook may have access to browser-level features like the alert function, which this API's implementation does not, making it possible to present debugger errors to the developer in a way suited to the context.) Debugger Handler Functions Each Debugger instance inherits accessor properties with which you can store handler functions for SpiderMonkey to call when given events occur in debuggee code. When one of the events described below occurs in debuggee code, the engine pauses the debuggee and calls the corresponding debugging handler on each Debugger instance that is observing the debuggee. The handler functions receive the Debugger instance as their this value. Most handler fun...
...escribed below occurs in debuggee code, the engine pauses the debuggee and calls the corresponding debugging handler on each Debugger instance that is observing the debuggee. The handler functions receive the Debugger instance as their this value. Most handler functions can return a resumption value indicating how the debuggee's execution should proceed. On a new Debugger instance, each of these properties is initially undefined. Any value assigned to a debugging handler must be either a function or undefined; otherwise a TypeError is thrown. Handler functions run in the same thread in which the event occurred. They run in the compartment to which they belong, not in a debuggee compartment. onNewScript(script,global) New code, represented by the Debugger.Script instancescript, has been loade...
...And 9 more matches
HTMLInputElement - Web APIs
The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,...
... formAction string: Returns / Sets the element's formaction attribute, containing the URI of a program that processes information submitted by the element. This overrides the action attribute of the parent form. formEncType string...
... formAction string: Returns / Sets the element's formaction attribute, containing the URI of a program that processes information submitted by the element. This overrides the action attribute of the parent form. formEncType string: Returns / Se...
...And 9 more matches
Microdata DOM API - Web APIs
tting the string on spaces. 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. Otherwis...
...Value [ = 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 HTMLPropertiesCollection object. Code example This sample shows how the getItems() method can be used to obtain a list of all the top-level microdata items of a particular type given in the document: var cats = document.getItems("http://example.com/feline"); Once an element representing an item has been obtained, its properties can be extracted using the properties IDL attribute. This attribute returns an H...
...lection object. Code example This sample shows how the getItems() method can be used to obtain a list of all the top-level microdata items of a particular type given in the document: var cats = document.getItems("http://example.com/feline"); Once an element representing an item has been obtained, 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. Each element that adds a property also has an itemValue IDL attribute that returns its value. Code example This sample gets the first item of type "http://example.n...
...And 9 more matches
itemprop - HTML: Hypertext Markup Language
Property values are either a string or a URL and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. Examples The example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. ...
...When a string value is a URL, it is expressed using the <a> element and its href attribute, the <img> element and its src attribute, or other elements that link to or embed external resources. Three properties with values that are strings <div itemscope> <p>My name is <span itemprop="name">Neil</span>.</p> <p>My band is called <...
...When a string value is a URL, it is expressed using the <a> element and its href attribute, the <img> element and its src attribute, or other elements that link to or embed external resources. Three properties with values that are strings <div itemscope> <p>My name is <span itemprop="name">Neil</span>.</p> <p>My band is called <span itempro...
...And 9 more matches
ui/button/action - Archive of obsolete content
"32": "./firefox-32.png" }, onClick: firstClick }); function firstClick(state) { console.log("You clicked '" + state.label + "'"); button.removeListener("click", firstClick); button.on("click", subsequentClicks); } function subsequentClicks(state) { console.log("You clicked '" + state.label + "' again"); } The listener is passed a state object that contains all the button's properties. You can generate click events programmatically with the button's click() method. Disabling buttons You can disable a button by setting its disabled property to true. A disabled button will not generate click events and its icon will appear disabled: Updating state You can update all the button's properties except for its id. By default, the button has global state: that is, its propertie...
...ss all open windows and tabs. You can set state to be specific to a window or tab using the button's state() method. To set state like this, call state() with 2 parameters: the first parameter is a window or tab object or as a shorthand, the string "window" for the currently active window, or the string "tab" for the currently active tab the second parameter is an object containing the state properties you wish to update. Here's an add-on with a button that disables itself when you click it, but only for the currently active window: var { ActionButton } = require("sdk/ui/button/action"); var button = ActionButton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onClick: disableForThisWindow }); function d...
...he state for a specific window or tab, call state(), passing in the window or tab you are interested in, and it will return the state: var labelForActiveTab = button.state("tab").label; To learn more about this, see the API documentation for state(). Destroying buttons When you've finished with a button, destroy it by calling its destroy() method. After that, any attempts to access any of its properties or to call any of its methods will throw exceptions. Globals Constructors ActionButton(options) Creates an action button. Parameters options : object Required options: Name Type id string The button's ID. This is used internally to keep track of this button. The ID must be unique within your add-on. label string The button's...
...And 8 more matches
JXON - Archive of obsolete content
tributes names is case insensitive (always rendered in lower case), so objects' local property names set using JavaScript must always have some kind of capitalization (that is, at least one capital letter somewhere in their names), as you can see below. The following algorithms are somewhat based on the Parker convention, version 0.4, which prescribes the transformation of tags names into object properties names and the recognition of the typeof of all the collected text content of each tag (plain text parsing); but with some differences (so, one can say that we follow a our convention). Moreover, all algorithms are equally lossless for the contemplated nodes. We consider the third algorithm as the most representative and practical JXON parsing algorithm. Now let's serialize doc -- the DOM tree -...
... JXONTree.prototype.valueOf = function () { return this.keyValue; }; JXONTree.prototype.toString = function () { return String(this.keyValue); }; JXONTree.prototype.getItem = function (nItem) { ...
...ttributes.length; nAttrLen++) { oAttrib = oXMLParent.attributes.item(nAttrLen); this.keyAttributes[oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim()); } } /* * Optional properties... this.keyLength = nLength; this.attributesLength = nAttrLen; // this.DOMNode = oXMLParent; */ /* Object.freeze(this); */ } /* * Optional methods... ...
...And 8 more matches
Box Objects - Archive of obsolete content
content or structure of the document. It's relatively simple to determine what kind of content tree node will be created for a given element. A XUL element, for example, will have a XULElement type of content node. The layout objects that will be created are determined in a more complex manner. Various pieces of information are used such as the tag name, the attributes on an element, various CSS properties, the elements and layout objects around the element, and the XBL associated with an element (XBL is described in a later section). Unless you change the style for an element, most XUL elements will usually use the box layout object or one of its subtypes. Recall that all XUL elements are types of boxes, that is the box is the base of all displayed XUL elements. However, there are a number of subt...
...mplies, they are available for all box-based elements. There are several subtypes of box object, although only a couple of them are generally used. The others have functions which are more easily accessible by methods mapped directly onto the element, since those types are generally only used with one particular element. ...
... All values returned are in pixels. ...
...And 8 more matches
Document Object Model - Archive of obsolete content
avaScript. The various DOM objects have functions which may be accessed in script, however, it is important to note that the DOM is an API that is accessible by JavaScript. JavaScript itself is just a scripting language that can access these objects because Mozilla provides these objects for use. In JavaScript, there is always a single global object that is always available. You can refer to the properties and methods of the global object without having to qualify them with an object. For example, if the global object has a 'name' property, you can change the name with the code 'name = 7', without having to specify any object to use. In a browser context, the window is the global object, and the same is also true for XUL. Naturally, this global object will be different for each window. Each frame w...
...typically be available yet. The window object isn't defined by any DOM specification, but in Mozilla is sometimes considered part of DOM Level 0, a name used by some developers to refer to the DOM-like functions before they were added to specifications. The actual document displayed in a window can be retrieved using the window's document property. Since it is one of the most commonly referenced properties of the window, the document property is usually referenced without the 'window.' qualifier. Mozilla provides several different document objects depending on the kind of document. The three main documents are HTMLDocument, XMLDocument, and XULDocument, for HTML, XML and XUL documents respectively. Obviously, it is this latter type of document used for XUL. The three document types are very simila...
...Id('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", is a flex attribute set to the value 1. Properties are available in JavaScript using the dot syntax. For example, element.hidden refers to the hidden property of an element. The children are the child tags of the element and will be nested inside the element in the source. It is possible to manipulate ...
...And 8 more matches
Using the W3C DOM - Archive of obsolete content
The W3C Document Object Model provides interfaces DOM elements to scriptable objects. W3C DOM standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. ...
... standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. Using 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. ...
... the standards are moving target so support for newer features should be tested before use. Using 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. ...
...And 8 more matches
Index - Learn web development
l10n:priority, object literal, theory, this Congratulations, you've reached the end of our first JS objects article -- you should now have a good idea of how to work with objects in JavaScript -- including creating your own simple objects. You should also appreciate that objects are very useful as structures for storing related data and functionality -- if you tried to keep track of all the properties and methods in our person object as separate variables and functions, it would be inefficient and frustrating, and we'd run the risk of clashing with other variables and functions that have the same names. Objects let us keep the information safely locked away in their own package, out of harm's way. 68 Object building practice Article, Beginner, Canvas, CodingScripting, Guide, Jav...
...'ve covered a lot in this module, so it must feel good to have reached the end! The final step before you move on is to attempt the assessment for the module -- this involves a number of related exercises that must be completed in order to create the final design -- a business card/gamer card/social media profile. 119 Handling different text directions Beginner, CSS, Learn, logical properties, writing modes The concepts explained in this lesson are becoming increasingly important in CSS. An understanding of the block and inline direction -- and how text flow changes with a change in writing mode -- will be very useful going forward. It will help you in understanding CSS even if you never use a writing mode other than a horizontal one. 120 Images, media, and form eleme...
...different layout methods, so it is worth understanding the concepts here before moving on. 124 Styling tables Article, Beginner, CSS, CodingScripting, Guide, NeedsUpdate, Styling, Tables With styling tables now behind us, we need something else to occupy our time. The next article explores debugging CSS -- how to solve problems such as layouts not looking like they should, or properties not applying when you think they should. This includes information on using browser DevTools to find solutions to your problems. 125 Test your skills: Images and Form elements Beginner, CSS 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 Images, Media and Form elements. 126 Test your sk...
...And 8 more matches
Object prototypes - Learn web development
ee Introduction to objects). Objective: To understand JavaScript object prototypes, how prototype chains work, and how to add new methods onto the prototype property. A prototype-based language? JavaScript is often described as a prototype-based language -- to provide inheritance, objects can have a prototype object, which acts as a template object that it inherits methods and properties from. An object's prototype object may also have a prototype object, which it inherits methods and properties from, and so on. This is often referred to as a prototype chain, and explains why different objects have properties and methods defined on other objects available to them. In JavaScript, a link is made between the object instance and its prototype (its __proto__ property, which is deriv...
... Note: It's important to understand that there is a distinction between an object's prototype (available via Object.getPrototypeOf(obj), or via the deprecated __proto__ property) and the prototype property on constructor functions. ...
...on1 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 person1's prototype object's prototype object, and it has. So the method is called, and all is good! Note: We want to reiterate that the methods and properties are not copied from one object to another in the prototype chain. They are accessed by walking up the chain as described above. Note: Before ECMAScript 2015, there wasn't officially a way to access an object's prototype directly -- the "links" between the items in the chain are defined in an internal property, referred to as [[prototype]] in the specification for the JavaScript language (see E...
...And 8 more matches
nsITreeView
aTransfer); boolean canDropBeforeAfter(in long index, in boolean before); Obsolete since Gecko 1.8 boolean canDropOn(in long index); Obsolete since Gecko 1.8 void cycleCell(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 c...
...lValue(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 getRowProperties(in long index, in nsISupportsArray properties Obsolete since Gecko 22); boolean hasNextSibling(in long rowIndex, in long afterIndex); boolean isContainer(in long index); boolean isContainerEmpty(in long index); boolean isContainerOpen(in long index); boolean isEditable(in long row, in nsITreeColumn col); boolean isSelectable(in long row, in ns...
... something on this view. The orientation paramater specifies before/on/after the given row. void drop( in long row, in long orientation, in nsIDOMDataTransfer dataTransfer ); Parameters row The index of the row. orientation The position around the given row. Defined in constants. dataTransfer This parameter, added in Gecko 1.9.2, provides the data that has been dropped. getCellProperties() An atomized list of properties for a given cell. Each property, x, that the view gives back will cause the CSS ::moz-tree-cell-*(x) pseudoelement to be matched on the treechildren element. See getRowProperties() for an example. AString getCellProperties( in long row, in nsITreeColumn col, in nsISupportsArray properties ); Parameters row The index of the row. col The current col...
...And 8 more matches
Examples of web and XML development using the DOM - Web APIs
This chapter provides some longer examples of web and XML development using the DOM. Wherever possible, the examples use common APIs, tricks, and patterns in JavaScript for manipulating the document object. ...
...In this case, you are manipulating the individual styles directly. In the next example (see Example 4), you can use stylesheets and their rules to change styles for whole documents. <!DOCTYPE html> <html lang="en"> <head> <title>Chan...
...In this case, you are manipulating the individual styles directly. ...
...And 8 more matches
Using CSS transitions - CSS: Cascading Style Sheets
CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. Animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. ...
...black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. Animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. CSS transitions let you decide which properties to animate (by listing them explicitly), when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. linearly or quick at the beginning, slow at the end). Which CSS properties can be transitioned? The Web author can define which property has to be animated and in which way. Th...
... The auto value is often a very complex case. ...
...And 8 more matches
Object.defineProperty() - JavaScript
bj 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 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 des...
...nd 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 cannot be both. Both data and accessor descriptors are objects. They share the following optional keys (note: the default value is in the case of defining properties using Object.defineProperty()): 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 optiona...
...ue being assigned to the property) and with this set to the object through which the property is assigned. Defaults to undefined. If a descriptor has neither of value, writable, get and set keys, it is treated as a data descriptor. If a descriptor has both value or writable and get or set keys, an exception is thrown. Bear in mind that these attributes are not necessarily the descriptor's own properties. ...
...And 8 more matches
passwords - Archive of obsolete content
redentials in the Password Manager. You can store different sorts of credentials, as outlined in the "Credentials" section below. Remove stored credentials from the Password Manager. Credentials In this API, credentials are represented by objects. You create credential objects to pass into the API, and the API also returns credential objects to you. The sections below explain both the properties you should define on credential objects and the properties you can expect on credential objects returned by the API. All credential objects include username and password properties. Different sorts of stored credentials include various additional properties, as outlined in this section. You can use the Passwords API with three sorts of credentials: Add-on credentials HTML form credentials ...
... 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. ...
...r, under "Site", in brackets after the URL. For example, if the realm for a credential is "User Registration", then its "Site" field will look something like: addon:jid0-01mBBFyu0ZAXCFuB1JYKooSTKIc (User Registration) HTML Form Credential If a web 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" attri...
...And 7 more matches
places/bookmarks - Archive of obsolete content
nce, unsaved let bookmark = Bookmark({ title: "Mozilla", url: "http://mozilla.org" }); // Attempt to save the bookmark instance to the Bookmarks database // and store the emitter let emitter = save(bookmark); // Listen for events emitter.on("data", function (saved, inputItem) { // on a "data" event, an item has been updated, passing in the // latest snapshot from the server as `saved` (with properties // such as `updated` and `id`), as well as the initial input // item as `inputItem` console.log(saved.title === inputItem.title); // true console.log(saved !== inputItem); // true console.log(inputItem === bookmark); // true }).on("end", function (savedItems, inputItems) { // Similar to "data" events, except "end" is an aggregate of // all progress events, with ordered arrays as `sa...
...l of our updated saves. Only explicitly saved // items are returned in this array -- the `group` won't be // present here. console.log(saves[0].title); // "Ran" console.log(saves[2].group.title); // "Guitars" }); Searching for bookmarks Bookmarks can be queried with the search() function, which accepts a query object or an array of query objects, as well as a query options object. Query properties are AND'd together within a single query object, but are OR'd together across multiple query objects. let { search, UNSORTED } = require("sdk/places/bookmarks"); // Simple query with one object search( { query: "firefox" }, { sort: "title" } ).on("end", function (results) { // results matching any bookmark that has "firefox" // in its URL, title or tag, sorted by title }); // Multiple ...
...; // Multiple queries are OR'd together search( [{ query: "firefox" }, { group: UNSORTED, tags: ["mozilla"] }], { sort: "title" } ).on("end", function (results) { // Our first query is the same as the simple query above; // all of those results are also returned here. Since multiple // queries are OR'd together, we also get bookmarks that // match the second query. The second query's properties // are AND'd together, so results that are in the platform's unsorted // bookmarks folder, AND are also tagged with 'mozilla', get returned // as well in this query }); Globals Constructors Bookmark(options) Creates an unsaved bookmark instance. Parameters options : object Required options: Name Type title string The title for the bookmark. R...
...And 7 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
he 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 development team to develop Firebug. You can use it to help debug Firefox extensions as well as to inspect and learn how the Firefox UI (Chrome) is constructed. You can l...
...sting 9). The clock.dtd file inside the fr-FR folder must be encoded as UTF-8. Listing 9: Content for clock.dtd locale\en-US\clock.dtd: <!ENTITY helloworld.clock "Clock"> <!ENTITY helloworld.currentTime "Current Time"> locale\fr-FR\clock.dtd: <!ENTITY helloworld.clock "Horloge"> <!ENTITY helloworld.currentTime "Heure courante"> Replacing User Interface messages within JavaScript files with properties references It may happen your extension displays some useful messages such as alerts to the user. Though they are nested in JavaScript, the strings should be localized too, for the sake of UI consistency. Suppose you have these strings nested in a .js file: if ( password == userPassword ) { oPrefs.setBoolPref("access.authenticated", true); } else { alert ("Invalid password"); ...... functio...
... user. Though they are nested in JavaScript, the strings should be localized too, for the sake of UI consistency. Suppose you have these strings nested in a .js file: if ( password == userPassword ) { oPrefs.setBoolPref("access.authenticated", true); } else { alert ("Invalid password"); ...... function clear() { sure = confirm("Are you sure?"); First, you have to find or create a myextension.properties file in your locale folder (Notice: always stick to UTF-8). Then you simply write variable names and the sentences or words that should appear to the final user. Something like : wrongPassMessage=Invalid password areYouSureMessage=Are you sure? (where Invalid password and Are you sure? are the strings to be displayed to the final user) Notice : a simple sign is enough Now you go back to the...
...And 7 more matches
Introduction to CSS layout - Learn web development
ws you to precisely control the placement of boxes inside other boxes. static positioning is the default in normal flow, but you can cause elements to be laid out differently using other values, for example always fixed to the top of the browser viewport. Table layout -- features designed for styling the parts of an HTML table can be used on non-table elements using display: table and associated properties. Multi-column layout -- The Multi-column layout properties can cause the content of a block to layout in columns, as you might see in a newspaper. The display property The main methods of achieving page layout in CSS are all values of the display property. This property allows us to change the default way something displays. Everything in normal flow has a value of display, used as the defaul...
...ents for their semantic meaning, without being concerned about how they will look. The way they look is something that you can change. In addition to being able to change the default presentation by turning an item from block to inline and vice versa, there are some bigger layout methods that start out as a value of display. However, when using these, you will generally need to invoke additional properties. The two values most important for our purposes when discussing layout are display: flex and display: grid. Flexbox Flexbox is the short name for the Flexible Box Layout Module, designed to make it easy for us to lay things out in one dimension -- either as a row or as a column. To use flexbox, you apply display: flex to the parent element of the elements you want to lay out; all its direct chi...
...container, leaving any extra space at the end of the row. Flexbox Example 1 * {box-sizing: border-box;} .wrapper > div { border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } .wrapper { display: flex; } <div class="wrapper"> <div class="box1">One</div> <div class="box2">Two</div> <div class="box3">Three</div> </div> In addition to the above properties that can be applied to the flex container, there are properties that can be applied to the flex items. These properties, among other things, can change the way that the items flex, enabling them to expand and contract to fit into the available space. As a simple example of this, we can add the flex property to all of our child items, with a value of 1. This will cause all of the items to grow an...
...And 7 more matches
Inheritance in JavaScript - Learn web development
avaScript that inherits from another object? Let's explore how to do this with a concrete example. Getting started First of all, make yourself a local copy of our oojs-class-inheritance-start.html file (see it running live also). Inside here you'll find the same Person() constructor example that we've been using all the way through the module, with a slight difference -- we've defined only the properties inside the constructor: function Person(first, last, age, gender, interests) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; }; The methods are all defined on the constructor's prototype. For example: Person.prototype.greeting = function() { alert('Hi! I\'m ' + this.name.first + '.'); }; Note: In the source code, you'll als...
...nstructor simply defines the new subject property that teachers are going to have, which generic people don't have. As a note, we could have simply done this: function Teacher(first, last, age, gender, interests, subject) { this.name = { first, last }; 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...
... 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.5; this.color = 'blue'; } Note that we've only specified this inside call() -- no other parameters are required as we are not inheriting any properties from the parent that are set via parameters. Setting Teacher()'s prototype and constructor reference A...
...And 7 more matches
JS_InitClass
Syntax JSObject * JS_InitClass(JSContext *cx, JS::HandleObject obj, JS::HandleObject parent_proto, const JSClass *clasp, JSNative constructor, unsigned nargs, const JSPropertySpec *ps, const JSFunctionSpec *fs, const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs); 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. ...
...nlike other JSNatives, this function must not call JS_THIS or JS_THIS_OBJECT. Instead it must create a new object and return it. nargs unsigned Number of arguments for the constructor. ps JSPropertySpec * Either NULL or a pointer to the first element of an array of JSPropertySpecs, terminated by the null JSPropertySpec, which can be written {0, 0, 0, 0, 0}. These properties, if any, are added to the class's new prototype object. All instances of the new class will inherit these properties via the prototype chain. fs JSFunctionSpec * Either NULL or a pointer to the first element of an array of JSFunctionSpecs, terminated by JS_FS_END. These functions, if any, are added to the class's new prototype object. All instances of the new class will inherit the...
...ese functions, if any, are added to the class's new prototype object. All instances of the new class will inherit these methods via the prototype chain. (This is the JavaScript equivalent of public, non-static methods in C++ or Java.) static_ps JSPropertySpec * Either NULL or a pointer to the first element of an array of JSPropertySpecs, terminated by the null JSPropertySpec. These properties, if any, are added to the new class's constructor. (This is the nearest JavaScript equivalent of public static member variables in C++ or public static fields in Java.) static_fs JSFunctionSpec * Either NULL or a pointer to the first element of an array of JSFunctionSpecs, terminated by JS_FS_END. These functions, if any, are added to the new class's constructor. (This is the JavaS...
...And 7 more matches
Xray vision
n Gecko ensures that there's asymmetric access between code at different privilege levels: so for example, content code can't access objects created by chrome code, but chrome code can access objects created by content. However, even the ability to access content objects can be a security risk for chrome code. JavaScript's a highly malleable language. Scripts running in web pages can add extra properties to DOM objects (also known as expando properties) and even redefine standard DOM objects to do something unexpected. If chrome code relies on such modified objects, it can be tricked into doing things it shouldn't. For example: window.confirm() is a DOM API that's supposed to ask the user to confirm an action, and return a boolean depending on whether they clicked "OK" or "Cancel". A web page ...
...s result to represent user confirmation would be deceived. This would be very naive, of course, but there are more subtle ways in which accessing content objects from chrome can cause security problems. This is the problem that Xray vision is designed to solve. When a script accesses an object using Xray vision it sees only the native version of the object. Any expandos are invisible, and if any properties of the object have been redefined, it sees the original implementation, not the redefined version. So in the example above, chrome code calling the content's window.confirm() would get the original version of confirm(), not the redefined version. It's worth emphasizing that even if content tricks chrome into running some unexpected code, that code does not run with chrome privileges. So this...
...to illustrate how Xray vision works. Waiving Xray vision Xray vision is a kind of security heuristic, designed to make most common operations on untrusted objects simple and safe. However, there are some operations for which they are too restrictive: for example, if you need to see expandos on DOM objects. In cases like this you can waive Xray protection, but then you can no longer rely on any properties or functions being, or doing, what you expect. Any of them, even setters and getters, could have been redefined by untrusted code. To waive Xray vision for an object you can use Components.utils.waiveXrays(object), or use the object's wrappedJSObject property: // chrome code var waivedWindow = Components.utils.waiveXrays(gBrowser.contentWindow); var transfer = waivedWindow.confirm("Transfer a...
...And 7 more matches
Debugger.Frame - Firefox Developer Tools
ch the execution is taking place, and so on. For a given Debugger instance, SpiderMonkey creates only one Debugger.Frame instance for a given visible frame. Every handler method called while the debuggee is running in a given frame is given the same frame object. Similarly, walking the stack back to a previously accessed frame yields the same frame object as before. ...
...me frame object as before. Debugger code can add its own properties to a frame object and expect to find them later, use == to decide whether two expressions refer to the same frame, and so on. (If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Frame instance for a given frame. ...
...Note that frames only become inactive at times that are predictable for the debugger: when the debuggee runs, or when the debugger removes frames from the stack itself. ...
...And 7 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. ...
...ty 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. 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 t...
...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-width. <line-style> Sets the style of the border. Defaults to none if absent. See border-style. <color> Sets the color of the border. Defaults to currentcolor if absent. See border-color. Description As with all shorthand properties, any omitted sub-values will be set to their initial value. Importantly, border cannot be used to specify a custom value for border-image, but instead sets it to its initial value, i.e., none. The border shorthand is especially useful when you want all four borders to be the same. To make them different from each other, however, you can use the longhand border-width, border-style, and border-col...
...And 7 more matches
font - CSS: Cascading Style Sheets
Web › CSS › font
The font CSS shorthand 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. ...
...://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-style font-variant font-weight 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,...
...h font-style font-variant font-weight 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. ...
...And 7 more matches
Inheritance and the prototype chain - JavaScript
bjects in JavaScript are instances of Object which sits on the top of a prototype chain. While this confusion is often considered to be one of JavaScript's weaknesses, the prototypal inheritance model itself is, in fact, more powerful than the classic model. It is, for example, fairly trivial to build a classic model on top of a prototypal model. Inheritance with the prototype chain Inheriting properties JavaScript objects are dynamic "bags" of properties (referred to as own properties). JavaScript objects have a link to a prototype object. When trying to access a property of an object, the property will not only be sought on the object but on the prototype of the object, the prototype of the prototype, and so on until either a property with a matching name is found or the end of the prototype c...
...t should not be confused with the func.prototype property of functions, which instead specifies the [[Prototype]] to be assigned to all instances of objects created by the given function when used as a constructor. The Object.prototype property represents the Object prototype object. Here is what happens when trying to access a property: // Let's create an object o from function f with its own properties a and b: let f = function () { this.a = 1; this.b = 2; } let o = new f(); // {a: 1, b: 2} // add properties in f function's prototype f.prototype.b = 3; f.prototype.c = 4; // do not set the prototype f.prototype = {b:3,c:4}; this will break the prototype chain // o.[[Prototype]] has properties b and c. // o.[[Prototype]].[[Prototype]] is Object.prototype. // Finally, o.[[Prototype]].[[Pro...
... 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 is called, 'this' refers to p. // So when p inherits the function m of o, // 'this.a' means p.a, the property 'a' of p Using prototypes in JavaScript Let's look at what happens behind the scenes in a bit more detail. In JavaScript, as mentioned above, functions are able to have properties. All functions have a special property named prototype. Please note that the code below is free-standing (it is safe to assume there is no other JavaScript on the webpage other than the below code). For the best learning experience, it is highly recommended that you open a console, navigate to the "console" tab, copy-and-paste in the below JavaScript code, and run it by pressing the Enter/Return ...
...And 7 more matches
Array - JavaScript
ular use, you might consider using typed arrays. Arrays cannot use strings as element indexes (as in an associative array) but must use integers. Setting or accessing via non-integers using bracket notation (or dot notation) will not set or retrieve an element from the array list itself, but will set or access a variable associated with that array's object property collection. The array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. Common operations Create an Array let fruits = ['Apple', 'Banana'] console.log(fruits.length) // 2 Access an Array item using the index position let first = fruits[0] // Apple let last = fruits[fruits.length - 1] // Banana Loop over an Array fruits.for...
...operty minus 1. Using an invalid index number returns undefined. ...
... For example, if you had an object with a property named 3d, it can only be referenced using bracket notation. ...
...And 7 more matches
Object.assign() - JavaScript
The Object.assign() method copies all enumerable own properties from one or more source objects to a target object. It returns the target 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.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. ...
... 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. Therefore it assigns properties, versus copying o...
...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. Therefore it assigns properties, versus copying or defining new properties. This may make it unsuitable for merging new properties into a prototype if the merge sources contain getters. For copying property definitions (including their enumerability) into prototypes, use Object.getOwnPropertyDescriptor() and Object.defineProperty() instead. Both String and Symbol properties are copied. In case of an error, for example if a property is non-writable, a TypeError is rai...
...And 7 more matches
Object.freeze() - JavaScript
In addition, freezing an object also prevents 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. ...
...In addition, freezing an object also prevents 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. ...
...In addition, freezing an object also prevents 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. ...
...And 7 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
, SVG Event attributes always have their name starting with "on" followed by the name of the event for which they are intended. They specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. 17 SVG Presentation Attributes Attribute, Beginner, Draft, Reference, SVG SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. 18 SVG Styling Attributes Attribute, Beginner, NeedsExample, Reference, SVG The SVG styling attributes are all the attributes that can be specified on any SVG element to apply CSS styling effects. 19 accent-height Deprecated, NeedsExample, SVG, SVG Attribute The accent-height attribute defines the distance f...
...ers, SVG, SVG Attribute The diffuseConstant attribute represents the kd value in the Phong lighting model. In SVG, this can be any non-negative number. 58 direction SVG, SVG Attribute The direction attribute specifies the inline-base direction of a <text> or <tspan> element. It defines the start and end points of a line of text as used by the text-anchor and inline-size properties. It also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. 59 display SVG, SVG Attribute The display attribute lets you control the rendering of graphical or container elements. 60 divisor Filters, SVG, SVG Attribute The divisor attribute specifies the value by which the resu...
...bute mainly used to bind a given <mask> element with the element the attribute belongs to. 135 maskContentUnits SVG, SVG Attribute The maskContentUnits attribute indicates which coordinate system to use for the contents of the <mask> element. 136 maskUnits SVG, SVG Attribute The maskUnits attribute indicates which coordinate system to use for the geometry properties of the <mask> element. 137 mathematical Deprecated, SVG, SVG Attribute The mathematical attribute indicates the alignment coordinate for glyphs to achieve mathematical baseline alignment for horizontally oriented glyph layouts. 138 max SVG, SVG Attribute The max attribute specifies the maximum value of the active animation duration. 139 media ...
...And 7 more matches
JavaScript Daemons Management - Archive of obsolete content
.onstop = fInit; fInit.call(oOwner, this.INDEX, this.length, this.BACKW); } } /* Create the Daemon.blank() constructor and the global Daemon.context object */ Daemon.blank = function () {}; Daemon.context = Daemon.blank.prototype; /* Make love with the GC :-) */ Daemon.blank.prototype = /* Important! ...
...ototype; Daemon.context.constructor = Object; /* These properties can be manually reconfigured after the creation of the daemon */ Daemon.prototype.owner = Daemon.context; Daemon.prototype.task = null; Daemon.prototype.rate = 100; Daemon.prototype.length = Infinity; Daemon.prototype.reversals = 0; Daemon.prototype.onstart = null; Daemon.prototype.onstop = null; /* These properties should be read-only after the creation of the daemon */ Daemon.prototype.SESSION = -1; Daemon.prototype.INDEX = 0; Daemon.prototype.PAUSED = true; Daemon.prototype.BACKW = true; /* SYSTEM REQUIRED Daemon global object methods */ Daemon.forceCall = function (oDmn) { oDmn.INDEX += oDmn.BACKW ? -1 : 1; var bBreak = oDmn.task.call(oDmn.owner, oDmn.INDEX, oDmn.length, oDm...
...tion which will be synchronously invoked whenever the start event occurs. It will be assigned to the onstart property. It will be called with three arguments: index (the iterative index of each invocation), length (the number of total invocations assigned to the daemon - finite or Infinity), and backwards (a boolean expressing whether the process is going backwards or not). Daemon global object properties Daemon.context An empty object used as the default this object when the thisObject is not specified during the construction of the daemon. If you want your callback function to be invoked with a null this object, you have to manually set the owner property to null. Daemon global object methods Daemon.forceCall(daemonInstance) Forces a callback to the daemonInstance.task function regardl...
...And 6 more matches
Custom XUL Elements with XBL - Archive of obsolete content
d by the binding. Taken from the XBL page. This somewhat cryptic explanation describes a very simple concept: with XBL you can create your own custom elements. XBL is heavily used in XUL, but in theory it could be applied to any XML language. XBL was submitted to the W3C for standardization, but for now it's used in XUL almost exclusively. With XBL you can define new elements and define their properties, attributes, methods and event handlers. Many complex elements such as tabs, buttons and input controls are implemented using XBL and simpler XUL elements. As explained earlier, XUL is really just boxes, text and images. We'll look into XBL using a modified version of the Hello World extension. Download the Hello World XBL project, build it and test it for a while. You should see a new item in t...
..." />, 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 calling the remove method, which we will discuss later on. If you need to create a container element, or any other element that has child nodes, you can use the XBL children tag in your content to indicate the place where the child nodes will be inserted. The includes attribute gives you a little more flexibility with children, but it's rarely needed. One important thing to...
...s="value=name" /> And then, in order to get a reference to the node from the JS code in your binding, we use the getAnonymousElementByAttribute DOM method: let nameLabel = document.getAnonymousElementByAttribute( this, "anonid", "xulshoolhello-name-label"); Implementation The implementation section defines most of the scripting side of your element. Here you can define methods and properties, as well as a constructor and a destructor for your element. JavaScript code is enclosed in CDATA sections to prevent JS and XML syntax conflicts. Properties and Fields The field and property tags allow you to handle element variables and access them from outside of the element. A field holds a value that can be changed, except when the readonly attribute is set. It's very similar to a JS obje...
...And 6 more matches
Adding a new CSS property
stem 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. 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. If you need more details on any of the points mentioned here, a good place to find them is by looking at other changes in the version control history of the files mentioned. Getting started First, you'll want to add an appropriate test entry to property_database.js. See the documentation at the top of the file and the other entries for exa...
...f 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. ...
...n 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. ...
...And 6 more matches
Localization and Plurals
This page is to help explain how to localize these strings so that the correct plural form is shown to the user. For example, "1 page" vs "2 pages". If you're here to make your code (e.g., extensions) localizable for plural forms, you can jump straight to Developing with PluralForm. You may also need to localize the initial strings for your code, so it would be good to read through at least the Usage section as well. Usage Here are a couple terms used in this page to help keep things clear: plural rule: For a given language, there is a grammatical rule on how to change words, depending on the number qualifying the word. ...
...language, there is a grammatical rule on how to change words, depending on the number qualifying the word. Different languages can have different rules. plural form: For a particular plural rule, there can be multiple forms of a word, such as "page" and "pages". In this case, there are 2 forms, but other languages can have 1 or many more. If you're here for pluralRule in the chrome/global/intl.properties file, you'll need to figure out what plural rule to choose for your localization. This plural rule is used to determine how many plural forms are needed for each word that needs to be localized, with plurals in mind. For all other properties files that link to this page, you'll need to provide enough plural forms of the desired word, and separate them with semi-colons (;). If you don't know how ...
... List of Plural Rules This section contains a list of plural rules ordered by their plural rule number. ...
...And 6 more matches
Localizing with Koala
ist that appears when you click on the arrow pointing down situated next to the sidebar's [x] button). You should now see the results of the comparison in the "Koala file view" sidebar. Translating files Let's translate the searchbar-related strings mentioned in the beginning of this document. They can be found in two files, inside the browser/chrome/browser directory: searchbar.dtd, search.properties. The difference between DTD and .properties files in the moment when they are used by the application. DTD's files are read by the XML parser, which goes through the XUL files used in Mozilla to create the interface when it launches. The .properties files are used in the JavaScript code while the application is already running. That's why the string "Add %s..." (where %s is replaced by the searc...
...It has to be generated every time the user switches between pages. On the other hand, "Manage Search Engines..." is generated only once, on start-up, and doesn't need to change. ...
... Note how Koala is smart enough to insert this entity before searchEndCap.label. This is helpful for keeping the localization files clean and tidy at all times. The string to translated is selected so that you can translate it without any further clicking. When you are done with translating the cmd_engineManager.label entity, save the file. Now 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 t...
...And 6 more matches
JIT Optimization Strategies
replacing it with a constant reference to the object. When this optimization is successful, property access is eliminated entirely and replaced with an inline constant. The different success and failure conditions are documented below: GetProp_StaticName Attempts to optimize a property access on window which refers to a property on the global object. GetProp_TypedObject Optimizes accesses to properties on TypedObjects. GetProp_DefiniteSlot Optimizes access to a well-known regular property on an object. For this optimization to succeed, the property needs to be well-defined on the object. For objects constructed by constructor functions, this means that the property needs to be defined in the constructor, before any complex logic occurs within the constructor. This is the best case for a regu...
...e best case for a regular "field" type property that is not turned into a constant. It compiles down to a single CPU-level load instruction. function SomeConstructor() { this.x = 10; // x is a definite slot property this.y = 10; // y is a definite slot property someComplicatedFunctionCall(); this.z = 20; // z is not a definite slot property. } In the above example, the properties x and y can always be determined to exist on any instance of SomeConstructor at definite locations, allowing the engine to infer deterministically the position of x without a shape guard. This optimization can fail for a number of reasons. If the types observed at the property access are polymorphic (more than one type), this optimization cannot succeed. Furthermore, even if the object type is m...
...tion can fail for a number of reasons. If the types observed at the property access are polymorphic (more than one type), this optimization cannot succeed. Furthermore, even if the object type is monomorphic, the optimization will fail if the property being accessed is not a definite slot as described above. GetProp_Unboxed Similar to GetProp_DefiniteSlot. ...
...And 6 more matches
USBDevice - Web APIs
Web › API › USBDevice
USBDevice.configurations Read only An array of device-specific interfaces for controlling a paired USB device. USBDevice.deviceClass Read only One of three properties that identify USB devices for the purpose of loading a USB driver that will work with that device. The other two properties are USBDevice.deviceSubclass and USBDevice.deviceprotocol. ...
...e WebUSB API provides access to metadata about a paired USB device and methods for controlling it. Properties USBDevice.configuration Read only A USBConfiguration object for the currently selected interface for a paired USB device. USBDevice.configurations Read only An array of device-specific interfaces for controlling a paired USB device. ...
...configuration Read only A USBConfiguration object for the currently selected interface for a paired USB device. USBDevice.configurations Read only An array of device-specific interfaces for controlling a paired USB device. USBDevice.deviceClass Read only One of three properties that identify USB devices for the purpose of loading a USB driver that will work with that device. The other two properties are USBDevice.deviceSubclass and USBDevice.deviceprotocol. ...
...And 6 more matches
Box-shadow generator - CSS: Cascading Style Sheets
> <div class="block info"> <div class="input" data-topic="a" data-title='alpha:' data-action="alpha"></div> <div class="input" data-topic="hexa" data-title='' data-action="hexa"></div> </div> </div> </div> </div> <div class="wrap-right"> <div id="shadow_properties" class="category"> <div class="title"> Shadow properties </div> <div class="group"> <div class="group property"> <div class="ui-slider-name"> inset </div> <div class="ui-checkbox" data-topic='inset'></div> </div> <div class="slidergroup"> ...
... 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"> Class element properties </div> <div class="group"> <div class="group property"> <div class="ui-slider-name"> border </div> <div class="ui-checkbox" data-topic='border-state' data-state="true"></div> </div> <div id="z-in...
...function() { shadow.copy(store); updateShadowCSS(id); setTimeout(function() { active.node.style.removeProperty("transition"); animate = false; }, 100); }, 200); } var updateActivePos = function updateActivePos(deltaX, deltaY) { if (active.shadowID === null) active.updatePos(deltaX, deltaY); else updateShadowPos(deltaX, deltaY); } /* * Shadow properties */ var updateShadowCSS = function updateShadowCSS(id) { active.render[id] = active.shadows[id].computeCSS(); active.updateShadows(); } var toggleShadowInset = function toggleShadowInset(value) { if (active.shadowID === null) return; active.shadows[active.shadowID].toggleInset(value); updateShadowCSS(active.shadowID); } var updateShadowPos = function updateShadowP...
...And 6 more matches
border-block-start - CSS: Cascading Style Sheets
er-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. ...
... 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. 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 elem...
...alues 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 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. See border-style. <'color'> The color of the border. See color. Formal defi...
...And 6 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ways to add color to your HTML elements to create just the look you want. This article is a primer introducing each of the ways CSS color can be used in HTML. Fortunately, adding color to your HTML is actually really easy to do, and you can add color to nearly anything. We're going to touch on most of what you'll need to know when using color, including a list of what you can color and what CSS properties are involved, how you describe colors, and how to actually use colors both in stylesheets and in scripts. We'll also take a look at how to let the user pick a color. Then we'll wrap things up with a brief discussion of how to use color wisely: how to select appropriate colors, keeping in mind the needs of people with differing visual capabilities. Things that can have color At the element leve...
...w to use color wisely: how to select appropriate colors, keeping in mind the needs of people with differing visual capabilities. Things that can have color At the element level, everything in HTML can have color applied to it. Instead, let's look at things in terms of the kinds of things that are drawn in the elements, such as text and borders and so forth. For each, we'll see a list of the CSS properties that apply color to them. At a fundamental level, the color property defines the foreground color of an HTML element's content and the background-color property defines the element's background color. These can be used on just about any element. Text Whenever an element is rendered, these properties are used to determine the color of the text, its background, and any decorations on the text. ...
... referred to as the text input cursor) within the element. This is only useful in elements that are editable, such as <input> and <textarea> or elements whose HTML contenteditable attribute is set. Boxes Every element is a box with some sort of content, and has a background and a border in addition to whatever contents the box may have. Borders See the section Borders for a list of the CSS properties you can use to set the colors of a box's borders. background-color The background color to use in areas of the element that have no foreground content. column-rule-color The color to use when drawing the line separating columns of text. outline-color The color to use when drawing an outline around the outside of the element. This outline is different from the border in that it doesn't get s...
...And 6 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. ...
...ractive 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. replacer Optional A function that alters the behavior of the stringification process, or an array of String and Number that serve as an allowlist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string. space Optional A String or Number object that's used to insert white space into the output JSON string for readability purposes. If this is a Number, it indicates the number of space characters to use as white space; this number i...
...h the traditional conversion semantics. undefined, Functions, and Symbols are not valid JSON values. If any such values are encountered during conversion they are either omitted (when found in an object) or changed to null (when found in an array). JSON.stringify() can return undefined when passing in "pure" values like JSON.stringify(function(){}) or JSON.stringify(undefined). All Symbol-keyed properties will be completely ignored, even when using the replacer function. The instances of Date implement the toJSON() function by returning a string (the same as date.toISOString()). Thus, they are treated as strings. The numbers Infinity and NaN, as well as the value null, are all considered null. All the other Object instances (including Map, Set, WeakMap, and WeakSet) will have only their enumera...
...And 6 more matches
Object - JavaScript
The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax. Description Nearly all objects in JavaScript are instances of Object; a typical object inherits properties (including methods) from Object.prototype, although these properties may be shadowed (a.k.a. overridden). ...
...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. ...
...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. ...
...And 6 more matches
TypedArray - JavaScript
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
...e-examples and send us a pull request. Description ECMAScript 2015 defines a TypedArray constructor that serves as the [[Prototype]] of all TypedArray constructors. This constructor is not directly exposed: there is no global %TypedArray% or TypedArray property. It is only directly accessible through Object.getPrototypeOf(Int8Array) and similar. All TypedArrays constructors inherit common properties from the %TypedArray% constructor function. Additionally, all typed array prototypes (TypedArray.prototype) have %TypedArray%.prototype as their [[Prototype]]. The %TypedArray% constructor on its own is not particularly useful. Calling it or using it in a new expression will throw a TypeError, except when used during object creation in JS engines that support subclassing. There are at present...
...And 6 more matches
Object initializer - JavaScript
tax 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 = '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 nam...
...tion cannot be a shorthand. In JSON the values can only be strings, numbers, arrays, true, false, null, or another (JSON) object. A function value (see "Methods" above) can not be assigned to a value in JSON. Objects like Date will be a string after JSON.parse(). JSON.parse() will reject computed property names and an error will be thrown. Examples Creating objects An empty object with no properties can be created like this: let object = {} However, the advantage of the literal or initializer notation is, that you are able to quickly create objects with properties inside the curly braces. You simply notate a list of key: value pairs delimited by commas. The following code creates an object with three properties and the keys are "foo", "age" and "baz". The values of these keys are a string...
...ou are able to quickly create objects with properties inside the curly braces. You simply notate a list of key: value pairs delimited by commas. The following code creates an object with three properties and the keys are "foo", "age" and "baz". The values of these keys are a string "bar", the number 42, and another object. let object = { foo: 'bar', age: 42, baz: {myProp: 12} } Accessing properties Once you have created an object, you might want to read or change them. Object properties can be accessed by using the dot notation or the bracket notation. (See property accessors for detailed information.) object.foo // "bar" object['age'] // 42 object.foo = 'baz' Property definitions We have already learned how to notate properties using the initializer syntax. Oftentimes, there are vari...
...And 6 more matches
for...in - JavaScript
The for...in statement iterates over all enumerable properties of an object that are keyed by strings (ignoring ones keyed by Symbols), including inherited enumerable properties. The source for this interactive example is stored in a GitHub repository. If you'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 in object) statement variable A different property name is assigned to variable on each iteration. object Object whose non-Symbol enumerable properties are iterated over. Description A for...in loop only iterates over enumerable, non-Symbol properties. ...
...s a pull request. Syntax for (variable in object) statement variable A different property name is assigned to variable on each iteration. object Object whose non-Symbol enumerable properties are iterated over. Description A for...in loop only iterates over enumerable, non-Symbol properties. Objects created from built-in constructors like Array and Object have inherited non-enumerable properties from Object.prototype and String.prototype, such as String's indexOf() method or Object's toString() method. The loop will iterate over all enumerable properties of the object itself and those the object inherits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes further away from the object in its prototype chain). Deleted, added, or modified prop...
...e, such as String's indexOf() method or Object's toString() method. The loop will iterate over all enumerable properties of the object itself and those the object inherits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes 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 a...
...And 6 more matches
Dehydra Object Reference - Archive of obsolete content
Introduction Dehydra represents C++ types and variables as JavaScript objects. The objects are designed to distill that type system to the minimum such that it can be easy to match on. Often, the best way to become familiar with the Dehydra objects is to print out the objects: Dehydra example code an online tool for pretty-printing dehydra data Understanding Properties Dehydra only sets properties that are applicable. ...
... .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. ...
....loc. Dehydra only sets boolean flags 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. ...
...And 5 more matches
Browser Feature Detection - Archive of obsolete content
An experimental approach to discovering degree of support for Standards. Among the methods of browser detection, many people recommend using the existence of specific properties or methods in a browser's DOM to detect the browser type and whether it supports a given operation. This test takes that idea to the extreme and tests a large number of properties and methods to determine the level of support a browser has for particular standards and reports a rating as the percentage of names the browser defines. This article has generally never been more than a way to show off Firefox Web compatibility, rather than something truly informative in a broader sense. Therefore, given that it's also badly out of date, it's been archived. You should not rely on any information here. Browser Sniff...
... 100% 100% 100% 75% / 91% 75% / 75% DOM Core 2 100% 100% 100% 70% / 94% 58% / 58% DOM 1 HTML 100% 100% 100% 100% / 100% 100% / 100% DOM CSS 1 100% 100% 100% 100% / 100% 96% / 96% DOM CSS 2 100% 98% 67% 71% / 83% 38% / 42% Test Results Cross Reference DOM Core Level 1 Support for properties/methods in document name Firefox 1.5 IE 6 & 7 Opera 8.54 - 9.01 Document.doctype true true true Document.implementation true true true Document.documentElement true true true Document.createElement() true true true Document.createDocumentFragment() true true true Document.createTe...
...ion() true false true Document.createProcessingInstruction() true false true Document.createAttribute() true true true Document.createEntityReference()Obsolete since Gecko 7 (method present but only returns null: bug 9850) false false Document.getElementsByTagName() true true true DOM Core Level 2 Support for properties/methods in document name Firefox 1.5 IE 6 & 7 Opera 8.54 - 9.01 Document.doctype true true true Document.implementation true true true Document.documentElement true true true Document.createElement() true true true Document.createDocumentFragment() true true true Document.createTe...
...And 5 more matches
WAI-ARIA basics - Learn web development
- 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, aria-required="true" specifies that a form input needs to be filled in to be valid, whereas aria-labelledby="label" allows you to put an ID on an element, then reference it as being the label for anything else on the page, including multiple elements, which is not possible using <labe...
...put">. As an example, you could use aria-labelledby to specify that a key description contained in a <div> is the label for multiple table cells, or you could use it as an alternative to image alt text -- specify existing information on the page as an image's alt text, rather than having to repeat it inside the alt attribute. You can see an example of this at Text alternatives. States -- Special properties that define the current conditions of elements, such as aria-disabled="true", which specifies to a screenreader that a form input is currently disabled. States differ from properties in that properties don't change throughout the lifecycle of an app, whereas states can change, generally programmatically via JavaScript. An important point about WAI-ARIA attributes is that they don't affect anyth...
...ser's accessibility APIs (where screenreaders get their information from). WAI-ARIA doesn't affect webpage structure, the DOM, etc., although the attributes can be useful for selecting elements by CSS. Note: You can find a useful list of all the ARIA roles and their uses, with links to futher information, in the WAI-ARIA spec -- see Definition of Roles. The spec also contains a list of all the properties and states, with links to further information -- see Definitions of States and Properties (all aria-* attributes). Where is WAI-ARIA supported? This is not an easy question to answer. It is difficult to find a conclusive resource that states what features of WAI-ARIA are supported, and where, because: There are a lot of features in the WAI-ARIA spec. There are many combinations of operatin...
...And 5 more matches
Debugging CSS - Learn web development
ent rendering between 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 ...
... the applied CSS 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 ...
...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 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...
...And 5 more matches
Introduction to events - Learn web development
g about other such environments at this stage in your learning; we just wanted to make it clear that events can differ in different programming environments. Ways of using web events There are a number of ways to add event listener code to web pages so it runs when the associated event fires. In this section, we review the various mechanisms and discuss which ones you should use. Event handler properties These are the properties that exist to contain event handler code we have seen most frequently during the course. Returning to the above example: const btn = document.querySelector('button'); btn.onclick = function() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundColor = rndCol; } The onclick property is the event handler...
...andler property to be equal to a named function name (like we saw in Build your own function). The following works just the same: const btn = document.querySelector('button'); function bgChange() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(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 a...
...rally 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 handler properties; however, you shouldn't use these -- they are considered bad practice. It might seem easy to use an event handler attribute if you are doing something really quick, but they quickly become unmanageable and inefficient. For a start, it is not a good idea to mix up your HTML and your JavaScript, as it becomes hard to parse -- keeping your JavaScript separate is best practice; if it is in a separat...
...And 5 more matches
JavaScript object basics - Learn web development
e First steps and Building blocks). Objective: To understand the basic theory behind object-oriented programming, how this relates to JavaScript ("most things are objects"), and how to start working with JavaScript objects. Object basics An object is a collection of related data and/or functionality (which usually consists of several variables and functions -- which are called properties and methods when they are inside objects.) Let's work through an example to understand what they look like. To begin with, make a local copy of our oojs.html file. This contains very little -- a <script> element for us to write our source code into. We'll use this as a basis for exploring basic object syntax. While working with this example you should have your developer tools JavaScript console...
... case are separated by a colon. The syntax always follows this pattern: const objectName = { member1Name: member1Value, member2Name: member2Value, member3Name: member3Value }; The value of an object member can be pretty much anything -- in our person object we've got a string, a number, two arrays, and two functions. The first four items are data items, and are referred to as the object's properties. The last two items are functions that allow the object to do something with that data, and are referred to as the object's methods. An object like this is referred to as an object literal -- we've literally written out the object contents as we've come to create it. This is in contrast to objects instantiated from classes, which we'll look at later on. It is very common to create an object usi...
...ct literal when you want to transfer a series of structured, related data items in some manner, for example sending a request to the server to be put into a database. Sending a single object is much more efficient than sending several items individually, and it is easier to work with than an array, when you want to identify individual items by name. Dot notation Above, you accessed the object's properties and methods using dot notation. The object 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-names...
...And 5 more matches
Eclipse CDT
y bother using Eclipse) you're going to have to set Eclipse's "Build" step to do a very slow, non-parallel, full rebuild. (See the "Code assistance" section above for why.) Nevertheless, if you understand the above warning and you still want to configure Eclipse's "Build" button to invoke a real build, then read on. ...
...Select the Behavior tab and remove the "all" from the "Build (Incremental build)" field. ...
... to just "${ProjDirPath}" (this is the top of the source tree). Select the Behavior tab and remove the "all" from the "Build (Incremental build)" field. Select "C/C++ Build > Build Variables", and add a variable "MOZCONFIG", and set it to the path of your .mozconfig file relative to the top source directory. Set any other environment variables you want to set for the build, then close the project properties window. Now when you hit the Build button (the little hammer icon), you should see the source build in the Console tab at the bottom of the window. The benefit of building from inside Eclipse is that build errors will appear in the Problems tab at the bottom of the window, and from there you can double click on the build error and it will take you straight to the source file and line where the ...
...And 5 more matches
JavaScript-DOM Prototypes in Mozilla
rapper is exposed to JavaScript as the JavaScript representation of the DOM node. When XPConnect wraps a C++ object it will create a JSObject that is unique to this C++ object. In the case where the C++ object has class info (nsIClassInfo), the JSObject is a more or less empty JSObject which is not really that special. ...
...cript representation of the DOM node. When XPConnect wraps a C++ object it will create a JSObject that is unique to this C++ object. In the case where the C++ object has class info (nsIClassInfo), the JSObject is a more or less empty JSObject which is not really that special. ...
... are actually not properties of the object itself, but rather properties of the prototype of the JSObject for the wrapper (unless the C++ object's class info has the flag nsIXPCScriptable::DONT_SHARE_PROTOTYPE set, but lets assume that's not the case here). As an example of this let's look at an HTML image element in a document. var obj = document.images[0]; Here, obj will not really have any properties (except for the standard JSObject properties such as constructor, and the non-standard __parent__, __proto__, etc.), all the DOM functionality of obj comes from obj's prototype (obj.__proto__) that XPConnect sets up when exposing the first image in document to JavaScript. ...
...And 5 more matches
Property cache
SpiderMonkey's property cache is an internal data structure used to speed up property accesses in the interpreter and to communicate between the interpreter and JIT. Warning: The details below are obsolete. Shape integers do not exist anymore. The property cache still exists, but it is simpler now. SpiderMonkey mainly uses type inference to determine which properties are being accessed; in cases where type inference does not find the exact shape of the object being accessed, SpiderMonkey uses a PIC (polymorphic inline caches) to store the result of the lookup. The property cache is only used in the interpreter. The property cache was introduced in bug 365851. Basics In general, accessing a property of a native object entails: a property lookup; examining the Shape to see how the property ...
...L}PROP, and LENGTH; NAME; SETPROP, BINDNAME, and SETNAME; CALLPROP and CALLNAME; and {INC,DEC}NAME and NAME{INC,DEC}. ELEM opcodes do not use it. Nor do {INC,DEC}PROP or PROP{INC,DEC}. Nor do operations such as ADD that only need to look up a property (.toString) in unusual cases. Throughout this article, phrases such as "own property" should be taken to refer to the low-level representation of properties in scopes and Shape chains. In the case of SHARED PERMANENT properties, this differs from the notion of "own property" seen by scripts via Object.prototype.hasOwnProperty. Shape Native objects have a shape, a 24-bit unsigned integer such that: Basic layout guarantee -- If at time t0 the object x has shape s and at time t1 the object y has shape s, and no shape-regenerating GC occurred, th...
...bject.prototype.hasOwnProperty. Shape Native objects have a shape, a 24-bit unsigned integer such that: Basic layout guarantee -- If at time t0 the object x has shape s and at time t1 the object y has shape s, and no shape-regenerating GC occurred, then y at t1 has the same JSClass, JSObjectOps, prototype, and property specs as x had at t0. To be more precise regarding property specs, y's properties have the same names, getters, setters, property attributes, and slot offsets, and they are in the same order, as x's properties at t0. Furthermore, y at t1 has the same number of fixed slots that x had at t0, and either both have a slot array or neither does. (Informally: objects with the same shape have the same prototype, class, and layout.) Prototype chain shadowing guarantee -- If at t0...
...And 5 more matches
Address Book examples
This function will return the first match that it finds in the collection or null. let collection = ... let card = collection.getCardFromProperty("JobTitle", "software engineer", false); If you are searching for a card with a particular email address, you can use the cardForEmailAddress function that will match against multiple email addresses...
...ry).childCards; // ... use searchResult as required. } } Note: This method doesn't work with remote address books (e.g. LDAP). Hence the additional !ab.isRemote check How do I add/edit/delete contacts? Note: Not all address books can be written to. ...
...s book via its nsIAbDirectory interface: let newCard = addressbook.addCard(card); The addCard function returns a new nsIAbCard object that may have had nsIAbDirectory specific data added to it, e.g. database specific information, that is used on edits. Editing Contacts Once you have obtained a card from an nsIAbDirectory (see above), you can edit it in a two step process, firstly, change the properties that you to edit: card.setProperty("FirstName", "Jane"); card.setProperty("LastName", "Doe"); Secondly, call modifyCard to save the card in the database. addressbook.modifyCard(card); Deleting Contacts Once you have obtained a card(s) from an nsIAbDirectory (see above) you can delete one or more simply by calling the deleteCards function: let cardsToDelete = Components.classes["@mozilla.o...
...And 5 more matches
Accessibility Inspector - Firefox Developer Tools
en you aren't specifically using it. When first implemented, the accessibility engine had to be explicitly turned on. Starting in Firefox 79, it is automatically enabled when you do one of the following: Choose Accessibility in the Tools > Web Developer menu. Select the Accessibility tab in the Developer Tools toolbox. Right-click in the main browser window, and choose Inspect Accessibility Properties in the context menu. Right-click an item in the HTML pane of the Page Inspector, and choose Show Accessibility Properties in the context menu. Once activated, the accessibility engine remains running until you close the Developer Tools toolbox. If you don't wish to allow the accessibility features to be automatically enabled, you can use the Configuration Editor (also known as about:config) t...
...ating the Accessibility Inspector do nothing. Features of the Accessibility panel The enabled accessibility panel looks like so: On the left-hand side, there is a tree diagram representing all the items in the accessibility tree for the current page. Items with nested children have arrows that can be clicked to reveal the children, so you can move deeper into the hierarchy. Each item has two properties listed: Role -- the role this item has on the page (e.g., pushbutton, or footer). This can be either a default role provided by the browser, or a role given to it via a WAI-ARIA role attribute. Name -- the name this item has on the page. The name depends on the element; for example, the name of most text elements is simply their textContent, whereas form elements' names are the contents of th...
... by the browser, or a role given to it via a WAI-ARIA role attribute. Name -- the name this item has on the page. The name depends on the element; for example, the name of most text elements is simply their textContent, whereas form elements' names are the contents of their associated <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: ...
...And 5 more matches
Debugger.Memory - Firefox Developer Tools
It can mark each new object with the JavaScript call stack at which it was allocated. It can log all object allocations, yielding a stream of JavaScript call stacks at which allocations have occurred. It can compute a census of items belonging to the debuggee, categorizing items in various ways, and yielding item counts. Ifdbg is a Debugger instance, then the methods and accessor properties of dbg.memory control howdbg observes its debuggees' memory use. The dbg.memory object is an instance of Debugger.Memory; its inherited accesors and methods are described below. Allocation Site Tracking The JavaScript engine marks each new object with the call stack at which it was allocated, if: the object is allocated in the scope of a global object that is a debuggee of some Debugger i...
...imit on the log's size by setting dbg.memory.maxAllocationsLogLength. Censuses A census is a complete traversal of the graph of all reachable memory items belonging to a particular Debugger's debuggees. It produces a count of those items, broken down by various criteria. Ifdbg is a Debugger instance, you can call dbg.memory.takeCensus to conduct a census of its debuggees' possessions. Accessor Properties of the Debugger.Memory.prototype Object Ifdbg is a 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 g...
...d 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 handler functions for SpiderMonkey to call when given events occur in debuggee code. Unlike Debugger's hooks, Debugger.Memory's handlers' return values are not significant, and are ignored. The handler functions receive the Debugger.Memory's owning Debugger instance as their this value. The owning Debugger's uncaughtExceptionHandler is still fired for errors thrown in Debugger.Memory ...
...And 5 more matches
Debugger.Script - Firefox Developer Tools
tions that code defines. The contents of a <script> element. A DOM event handler, whether embedded in HTML or attached to the element by other JavaScript code. Code appearing in a javascript: URL. The Debugger interface constructs Debugger.Script objects as scripts of debuggee code are uncovered by the debugger: via the onNewScript handler method; via Debugger.Frame's script properties; via the functionScript method of Debugger.Object instances; and so on. For a given Debugger instance, SpiderMonkey constructs exactly one Debugger.Script instance for each underlying script object; debugger code can add its own properties to a script object and expect to find them later, use == to decide whether two expressions refer to the same script, and so on. (If more than one Debugger ins...
...erlying script object; debugger code can add its own properties to a script object and expect to find them later, use == to decide whether two expressions refer to the same script, and so on. (If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Script instance for a given script. This allows the code using each Debugger instance to place whatever properties it likes on its Debugger.Script instances, without worrying about interfering with other debuggers.) A Debugger.Script instance is a strong reference to a JSScript object; it protects the script it refers to from being garbage collected. Note that SpiderMonkey may use the same Debugger.Script instances for equivalent functions or evaluated code--that is, scripts representing the same source cod...
...ndScripts method on Debugger instances. SpiderMonkey constructs exactly one Debugger.Script for each underlying WebAssembly module per Debugger instance. A Debugger.Script instance is a strong reference to the underlying WebAssembly module; it protects the module it refers to from being garbage collected. Please note at the time of this writing, support for WebAssembly is very preliminary. Many properties and methods below throw. Convention For descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to a JSScript or to a block of WebAssembly code, the text will be split into two sections, headed by "if the instance refers to a JSScript" and "if the instance refers to WebAssembly code", respectively. If the behavior does not d...
...And 5 more matches
Migrating from Firebug - Firefox Developer Tools
bug extensions like FirePHP allow to log server-side messages to the Firebug console. This functionality is already integrated into the DevTools using the ChromeLogger protocol and doesn't require any extensions to be installed. Command history The command history available through a button in Firebug's command line, is available by pressing ?/? within the DevTools command line. Inspect object properties By clicking on an object logged within the console you can inspect the object's properties and methods within the DOM panel. In the Firefox DevTools you can also inspect the objects. The difference is that they show the properties and methods within a side panel inside the Web Console. Show network requests The Console panel in Firebug allows to log AJAX requests (aka XMLHttpRequests). This op...
...ode view in a similar way. Firebug has a Style side panel for this, the DevTools have a Rules side panel. In Firebug you add new rules by right-clicking and choosing Add Rule... from the context menu. The DevTools also have a context menu option for that named Add New Rule and additionally have a + button within the Rules panel's toolbar to create new rules. To edit element styles, i.e. the CSS properties of the 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 t...
...u toggle the CSS pseudo-classes :hover, :active and :focus for an element via the options menu of the Style side panel. In the DevTools there are two ways to do the same. The first one is to toggle them via the pseudo-class panel within the Rules side panel. The second one is to right-click and element within the node view and toggle the pseudo-classes via the context menu. ...
...And 5 more matches
Work with animations - Firefox Developer Tools
mation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is: blue if a transition was used to animate a property orange if a @keyframes animation was used green if the Web Animations API was used The bar contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating different CSS properties). The bar is shaped to reflect the easing effect used for the animation. In the example above you can see that the first bar is concave, representing ease-in, and the second is convex, representing ease-out. If the animation used CSS transitions, there is one bar for each property transitioned, and it is labeled with the name of the property being transitioned. If the animation used CSS @keyfra...
... left of each bar is a selector for the element that the animation applies to. If you hover over this selector, the element is highlighted in the page. Click the selector to select the element in the inspector. To the left of the selector is a "target" icon (). Clicking this icon locks the highlighter on the element. Animation details If you click one of the bars, 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. filter was given a value at 250ms and transform at 500ms. If y...
...ter: 'grayscale(0%)' } ]; Application to the example Applying all this to our example, we can see that: The animation involved 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. ...
...And 5 more matches
Applying styles and colors - Web APIs
e used only the default line and fill styles. Here we will explore the canvas options we have at our disposal to make our drawings a little more attractive. You will learn how to add different colors, line styles, gradients, patterns and shadows to your drawings. Colors Up until now we have only seen methods of the drawing context. If we want to apply colors to a shape, 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 s...
...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 shapes when setting their colors. Because the strokeStyle and fillStyle properties accept CSS rgba color values, we can use the following notation to assign a transparent color to them. // Assigning transparent colors to stroke and fill style ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)'; ctx.fillStyle = 'rgba(255, 0, 0, 0.5)'; The rgba() function is similar to the rgb() function but it has one extra parameter. The last parameter sets the transparency value of this particular co...
... lineWidth = value Sets the width of lines drawn in the future. lineCap = type Sets the appearance of the ends of lines. lineJoin = type Sets the appearance of the "corners" where lines meet. miterLimit = value Establishes a limit on the miter when two lines join at a sharp angle, to let you control how thick the junction becomes. getLineDash() Returns th...
...And 5 more matches
HTMLFormElement - Web APIs
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 o...
... 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 DO...
...OMString reflecting the value of the form's action HTML attribute, containing the URI of a program that processes the information submitted by the form. HTMLFormElement.encoding or HTMLFormElement.enctype A DOMString reflecting the value of the form's enctype HTML attribute, indicating the type of content that is used to transmit the form to the server. Only specified values can be set. The two properties are synonyms. HTMLFormElement.acceptCharset A DOMString reflecting the value of the form's accept-charset HTML attribute, representing the character encoding that the server accepts. HTMLFormElement.autocomplete A DOMString reflecting the value of the form's autocomplete HTML attribute, indicating whether the controls in this form can have their values automatically populated by the browser. ...
...And 5 more matches
Node - Web APIs
Web › API › Node
Node.baseURIRead only Returns a DOMString representing the base URL of the document containing the Node. Node.baseURIObject Read only (Not available to web content.) The nsIURI object representing the base URI for the element. Node.childNodesRead only Returns a live NodeList containing all th...
... Node.baseURIRead only Returns a DOMString representing the base URL of the document containing the Node. Node.baseURIObject Read only (Not available to web content.) The nsIURI object representing the base URI for the element. Node.childNodesRead only Returns a live NodeList containing all the children of this node. NodeLi...
...x="151" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties In addition to the properties below, Node inherits properties from its parent, EventTarget. Node.baseURIRead only Returns a DOMString representing the base URL of the document containing the Node. Node.baseURIObject Read only (Not available to web content.) The nsIURI object representing the base URI for the element. Node.childNodesRead only Returns a live NodeList containing all the children of this node. NodeList being live means that if the ...
...And 5 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
The cross axis The cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. If your main axis is column or column-reverse then the cross axis runs along the rows. Understanding which axis is which is important when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. Start and end lines Another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. In the past, CSS was heavily weighted towards horizontal and left-to-right writing modes. Modern layout methods encompass the range of writing modes and so we no longer assume that a line of text will start...
... 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 start from the start edge of the main axis. The items do not stretch on the main dimension, but can shrink. The items will stretch to fill the size of the cross axis. The...
...the initial value, and they will instead shrink to fit the container because they are using initial flexbox values that allows items to shrink. Using nowrap would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit. Find out more about wrapping flex items in the guide Mastering Wrapping of Flex Items. The flex-flow shorthand You can combine the two properties flex-direction and flex-wrap into the flex-flow shorthand. The first value specified is flex-direction and the second value is flex-wrap. In the live example below try changing the first value to one of the allowable values for flex-direction - row, row-reverse, column or column-reverse, and also change the second to wrap and nowrap. Properties applied to flex items To have more control over...
...And 5 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
browsers mean 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 In...
...his 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 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 propertie...
...he IE/Edge (<=15) version of the specification is prefixed with an -ms prefix and the properties implemented in IE/Edge (<=15) are as follows: grid-template-columns as -ms-grid-columns grid-template-rows as -ms-grid-rows grid-row-start as -ms-grid-row grid-column-start as -ms-grid-column align-self as -ms-grid-row-align justify-self as -ms-grid-column-align The IE version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span. This version does not include auto-placement capability, or grid template areas. Some simple grid layouts could be implemented for IE10, through to Edge 15, using the -ms properties. As these properties are vendor prefixed, they will not effect any browser supporting the up to date and unprefixed specification. ...
...And 5 more matches
background - CSS: Cascading Style Sheets
The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat 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. ...
... The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat 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. ...
...ll background style properties at once, such as color, image, origin and size, or repeat 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. ...
...And 5 more matches
border-image - 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. Note: You should specify a separate border-style in case the border image fails to load. Indeed, this is required according to the specification, although not all browsers implement this requirement. ...
...o the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: You should specify a separate border-style in case the border image fails to load. Indeed, this is required according to the specification, although not all browsers implement this requirement. ...
...ge-repeat. Accessibility concerns Assistive technology cannot parse border images. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
...And 5 more matches
border-inline-start - CSS: Cascading Style Sheets
-inline-start CSS property is a shorthand property for setting the individual logical inline-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. Constituent properties This property is a shorthand for the following CSS properties: border-inline-start-color border-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 corre...
...-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. See border-style. <'color'> The color of the border. See color. Formal defi...
...k-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 5 more matches
border-inline - CSS: Cascading Style Sheets
y 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. ...
...nds 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. ...
...s, 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 5 more matches
grid-template - CSS: Cascading Style Sheets
The grid-template CSS property is a shorthand property for defining grid columns, rows, and areas. The source for this interactive example is stored in a GitHub repository. If 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 grid-template CSS property is a shorthand property for defining grid columns, rows, and areas. The source for this interactive example is stored in a GitHub repository. If 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'> / <'grid-template-columns'> Sets grid-template-rows and grid-template-columns to the specified values, and sets grid-template-areas to none. [ <line-names>? <string>...
...And 5 more matches
grid - CSS: Cascading Style Sheets
Web › CSS › grid
The grid CSS property is a shorthand property that sets all of the explicit and implicit grid properties in a single declaration. The source for this interactive example is stored in a GitHub repository. If 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. 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. ...
...ute 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. 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. ...
...ithub.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. 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. ...
...And 5 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. ...
...t 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. ...
...e 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. ...
...And 5 more matches
Strict mode - JavaScript
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...
...The normal code may duplicate property names, with the last one determining the property's value. ...
... (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 i...
...And 5 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
ating options dialogs, confirmation dialogs, etc. This element takes a number of attributes, and can easily be made to display controls (buttons, etc) using widgets and layouts native to whatever platform it is running on. For example, Windows places the OK button on the left and the Cancel button on the right, while Mac OS X has the opposite layout. This is what Firefox itself uses for bookmark properties and other dialogs. Buttons used in dialog windows A dialog element will display some number of buttons at its bottom. As shown in Table 1, there are four types of buttons that can be displayed, and you can set the names of the buttons you want to display as a comma-delimited list in the value of the buttons attribute. FIXME: Make the table cleaner Button name Description ...
...y buttons with icons that are standard for the platform. Possible values for the icon attribute are given in Table 2. Figure 8: A button with an image icon attribute value icon attribute value accept close cancel print help add open remove save refresh find go-forward clear go-back yes properties no select-font apply select-color Table 2: Values for the icon attribute Toolbar buttons The toolbarbutton element is the element used to define toolbar buttons. This is typically placed inside a toolbar element, which defines a toolbar, but it can be used in other locations. These mostly act the same as button elements, but as shown in Listing 13, you can change...
...XUL document. Functions like Back, Forward, Reload can all be called using the goBack(), goForward(), and reload() methods. Using the stop() method stops loading the page currently in the process of being opened. Access restrictions With frames defined using HTML's frame and iframe elements, it is possible for a child frame to access its parent and ancestor frames by getting the parent and top properties of window objects. For an application that can open any web page, this could give a script on a web page access to an XUL document's frame, creating a dangerous opening for personal information to leak out. In the interests of security, you can enforce access restrictions by declaring type="content" on a browser element. When you do this, any web page that gets opened will see itself as the topm...
...And 4 more matches
Appendix D: Loading Scripts - Archive of obsolete content
rom which the code being evaluated was extracted. This information is invaluable for debugging, and the flexibility with which it can be specified makes this method useful for extracting JavaScript from a number of file formats other than raw JavaScript scripts. Additionally, as Sandbox objects can be created with an arbitrary prototype object, the evaluated code can be given access to the global properties of any existing scope. Security: Sandbox objects are initialized with a security principal object, or otherwise a window or URL from which to derive one. This means that evalInSandbox can be used to execute code with a specified privilege level rather than full chrome privileges. Beyond this, the scope of the Sandbox can be augmented or rarified to add or remove privileges as necessary. Under or...
...URL from which to derive one. This means that evalInSandbox can be used to execute code with a specified privilege level rather than full chrome privileges. Beyond this, the scope of the Sandbox can be augmented or rarified to add or remove privileges as necessary. Under ordinary circumstances, native objects passed out of Sandboxes are wrapped in XrayWrapper objects, which means that only native properties of these objects are directly exposed to privileged code. This behavior can be reversed by setting the wantsXrays parameter to false when constructing the Sandbox. Disadvantages Performance: There are several significant performance disadvantages inherent in this method: There is currently no way to load code into sandboxes from a cache. This means that code must be compiled and execu...
.... Examples The following code will execute a simple script in a Sandbox with the privilege level of the current content page. The globals of the current content window will be available in the scripts global scope. In stack traces, the script will appear to have been loaded from the file "zz-9://plural/zed/alpha", line 42. // Use the current content window as the execution context. ...
...And 4 more matches
Binding Implementations - Archive of obsolete content
When the src attribute is specified, any children of the implementation element are ignored. Methods Methods are defined using the method element. The name given on the tag using the name attribute is the name that can be used to invoke the method on the element. ...
...ies those parameters and their names with parameter elements declared underneath the method element. The implementation of the method is contained inside a body 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 r...
...ing attachment and the resulting value is stored on the element. It can be assumed that the anonymous content of the binding has been fully constructed, although the bindingattached event will not have fired. Property initialization always takes place after content generation but before the firing of a binding attachment event, since the bindingattached 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 ...
...And 4 more matches
Backgrounds and borders - Learn web development
Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn how to style the background and border of boxes. Styling backgrounds in CSS The CSS background property is a shorthand for a number of background longhand properties that we will meet in this lesson. If you discover a complex background property in a stylesheet, it might seem a little hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,255,255,.2) 39%, rgba(51,56,57,1) 96%) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, rebeccapurple; } We'll return to how the s...
...assed 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 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 <...
... property value, separating each one with a comma. When you do this you may end up with background images overlapping each other. The backgrounds will layer with the last listed background image at the bottom of the stack, and each previous image stacking on top of the one that follows it in the code. Note: Gradients can be happily mixed with regular background images. The other background-* properties can also have comma-separated values in the same way as background-image: background-image: url(image1.png), url(image2.png), url(image3.png), url(image4.png); background-repeat: no-repeat, repeat-x, repeat; background-position: 10px 20px, top right; Each value of the different properties will match up to the values in the same position in the other properties. Above, for example, image1's bac...
...And 4 more matches
Cascade and inheritance - Learn web development
two rules which could potentially 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 writ...
...ter 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 descendants do not get a width of 50% of their parent's width. If this was the case, CSS would be very frustrating to use! Note: On MDN CSS property reference pages you can find a technical information box, usually at the bottom of the specifications section, which lists a number of data points about that property...
...ve then added a class of special to the second nested list and applied a different color to it. This then inherits down through its children. Things like widths (as mentioned above), margins, padding, and borders do not inherit. If a border were to be inherited by the children of our list, every single list and list item would gain a border -- probably not an effect we would ever want! Which properties are inherited by default and which aren't is largely down to common sense. Controlling inheritance CSS provides four special universal property values for controlling inheritance. Every CSS property accepts these values. inherit Sets the property value applied to a selected element to be the same as that of its parent element. Effectively, this "turns on inheritance". initial Sets the pro...
...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). ...
...o the fact that 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 ha...
...s in the vertical writing mode, it still has a width, and this is causing the text to overflow. What we really want in this scenario, is to essentially swap height and width along with the writing mode. When we're in a vertical writing mode we want the box to expand in the block dimension just like it does in the horizontal mode. To make this easier, CSS has recently developed a set of mapped properties. These essentially replace physical properties -- things like width and height -- with logical, or flow relative versions. The property mapped to width when in a horizontal writing mode is called inline-size -- it refers to the size in the inline dimension. The property for height is named block-size and is the size in the block dimension. You can see how this works in the example below where we...
...And 4 more matches
Styling lists - Learn web development
A simple list example To begin with, let's look at a simple list example. ...
... A simple list example To begin with, let's look at a simple list example. Throughout this article, we'll look at unordered, ordered, and description lists -- all have styling features that are similar, and some that are particular to their type of list. ...
... Rules 5 and 6 apply to the description list -- we set the same line-height on the description list terms and descriptions as we did with the paragraphs and list items. Again, consistency is good! We also make the description terms have bold font, so they visually stand out easier. List-specific styles Now we've looked at general spacing techniques for lists, let's explore some list-specific properties. There are three properties you should know about to start with, which can be set on <ul> or <ol> elements: list-style-type: Sets the type of bullets to use for the list, for example, square or circle bullets for an unordered list, or numbers, letters or roman numerals for an ordered list. list-style-position: Sets whether the bullets appear inside the list items, or outside them before the s...
...And 4 more matches
Drawing graphics - Learn web development
first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn the basics of drawing on <canvas> elements using JavaScript. Graphics on the Web As we talked about in our HTML Multimedia and embedding module, the Web was originally just text, which was very boring, so images were introduced -- first via the <img> element and later via CSS properties such as background-image, and SVG. This however was still not enough. While you could use CSS and JavaScript to animate (and otherwise manipulate) SVG vector images -- as they are represented by markup -- there was still no way to do the same for bitmap images, and the tools available were rather limited. The Web still had no way to effectively create animations, games, 3D scenes, and other requ...
... canvas, results in a document that's wider than the window. To get rid of the scrollbars, we need to remove the margin and also set overflow to hidden. Add the following into the <head> of your document: <style> body { margin: 0; overflow: hidden; } </style> The scrollbars should now be gone. Note: You should generally set the size of the image using HTML attributes or DOM properties, as explained above. You could use CSS, but the trouble then is that the sizing is done after the canvas has rendered, and just like any other image (the rendered canvas is just an image), the image could become pixellated/distorted. Getting the canvas context and final setup We need to do one final thing before we can consider our canvas template finished. To draw onto the canvas we need to g...
... 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. 2D canvas basics As we sai...
...And 4 more matches
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
-moz-window-draggingThe -moz-window-dragging CSS property specifies whether a window is draggable or not. ...
... -moz-window-draggingThe -moz-window-dragging CSS property specifies whether a window is draggable or not. ...
...selected.:-moz-lwtheme-brighttextThe :-moz-lwtheme-brighttext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a bright text color is selected.:-moz-lwtheme-darktextThe :-moz-lwtheme-darktext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a dark text color is selected.::-moz-tree-cellActivated by the properties attribute.::-moz-tree-cell-textActivated by the properties attribute.::-moz-tree-cell-text(hover)The :-moz-tree-cell-text(hover) CSS pseudo-class will match an element if the mouse cursor is presently hovering over text in a tree cell.::-moz-tree-columnActivated by the properties attribute.::-moz-tree-drop-feedbackActivated by the properties attribute.::-moz-tree-imageActivated by the properties ...
...And 4 more matches
Python binding for NSS
object (i.e. struct) become methods of that object. NSS/NSPR objects 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. All NSS/NSPR Python objects can print their current value by evaluting the Python object in a string context or by using the Python str() function. Support threading. The Python Global Interpreter Lock (GIL) is released prior to calling NSS/NSPR C functions and reaquired after the NSS/NSPR C function returns. This allows other Python threads to execute during the time a NSS/NSPR function is pr...
...ocket.get_ssl_version_range SSLSocket.get_ssl_channel_info SSLSocket.get_negotiated_host SSLSocket.connection_info_format_lines SSLSocket.connection_info_format SSLSocket.connection_info_str SSLCipherSuiteInfo.format_lines SSLCipherSuiteInfo.format SSLChannelInfo.format_lines SSLChannelInfo.format The following class properties were added: Certificate.ssl_trust_flags Certificate.email_trust_flags Certificate.signing_trust_flags SSLCipherSuiteInfo.cipher_suite SSLCipherSuiteInfo.cipher_suite_name SSLCipherSuiteInfo.auth_algorithm SSLCipherSuiteInfo.auth_algorithm_name SSLCipherSuiteInfo.kea_type SSLCipherSuiteInfo.kea_type_name SSLCipherSuiteInf...
...tem now converts almost all DER encoded data to a string when it's str method is invoked, formerly it was limited to only a few objects. ...
...And 4 more matches
Rhino scopes and contexts
nt to understand that a scope is independent of the Context that created it. You can create a scope using one Context and then evaluate a script using that scope and another Context (either by exiting the current context and entering another, or by executing on a different thread). You can even execute scripts on multiple threads simultaneously in the same scope. Rhino guarantees that accesses to properties of JavaScript objects are atomic across threads, but doesn't make any more guarantees for scripts executing in the same scope at the same time. If two scripts use the same scope simultaneously, the scripts are responsible for coordinating any accesses to shared variables. A top-level scope is created by calling Context.initStandardObjects to create all the standard objects: ScriptableObject sco...
... In the diagram below, the order in which the six objects are traversed is indicated. Order of lookups in a two-deep scope chain with prototypes. For a more concrete example, let's consider the following script: var g = 7; function f(a) { var v = 8; x = v + a; } f(6); We have a top-level variable g, and the call to f will create a new top-level variable x. All top-level variables are properties of the scope object. When we start executing f, the scope chain will start with the function's activation object and will end with the top-level scope (see diagram below). The activation object has two properties, 'a' for the argument, and 'v' for the variable. The top-level scope has properties for the variable g and the function f. An example scope chain for a simple script. When the statem...
...ave additional objects specific to the embedding. Then all we need to do is create a new object and call its 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 defini...
...And 4 more matches
Bytecode Descriptions
script on the scope chain. Implements: GetNewTarget. DynamicImport Stack: moduleId => promise Dynamic import of the module specified by the string value on the top of the stack. Implements: Import Calls. ImportMeta Stack: => import.meta Push the import.meta object. This must be used only in module code. Objects Creating objects NewInit Stack: => obj Create and push a new object with no properties. Format: JOF_IC NewObject, NewObjectWithGroup Operands: (uint32_t baseobjIndex) Stack: => obj Create and push a new object of a predetermined shape. The new object has the shape of the template object script->getObject(baseobjIndex). Subsequent InitProp instructions must fill in all slots of the new object before it is used in any other way. For JSOp::NewObject, the new object has a group base...
...e used anywhere it might be executed more than once. There's a shell-only option, newGlobal({cloneSingletons: true}), that makes this instruction do a deep copy of the object. A few tests use it. Format: JOF_OBJECT ObjWithProto Stack: proto => obj Create and push a new ordinary object with the provided [[Prototype]]. This is used to create the .prototype object for derived classes. Defining properties InitProp Operands: (uint32_t nameIndex) Stack: obj, val => obj Define a data property on an object. obj must be an object. Implements: CreateDataPropertyOrThrow as used in PropertyDefinitionEvaluation of regular and shorthand PropertyDefinitions. Format: JOF_ATOM, JOF_PROP, JOF_PROPINIT, JOF_IC InitHiddenProp Operands: (uint32_t nameIndex) Stack: obj, val => obj Like JSOp::InitProp, but defi...
...M, JOF_PROP, JOF_PROPINIT InitElemSetter, InitHiddenElemSetter Stack: obj, id, setter => obj Define an accesssor property on obj with property key id and the given setter. This is used to implement setters with computed property keys or numeric keys. JSOp::InitHiddenElemSetter is the same but defines a non-enumerable property, for setters in classes. Format: JOF_ELEM, JOF_PROPINIT Accessing properties GetProp, CallProp Operands: (uint32_t nameIndex) Stack: obj => obj[name] Get the value of the property obj.name. This can call getters and proxy traps. JSOp::CallProp is exactly like JSOp::GetProp but hints to the VM that we're getting a method in order to call it. Implements: GetV, GetValue step 5. Format: JOF_ATOM, JOF_PROP, JOF_TYPESET, JOF_IC GetElem, CallElem Stack: obj, key => obj[key]...
...And 4 more matches
Shell global objects
r toggle JavaScript options. load(['foo.js' ...]) Load files named by string arguments. Filename is relative to the current working directory. loadRelativeToScript(['foo.js' ...]) Load files named by string arguments. Filename is relative to the calling script. evaluate(code[, options]) Evaluate code as though it were the contents of a file. ...
... Return any --module-load-path argument passed to the shell. Used by the module loader. parse(code) Parses a string, potentially throwing. syntaxParse(code) Check the syntax of a string, returning success value offThreadCompileScript(code[, options]) Compile code on a helper thread. To wait for the compilation to finish and run the code, call runOffThreadScript. ...
...g. clearLastWarning() Clear the last warning. elapsed() Execution time elapsed for the current thread. decompileFunction(func) Decompile a function. decompileThis() Decompile the currently executing script. thisFilename() Return the filename of the current script newGlobal([options]) Return a new global object in a new compartment. If options is given, it may have any of the following properties: sameZoneAs the compartment will be in the same zone as the given object (defaults to a new zone) invisibleToDebugger the global will be invisible to the debugger (default false) principal if present, its value converted to a number must be an integer that fits in 32 bits; use that as the new compartment's principal. Shell principals are toys, meant only for testing; one shell princ...
...And 4 more matches
Places Developer Guide
/ The id of the folder the livemark will be placed in "My Livemark Title", // The title of the livemark siteURI, // The URI of the site. A nsIURI object. feedURI, // The URI of the actual feed. A nsIURI object. bookmarks.DEFAULT_INDEX); // The position of the livemark in its parent folder. ...
...f the first subfolder matching the given title. Int64 getIdForItemAt(aFolderId, aPosition) - Returns the id of the item at the given position (throws if there's no item there). Bool getFolderReadonly(aFolderId) Accessing Folder Contents Queries in Places are executed through the main history service. The example below shows how to enumerate a bookmark folder's contents, and how to access the properties of the items themselves. var history = Cc["@mozilla.org/browser/nav-history-service;1"] .getService(Ci.nsINavHistoryService); var query = history.getNewQuery(); query.setFolders([myFolderId], 1); var result = history.executeQuery(query, history.getNewQueryOptions()); // The root property of a query result is an object representing the folder you specified above. var folderNode = result.root; //...
...lderId], 1); var result = history.executeQuery(query, history.getNewQueryOptions()); // The root property of a query result is an object representing the folder you specified above. var folderNode = result.root; // Open the folder, and iterate over its contents. folderNode.containerOpen = true; for (var i=0; i < folderNode.childCount; ++i) { var childNode = folderNode.getChild(i); // Some item properties. var title = childNode.title; var id = childNode.itemId; var type = childNode.type; // Some type-specific actions. if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_URI) { var uri = childNode.uri; } else if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER) { childNode.QueryInterface(Ci.nsINavHistoryContainerResultNode); childNode.containerOpen = true; // now you can iterate...
...And 4 more matches
Avoiding leaks in JavaScript XPCOM components
om JavaScript) would just work the other way around. And in the simple case, they do. The wrapper owns a reference to the native object that it wraps, and the wrapper object is kept alive by the JavaScript garbage collector. This problem is only in versions of Mozilla prior to Mozilla 1.8. However, it's not quite that simple, because of the convention that DOM nodes can have arbitrary JavaScript properties added to them by the programmer. These properties have to be preserved across garbage collections, even if the wrapper is not reachable from any garbage collection root, since the JavaScript programmer could access the DOM node again the same way he did the first time, and would then expect the added properties to still be there. We currently implement this by making the wrapper a root in the Jav...
...eachable from any garbage collection root, since the JavaScript programmer could access the DOM node again the same way he did the first time, and would then expect the added properties to still be there. We currently implement this by making the wrapper a root in the JavaScript garbage collector once somebody sets a JavaScript property on a DOM node. (This is roughly equivalent to making all the properties roots, but simpler.) Once this happens, it remains a root until the document stops being displayed. This means that neither the element nor any of the properties nor any of the objects reachable from those properties can be freed until the document is no longer displayed. You might think that it's unusual to set arbitrary properties on DOM nodes. And in many cases it is. But in one important cas...
... until the document stops being displayed. This means that neither the element nor any of the properties nor any of the objects reachable from those properties can be freed until the document is no longer displayed. You might think that it's unusual to set arbitrary properties on DOM nodes. And in many cases it is. But in one important case it's not: XBL. XBL fields are implemented as JavaScript properties on the bound element's wrapper, so they have all the hazards of JavaScript properties. (On wrapped objects other that DOM nodes, we allow JavaScript programmers to set properties, but we don't do anything to protect them from garbage collection. This makes program behavior depend on when garbage collection happens, which means the API is nondeterministic, which is really bad. This situation may ...
...And 4 more matches
nsIAbCard/Thunderbird3
Note: This interface has been overhauled completely for Thunderbird 3. Documentation for the old nsIAbCard interface is currently at nsIAbCard. The 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. Properties currently supported on the card: Names: FirstName, LastName PhoneticFirstName, PhoneticLastName DisplayName, NickName SpouseName, FamilyName PrimaryEmail, SecondEmail Home Contact: HomeAddress, HomeAddress2, HomeCity, HomeState, HomeZipCode, HomeCountry HomePhone, HomePhoneType Work contact. Same as home, but with `Work' instead of `Home' Other Conta...
...ut with `Work' instead of `Home' Other Contact: FaxNumber, FaxNumberType PagerNumber, PagerNumberType CellularNumber, CellularNumberType JobTitle, Department, Company _AimScreenName Dates: AnniversaryYear, AnniversaryMonth, AnniversaryDay BirthYear, 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...
... firstName AString Shorthand for getProperty and setProperty. lastName AString Shorthand for getProperty and setProperty. displayName AString Shorthand for getProperty and setProperty. primaryEmail ...
...And 4 more matches
Element - Web APIs
Web › API › Element
More specific classes inherit from Element. For example, the HTMLElement interface is the base interface for HTML elements, while the SVGElement interface is the basis for all SVG elements. Most functionality is specified further down the class hierarchy. Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element. ...
...It implements the properties of ParentNode, ChildNode, NonDocumentTypeChildNode, and Animatable. Element.attributes Read only Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element. Element.classList Read only Returns a DOMTokenList conta...
... Element.attributes Read only Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element. Element.classList Read only Returns a DOMTokenList containing the list of cla...
...And 4 more matches
HTMLImageElement - Web APIs
The HTMLImageElement interface represents an HTML <img> element, providing the properties and methods used to manipulate image elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke...
...a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor Image() The Image() constructor creates and returns a new HTMLImageElement object representing an HTML <img> element which is not attached to any DOM tree. It accepts optional width and height parameters. When called without parameters, new Image() is equivalent to calling document.createElement("img"). 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 t...
... in CSS pixels. HTMLImageElement.x Read only An integer indicating the horizontal offset of the left border edge of the image's CSS layout box relative to the origin of the <html> element's containing block. HTMLImageElement.y Read only The integer vertical offset of the top border edge of the image's CSS layout box relative to the origin of the <html> element's containing block. Obsolete properties HTMLImageElement.align A DOMString indicating the alignment of the image with respect to the surrounding context. The possible values are "left", "right", "justify", and "center". This is obsolete; you should instead use CSS (such as text-align, which works with images despite its name) to specify the alignment. HTMLImageElement.border A DOMString which defines the width of the border s...
...And 4 more matches
The HTML DOM API - Web APIs
, in which a node is a fundamental record representing a single object within the document (such as an element or text node). Nodes may be strictly organizational, providing a means for grouping other nodes together or for providing a point at which a hierarchy can be constructed; other nodes may represent visible components of a document. Each node is based on the Node interface, which provides properties for getting information about the node as well as methods for creating, deleting, and organizing nodes within the DOM. Nodes don't have any concept of including the content that is actually displayed in the document. They're empty vessels. The fundamental notion of a node that can represent visual content is introduced by the Element interface. An Element object instance represents a single elem...
...ed to both elements and documents; these presently include only copy, cut, and paste actions. HTML element interfaces The Element interface has been further adapted to represent HTML elements specifically by introducing the HTMLElement interface, which all more specific HTML element classes inherit from. This expands the Element class to add HTML-specific general features to the element nodes. Properties added by HTMLElement include for example hidden and innerText. HTMLElement also adds all the global event handlers. An HTML document is a DOM tree in which each of the nodes is an HTML element, represented by the HTMLElement interface. The HTMLElement class, in turn, implements Node, so every element is also a node (but not the other way around). This way, the structural features implemented by ...
...nterface is generic, however, providing only the functionality common to all HTML elements such as the element's ID, its coordinates, the HTML making up the element, information about scroll position, and so forth. ...
...And 4 more matches
MediaStreamTrack - Web APIs
See Capabilities, constraints, and settings to learn how to correctly work with constrainable properties. Not doing so correctly will result in your code being unreliable. ...
...Not doing so correctly will result in your code being unreliable. ...
...Not doing so correctly will result in your code being unreliable. ...
...And 4 more matches
PerformanceResourceTiming.connectEnd - Web APIs
tamp 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. ...
...eStamp 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. ...
...tablished. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.connectStart - Web APIs
ediately 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. ...
...stablish 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. ...
... resource. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.domainLookupEnd - Web APIs
ookupEnd 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. ...
...r 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. ...
... resource. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.domainLookupStart - Web APIs
upStart 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. ...
...ore 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. ...
... resource. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.fetchStart - Web APIs
rce. 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. ...
...mp 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. ...
... resource. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.redirectEnd - Web APIs
e, 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. ...
...r 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. ...
... redirect. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.redirectStart - Web APIs
m 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. ...
...nting 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. ...
... redirect. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.requestStart - Web APIs
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. ...
...fore 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. ...
...the server Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.responseEnd - Web APIs
ore 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. ...
...fore 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. ...
...mes first. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.responseStart - Web APIs
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. ...
...rowser 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. ...
...he server. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.secureConnectionStart - Web APIs
his 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. ...
...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. ...
...urns zero. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
PerformanceResourceTiming.workerStart - Web APIs
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. ...
... 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. ...
...TimeStamp. Example In the following example, the value of the *Start and *End properties of all "resource" type events are logged. ...
...And 4 more matches
Resource Timing API - Web APIs
The Resource Timing interfaces enable retrieving and analyzing detailed network timing data regarding the loading of an application's resource(s). An application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, DNS lookup start and end times, request start, response start and end times, etc. The interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. This document provides an overview of the Resource Timing interfaces. For more details ab...
...ace's reference page, Using the Resource Timing API, and the references in the See also section. For a graphical representation of the resource timing processing model see the resource timing phases 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. 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 us (microseconds). However, If the bro...
...ailable 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. ...
...And 4 more matches
Window - Web APIs
Web › API › Window
e is a suitable place to include these items that need to be globally available. Many of these are documented in the JavaScript Reference and the DOM Reference. In a tabbed browser, each tab is represented by its own Window object; the global window seen by JavaScript code running within a given tab always represents the tab in which the code is running. That said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeTo() and innerHeight. Generally, anything that can't reasonably pertain to a tab pertains to the window instead. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-...
...rce stored in a string into a DOM Document. DOMParser is specified in DOM Parsing and Serialization. Image Used for creating an HTMLImageElement. Option Used for creating an HTMLOptionElement. StaticRange Read only Returns a StaticRange() constructor which creates a StaticRange object. Worker Used for creating a Web worker. XMLSerializer Converts a DOM tree into XML or HTML source. Properties This interface inherits properties from the EventTarget interface and implements properties from the WindowOrWorkerGlobalScope and WindowEventHandlers mixins. Note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below. Window.closed Read only This property indicates whether the current window is closed or not. W...
... each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples. Window.personalbar Read only Returns the personalbar object, whose visibility can be toggled in the window. Window.screen Read only Returns a reference to the screen object associated with the window. Window.screenX and Window.screenLeft Read only Both properties return the horizontal distance from the left border of the user's browser viewport to the left side of the screen. Window.screenY and Window.screenTop Read only Both properties return the vertical distance from the top border of the user's browser viewport to the top side of the screen. Window.scrollbars Read only Returns the scrollbars object, whose visibility can be toggled in the window.
...And 4 more matches
::first-line (:first-line) - CSS: Cascading Style Sheets
the length of the first line depends on many factors, including the width of the element, the width of the document, and the font size of the text. /* Selects the first line of a <p> */ p::first-line { color: red; } CSS3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-line, introduced in CSS2. ...
...n many factors, including the width of the element, the width of the document, and the font size of the text. /* Selects the first line of a <p> */ p::first-line { color: red; } CSS3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-line, introduced in CSS2. ...
...d the font size of the text. /* Selects the first line of a <p> */ p::first-line { color: red; } CSS3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-line, introduced in CSS2. ...
...And 4 more matches
Border-image generator - CSS: Cascading Style Sheets
--> <div id="border-width-control" class="category"> <div class="title"> border-image-width </div> </div> <!-- border-image-outset --> <div id="border-outset-control" class="category"> <div class="title"> border-image-outset </div> </div> <!-- 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> ...
...t; width: 80px; } #controls .border-repeat .ui-dropdown-list { height: 6.2em; border-width: 1px; text-align: center; } /* border-image-slice */ #border-slice-control .ui-dropdown-list { height: 4.3em; } /* border-image-width */ #border-width-control .ui-dropdown-list { height: 6.2em; } /* border-image-outset */ #border-outset-control .ui-dropdown-list { height: 4.3em; } #aditional-properties .property { width: 200px; } #aditional-properties .ui-input-slider > input { width: 80px !important; } /* unit settings panel */ #unit-settings { padding: 10px; position: absolute; background: #FFF; font-size: 12px; border-radius: 3px; border: 1px solid #CCC; text-align: center; color: #555; position: absolute; z-index: 1000; box-shadow: 0 0 3px 0 #BABABA; transition: all 0.2...
...}; var load = function load() { browse.click(); }; browse.setAttribute('type', 'file'); browse.style.display = 'none'; browse.onchange = loadImage; return { load: load }; })(); var ImageControl = (function ImageControl() { var scale = 0.5; var imgSource = new Image(); var imgState = null; var selected = null; var topics = ['slice', 'width', 'outset']; var properties = {}; properties['border1'] = { fill : false, slice_values : [27, 27, 27, 27], width_values : [20, 20, 20, 20], outset_values : [0, 0, 0, 0], slice_units : [0, 0, 0, 0], width_units : [0, 0, 0, 0], outset_units : [0, 0, 0, 0], repeat : [1, 1], size : [300, 200], preview_area : 400 }; properties['border2'] = { fill : false, slice_values : [3...
...And 4 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
t speeds. CSS was therefore modularised, and the various CSS Specifications are different modules that make up CSS today. These modules relate to each other, and are at different stages of development. The box alignment module For many people the first reason they start to look at flexbox is because of the ability to properly align flex items inside a flex container. Flexbox provides access to properties that allow the alignment of items on their cross axis and justification of items on the main axis. These properties started life in the flexbox specification, but are now also part of the Box Alignment Specification. This specification details how alignment works in all layout -- not just flexbox. Box alignment deals with alignment and justification, and also distribution of space along an axis.
...n their cross axis and justification of items on the main axis. These properties started life in the flexbox specification, but are now also part of the Box Alignment Specification. This specification details how alignment works in all layout -- not just flexbox. Box alignment deals with alignment and justification, and also distribution of space along an axis. The reason that the Box alignment properties remain detailed in the flexbox specification as well as being in box alignment is to ensure that completion of the flexbox spec is not held up by box alignment, which has to detail these methods for all layout types. There is a note in the flexbox spec stating that in the future, once it is completed, the definitions in Box Alignment Level 3 will supersede those of flexbox: "Note: While the ali...
... detailed in the flexbox specification as well as being in box alignment is to ensure that completion of the flexbox spec is not held up by box alignment, which has to detail these methods for all layout types. There is a note in the flexbox spec stating that in the future, once it is completed, the definitions in Box Alignment Level 3 will supersede those of flexbox: "Note: 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 Alignme...
...And 4 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
t space, and have a couple of options. We either display the space outside of the items -- therefore spacing them out with white space between or around them -- or we absorb the extra space inside the items and therefore need a method of allowing the items to grow and take up this space. Space distributed outside the items To distribute the space between or around the items we use the alignment properties in 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-aroun...
...here 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 flex properties to allow items to grow and shrink in proportion to one another as described in Controlling ratios of flex items along the main axis. If I wanted all of my navigation items to have equal width, then I might use flex: auto, which is the shorthand for flex: 1 1 auto -- all items grow and shrink from a flex-basis of auto. This would mean that the longer item would have more space. In the live examp...
...haviour of flexbox, and we are aligning the item on the right by giving it a left margin of auto. You can move the class from one item to another to change where the split happens. Also in this example we are using margins on the flex items to create a gap between items, and a negative margin on the container in order that the items still remain flush with the right and left edges. Until the gap properties from the Box Alignment specification are implemented in flexbox, we have to use margins in this way if we want to create a gutter between items. Center item Before flexbox, developers would joke that the hardest problem in web design was vertical centering. This has now been made straightforward using the alignment properties in flexbox, as the following live example shows. You can play with...
...And 4 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
In this guide, we look at how flow layout behaves when used with different document writing modes. This is not a comprehensive guide to the use of writing modes in CSS, the aim here is to document the areas where flow layout interacts with writing modes in possibly unanticipated ways. The external resources and see also sections of this document link to more writing modes resources. ...
... external resources and see also sections of this document link to more writing modes resources. The Writing Modes Specification The CSS Writing Modes Level 3 Specification defines the impact a change the document writing mode has on flow layout. In the writing modes introduction, the specification says, "A writing mode in CSS is determined by the writing-mode, direction, and text-orientation properties. It is defined primarily in terms of its inline base direction and block flow direction." The specification defines the inline base direction as the direction in which content is ordered on a line. This defines the start and end of the inline direction. The start is where sentences start and the end is where a line of text ends before it would begin to wrap onto a new line. The block flow dire...
...riting mode. The CSS writing-mode property controls the block flow direction. If you want to change your page, or part of your page, to vertical-lr then 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...
...And 4 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
features, however, 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 sol...
...s most exciting to many of us was that it gave us proper alignment control for the first time. It made it easy to center a box on the page. Flex items can stretch to the height of the flex container, meaning that equal height columns were possible. These were things we have wanted to do for a very long time, and have come up with all kinds of hacks to accomplish, at least visually. The alignment properties from the flexbox specification have been added to a new specification called Box Alignment Level 3. This means that they can be used in other specifications, including Grid Layout. In the future, they may well apply to other layout methods as well. In a later guide in this series, I'll be taking a proper look at Box Alignment and how it works in Grid Layout. For now, here is a comparison between...
... <div class="wrapper"> <div class="box1">One</div> <div class="box2">Two</div> <div class="box3">Three</div> </div> .wrapper { display: flex; align-items: flex-end; min-height: 200px; } .box1 { align-self: stretch; } .box2 { align-self: flex-start; } Alignment in CSS Grids This second example uses a grid to create the same layout. This time we are using the box alignment properties as they apply to a grid layout. So we align to start and end rather than flex-start and flex-end. In the case of a grid layout, we are aligning the items inside their grid area. In this case that is a single grid cell, but it could be an area made up of several grid cells. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } ...
...And 4 more matches
border-radius - CSS: Cascading Style Sheets
oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. The radius applies to the whole background, even if the element has no border; the exact position of the clipping is defined by the background-clip property. The border-radius property does not apply to table elements when border-collapse is collapse. ...
...s no border; the exact position of the clipping is defined by the background-clip property. The border-radius property does not apply to table elements when border-collapse is collapse. Note: As with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit, which would partially override existing definitions. Instead, the individual longhand properties have to be used. ...
...ipping is defined by the background-clip property. The border-radius property does not apply to table elements when border-collapse is collapse. Note: As with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit, which would partially override existing definitions. Instead, the individual longhand properties have to be used. ...
...And 4 more matches
border-right - CSS: Cascading Style Sheets
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; ... ...
...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; ... ...
...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 4 more matches
border-top - CSS: Cascading Style Sheets
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; ... ...
...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; ... ...
...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. ...
...And 4 more matches
flex - CSS: Cascading Style Sheets
Web › CSS › flex
The flex CSS shorthand property sets how a flex item will grow or shrink to fit the space available 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. ...
...perty sets how a flex item will grow or shrink to fit the space available 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. ...
...st be one of: a <number>: then it is interpreted as <flex-shrink>. a valid value for width: then it is interpreted as <flex-basis>. Three-value syntax: the values must be in the following order: a <number> for <flex-grow>. a <number> for <flex-shrink>. a valid value for width for <flex-basis>. Values initial The item is sized according to its width and height properties. It shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container. This is equivalent to setting "flex: 0 1 auto". auto The item is sized according to its width and height properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container. This is equivalent to setting "flex:...
...And 4 more matches
transition - CSS: Cascading Style Sheets
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. Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript. ...
...ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript. ...
... Each single-property transition describes the transition that should be applied to a single property...
...And 4 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
Increments the value of a numeric input by one or by the specified number of units. CSS Inputs, being replaced elements, have a few features not applicable to non form elements. There are CSS selectors that can specification target form controls based on their UI features, also known as UI pseudo-classes. The input element can also be targeted by type with attribute selectors. There are some properties that are especially useful as well. UI pseudo-classes Captions super relevant to the <input> element: Pseudo-class Description :enabled Any currently enabled element that can be activated (selected, clicked on, typed into, etc.) or accept focus and also has a disabled state, in which it can't be activated or accept focus. :disabled Any currently disabled...
...password"] {} /* matches a form control whose valid values are limited to a range of values*/ input[min][max] {} /* matches a form control with with a pattern attribute */ input[pattern] {} ::placeholder By default, the appearance of placeholder text is a translucent or light gray. The ::placeholder pseudo-element is the input's placeholder text. It can be styled with a limited subset of CSS properties. ::placeholder { color: blue; } Only the subset of CSS properties that apply to the ::first-line pseudo-element can be used in a rule using ::placeholder in its selector. appearance The appearance property enables the displaying of (almost) any element as a platform-native style based on the operating system's theme as well as the removal of any platform-native styling with the none value. ...
...stom { caret-color: red; font: 16px "Helvetica", "Arial", "sans-serif" } Result object-position and object-fit In certain cases (typically involving non-textual inputs and specialized interfaces), the <input> element is a replaced element. When it is, the position and size of the element's size and positioning within its frame can be adjusted using the CSS object-position and object-fit properties Styling For more information about adding color to elements in HTML, see: Applying color to HTML elements using CSS. Also see: Styling HTML forms, advanced styling for HTML forms, and the compatibility table of CSS properties. Additional features Labels Labels are needed to associate assistive text with an <input>. The <label> element provides explanatory information about a form f...
...And 4 more matches
JavaScript data types and data structures - JavaScript
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. ...
... number often represents only its value, JavaScript provides binary (bitwise) operators. Caution: Although bitwise operators can be used to represent several Boolean values within a single number using bit masking, this is usually considered a bad practice. JavaScript offers other means to represent a set of Booleans (like an array of Booleans, or an object with Boolean values assigned to named properties). Bit masking also tends to make the code more difficult to read, understand, and maintain. It may be necessary to use such techniques in very constrained environments, like when trying to cope with the limitations of local storage, or in extreme cases (such as when each bit over the network counts). This technique should only be considered when it is the last measure that can be taken to optim...
... the appropriate abstraction. Symbol type A Symbol is a unique and immutable primitive value and may be used as the key of an Object property (see below). In some programming languages, Symbols are called "atoms". For more details see Symbol and the Symbol object wrapper in JavaScript. Objects In computer science, an object is a value in memory which is possibly referenced by an identifier. Properties In JavaScript, objects can be seen as a collection of properties. With the object literal syntax, a limited set of properties are initialized; then properties can be added and removed. Property values can be values of any type, including other objects, which enables building complex data structures. Properties are identified using key values. A key value is either a String or a Symbol value. Th...
...And 4 more matches
core/heritage - Archive of obsolete content
much machinery exposed. Dog.prototype.type = 'dog'; Dog.prototype.bark = function bark() { return 'Ruff! Ruff!' }; // Subclassing a `Dog` function Pet(name, breed) { // Once again we do our little dance if (!(this instanceof Pet)) return new Pet(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 SD...
...xel.toString(); // => #CC3399@11:23 pixel instanceof Pixel // => true pixel instanceof Point // => true extend Module exports extend utility function, that is useful for creating objects that inherit from other objects, without associated classes. It's very similar to Object.create, only difference is that second argument is an object containing properties to be defined, instead of property descriptor map. Also, keep in mind that returned object will be frozen. var { extend } = require('sdk/core/heritage'); var base = { a: 1 }; var derived = extend(base, { b: 2 }); derived.a // => 1 derived.b // => 2 base.isPrototypeOf(derived) // => true mix Module exports mix utility function that is usefu...
...d, instead of property descriptor map. Also, keep in mind that returned object will be frozen. ...
...And 3 more matches
util/object - Archive of obsolete content
Properties are merged with descriptors onto the source object. Any argument given with "falsy" values (null, undefined) in case of objects are skipped. ...
...Properties are merged with descriptors onto the source object. Any argument given with "falsy" values (null, undefined) in case of objects are skipped. ...
...Properties are merged with descriptors onto the source object. Any argument given with "falsy" values (null, undefined) in case of objects are skipped. ...
...And 3 more matches
Install Manifests - Archive of obsolete content
t of the Install Manifest is RDF/XML. The file must be called install.rdf and live at the top level of an add-on'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: extensionnam...
...2</em:version> Firefox 1.5 / XULRunner 1.8 - add-ons that do not use a valid version format will not be installed. The version format is different from, although backwards-compatible with, 1.0's. For add-ons hosted on addons.mozilla.org - Mozilla's update website may repackage your add-on and correct or reject malformed version strings. Optional Property Reference You may need to supply these properties, depending on the capabilities of your add-on. aboutURL The chrome:// URL of the extension's about dialog box. This is only useful to extensions. If this property is specified, in the about:addons extensions list, the About... link in the extension's context menu will show this dialog, rather than the default. Note: As of Gecko 2.0, the dialog receives the Addon object representing your add-...
... this information for. Examples This declares a set of add-on metadata to be displayed when the application is running in the de-DE locale. <em:localized> <Description> <em:locale>de-DE</em:locale> <em:name>Tab Sidebar</em:name> <em:description>Zeigt in einer Sidebar Vorschaubilder der Inhalte aller offenen Tabs an.</em:description> </Description> </em:localized> The following properties which are described elsewhere in this page can be included in the localized property: name description creator homepageURL developer translator contributor More documentation can be found at Localizing extension descriptions. optionsType The type of user-interface used for displaying the options. Accepted values are: 1 Opens optionsURL in a dialog box 2 Optio...
...And 3 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
e: There are still some scenarios where incompatibilities may arise, such as trying to cancel the function call under a certain set of conditions when other Add-ons have overridden the same function. Again, this is a problem with the "string-patch" method, too. How to handle this is inter-Add-on specific and not addressed in this article. Overriding/Extending/Amending existing objects (or object properties) Again, you might be tempted to uneval(), string replace and eval() existing objects to override them (or at least some properties). Of course, the issues given in the 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 exa...
...because the object is frozen or sealed, then creating a Proxy around the object might be a viable approach. ...
...because the object is frozen or sealed, then creating a Proxy around the object might be a viable approach. ...
...And 3 more matches
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
ure.import("menu"); Menus All menus in Jetpack are jetpack.Menu objects, including both built-in Firefox menus and menus that features create. To create a new menu, use one of the jetpack.Menu constructors below. Constructors jetpack.Menu() Creates an empty menu. jetpack.Menu(menuitems) Creates a menu with the given items. Parameters menuitems An array of menuitems. jetpack.Menu(properties) Creates a menu with specific properties. Parameters properties An object defining any of the properties below. The items property may be used to define an array of menuitems. Properties Property Type Description beforeHide function A function invoked just before the menu is hidden. If the menu is a context menu, it is called...
...t 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 function(context) and otherwise function(). context is an object describing the context in which the menu was shown. string A simple menuitem with the given string label. object A menuitem with specific properties. The object may define any of the properties listed below. Properties Property Type Description command function A function that will be called when the menuitem is clicked. If the menu property is present, command will instead be called when any of the item's descendants is clicked. In that case, the commands of descendants will be...
... A character that is used as the item's shortcut key while the menu is open. It should be one of the characters that appears in the item's label. On some platforms this character is underlined in the label. type string Currently only "separator" is supported. If this property is undefined, the item is a normal menuitem. Note that when type == "separator", any other properties (such as label) may be specified. Fancy separators may behave differently on different platforms, however. xulId string The ID of the menuitem's backing XUL element, exposed for the benefit of advanced developers. Menu bar menus jetpack.menu When you need to expose functionality through a menu but no menu in particular, do The Right Thing by using jetpack.men...
...And 3 more matches
loadResources - Archive of obsolete content
This method is used to internationalize installation scripts by allowing the installer to retrieve localized string values from a separate file. ...
...This method is used to internationalize installation scripts by allowing the installer to retrieve localized string values from a separate file. ...
...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. ...
...And 3 more matches
Modifying a XUL Interface - Archive of obsolete content
de() function and the copy is appended using appendChild(). Note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can. These are described in the next section. Manipulating Basic Elements The main XUL elements such as buttons, checkboxes and radio buttons may be manipulated using a number of script properties. ...
...and the copy is appended using appendChild(). Note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can. These are described in the next section. Manipulating Basic Elements The main XUL elements such as buttons, checkboxes and radio buttons may be manipulated using a number of script properties. ...
...dditional specialized modification functions which you should use instead when you can. These are described in the next section. Manipulating Basic Elements The main XUL elements such as buttons, checkboxes and radio buttons may be manipulated using a number of script properties. The properties available are listed in the element reference as those available are different for each element. Common properties that you will manipulate include the label, value, checked and disabled properties. They set or clear the corresponding attribute as necessary. Label and value properties examples Here is a simple example which changes the label on a button: Example 3 : Source View <button label="Hello" oncommand="this.label = 'Goodbye';"/> When the button is pressed, the label is changed. This technique will wo...
...And 3 more matches
Property Files - Archive of obsolete content
An example is shown below: notFoundAlert=No files were found matching the criteria. ...
...iles are suitable when you have text in a XUL file. However, a script does not 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 al...
...d 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 as a comment: # This is a comment welcomeMessage=Hello, world! # This is another comment goodbyeMessage=Come back soon! Stringbundles You could write the code to read properties yourself, however XUL provides the stringbundle element which does this for you. The element has a number of functions which can be used to get strings from the property file and get other locale information. This element reads in the contents of a property file and builds a list of properties for you. You can then look up a particular property by name. <stringbundleset id="stringbundleset"> <str...
...And 3 more matches
Old Proxy API - Archive of obsolete content
JavaScript. The default object semantics are implemented in the JavaScript engine, often written in lower-level languages like C++. Proxies let the programmer define most of the behavior of an object in JavaScript. They are said to provide a meta-programming API. Terminology catch-all mechanism (or "intercession API") The technical term for this feature. handler The object that intercepts properties. proxy The object whose properties are being intercepted. proxy factory The object or method that creates intercessive proxies. traps The methods that provide property access. This is analogous to the concept of traps in operating systems. Proxies can be either be trapping or fixed. Proxy API Catch-alls can be defined only on distinct proxy objects, controlled by a handler object. There...
...e chain. Object.getOwnPropertyNames(proxy) getOwnPropertyNames: function() -> Strings Array Return an array of all own (non-inherited) property names of the emulated object. Object.getPropertyNames(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 i...
...er or not the name property was 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 ca...
...And 3 more matches
Implementing feature detection - Learn web development
ment('div'); if (testElem.style.flex !== undefined && testElem.style.flexFlow !== undefined) { conditional.setAttribute('href', 'flex-layout.css'); } else { conditional.setAttribute('href', 'float-layout.css'); } Here we are grabbing a reference to the second <link> element, and creating a <div> element as part of our test. In our conditional statement, we test that the flex and flex-flow properties exist in the browser. Note how the JavaScript representations of those properties that are stored inside the HTMLElement.style object use lower camel case, not hyphens, to separate the words. Note: If you have trouble getting this to work, you can compare it to our css-feature-detect-finished.html code (see also the live version). When you save everything and try out your example, you should ...
... css-feature-detect-finished.html code (see also the live version). When you save everything and try out your example, you should see the flexbox layout applied to the page if the browser supports modern flexbox, and the float layout if not. Note: Often such an approach is overkill for a minor feature detection problem -- you can often get away with using multiple vendor prefixes and fallback properties, as described in CSS fallback behavior and Handling CSS prefixes. @supports In recent times, CSS has had its own native feature detection mechanism introduced -- the @supports at-rule. This works in a similar manner to media queries (see also Responsive design problems) -- except that instead of selectively applying CSS depending on a media feature like a resolution, screen width or aspect rat...
...-right: 0; } } This at-rule block applies the CSS rule within only if the current browser supports both the flex-flow: row and flex: 1 declarations. For each condition to work, you need to include a complete declaration (not just a property name) and NOT include the semi-colon on the end. @supports also has OR and NOT logic available -- the other block applies the float layout if the flexbox properties are not available: @supports not (flex-flow: row) and (flex: 1) { /* rules in here */ } This may look a lot more convenient than the previous example -- we can do all of our feature detection in CSS, no JavaScript required, and we can handle all the logic in a single CSS file, cutting down on HTTP requests. the problem here is browser support -- @supports is not supported at all in IE, and ...
...And 3 more matches
Gecko info for Windows accessibility vendors
interested in only a few attributes per node. HRESULT get_attributesForNames( /* [in] */ unsigned short numAttribs, /* [in] */ BSTR __RPC_FAR *attribNames, /* [in] */ short __RPC_FAR *nameSpaceID, /* [out] */ BSTR __RPC_FAR *attribValues); The get_computedStyle method is used to find out the cumulative, computed results for all style rules applied to a node. ...
...node. HRESULT get_attributesForNames( /* [in] */ unsigned short numAttribs, /* [in] */ BSTR __RPC_FAR *attribNames, /* [in] */ short __RPC_FAR *nameSpaceID, /* [out] */ BSTR __RPC_FAR *attribValues); The get_computedStyle method is used to find out the cumulative, computed results for all style rules applied to a node. The return value numStyleProperties specifies the number of style properties for this node, and the last 2 parameters return 2 arrays corresponding to style property name and style property value. Another [in] parameter, useAlternativeMediaProperties, indicates whether you want style information for the default media type (usually screen), or a set of alternative media types specified in nsISimpleDOMDocument::set_alternateViewMediaType(mediaTypeString) . See the W3C's web...
...tes whether you want style information for the default media type (usually screen), or a set of alternative media types specified in nsISimpleDOMDocument::set_alternateViewMediaType(mediaTypeString) . See the W3C's website for a list of official media type name. Unfortunately, at this time the argument useAlternateView is ignored. ...
...And 3 more matches
Displaying Places information using views
ollowing stylesheet is optional and only applies styles and icons 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. It does so by recognizing certain magic values of the id attribute on your treecol elements. A property in the result is bound to a column via that column's id attribute. For example, by setting a column's id to "title", you tell the view to display the title of the nsINavHistoryResultNode of each row in that column. The following table shows the mappings between these magic colum...
...es of the id attribute on your treecol elements. A property in the result is bound to a column via that column's id attribute. For example, by setting a column's id to "title", you tell the view to display the title of the nsINavHistoryResultNode of each row in that column. ...
...vHistoryResultTreeViewer maps between row indices and the nsINavHistoryResultNode objects contained in the rows. nsINavHistoryResultObserver notifies observing clients about updates when the underlying data changes. It's not so useful for our purposes here. nsITreeView provides a high-level interface for trees in general. ...
...And 3 more matches
Downloads.jsm
try point to interact with the downloading capabilities of the platform, including starting new downloads, controlling ongoing downloads, and retrieving download-related configuration. To use it, you first need to import the code module into your JavaScript scope: Components.utils.import("resource://gre/modules/Downloads.jsm"); Method overview Promise<Download> createDownload(Object aProperties); Promise<void> fetch(aSource, aTarget, [optional] Object aOptions); Promise<DownloadList> getList(aType); Promise<DownloadSummary> getSummary(aType); Constants Constant Description PUBLIC Work on downloads that were not started from a private browsing window. PRIVATE Work on downloads that were started from a private browsing...
...<DownloadList> getList(aType); Promise<DownloadSummary> getSummary(aType); Constants Constant Description PUBLIC Work on downloads that were not started from a private browsing window. PRIVATE Work on downloads that were started from a private browsing window. ALL Work on both Downloads.PRIVATE and Downloads.PUBLIC downloads. Properties Attribute Type Description Error Read only Constructor Constructor for a DownloadError object. When you catch an exception during a download, you can use this to verify if ex instanceof Downloads.Error, before reading the exception properties with the error details. Example (using Task.jsm): try { yield Downloads.fetch(sourceUri, targetFile); } catch (ex if ...
...g the exception properties with the error details. Example (using Task.jsm): try { yield Downloads.fetch(sourceUri, targetFile); } catch (ex if ex instanceof Downloads.Error && ex.becauseTargetFailed) { console.log("Unable to write to the target file, ignoring the error."); } Methods createDownload() Creates a new Download object. Promise<Download> createDownload( Object aProperties ); Parameters aProperties Provides the initial properties for the newly created download. This matches the serializable representation of a Download object. Some of the most common properties in this object include: source: String containing the URI for the download source. Alternatively, may be an nsIURI, a DownloadSource object, or an object with the following properties: url:...
...And 3 more matches
Localizing with Mozilla Translator
you will always do better if you can export a partial glossary and reimport it as needed. See the following example. Let's assume you have a Firefox product in MT with the directory layout present in language packs, as you probably would need for a initial localization. ...
...the following example. Let's assume you have a Firefox product in MT with the directory layout present in language packs, as you probably would need for a initial localization. The directory structure will look like this: (ab-CD JAR root) locale |-- branding | |-- brand.dtd | `-- brand.properties |-- browser | |-- aboutDialog.dtd . . |-- browser-region | `-- region.properties `-- ab-CD |-- alerts | `-- notificationNames.properties |-- autoconfig | `-- autoconfig.properties |-- cookie | |-- cookieAcceptDialog.dtd | `-- cookieAcceptDialog.properties |-- global | |-- about.dtd | |-- appPicker.dtd . . but in the CVS and mozilla-central repositories the locale part looks like this: t...
... . ...
...And 3 more matches
Localization technical reviews
th <em:contributor> tags just after the MOZ_LANGPACK_CONTRIBUTORS section. Make sure that the the text content is wrapped with emptyLines. Leading comments are OK, but watch out for #filter emptyLines #define ... # comment #define ... #unfilter emptyLines In toolkit/defines.inc, the native name of the language is specified, which is used as description for the built language packs. region.properties Though locales might like to specify changes from the beginning, the region.properties files will be reverted to en-US. Changes will be discussed in productization bugs filed for each locale. Search plugins Similar to the region.properties files, the list.txt file should be reverted to en-US and amended accordingly as the search plugin productization bugs are completed. For this initial revi...
...It is best to look into each of these files to see if the localizer's strings might be too long. This is something to look for, but can be difficult to diagnose immediately. For more info, see bug 435874. ...
...It is best to look into each of these files to see if the localizer's strings might be too long. This is something to look for, but can be difficult to diagnose immediately. For more info, see bug 435874. ...
...And 3 more matches
JSNewEnumerateOp
The type of ObjectOps::enumerate. 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 ...
...aning depends on enum_op. See the Description below. Description 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. ...
...he Description below. Description 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, JSNewEnu...
...And 3 more matches
Starting WebLock
n special locations - an application plugin directory, for example, preference files and/or directories, or other application specific paths. For example, to expose the location of the "white list" file containing all of the URLs that are safe for WebLock, you can add its location to the nsDirectoryService, which clients can then query for this infomation. The Directory Service implements the nsIProperties interface, which allows you to Get(), Set(), and Undefine() interface pointers. In the case of WebLock, these interface pointers will be nsIFile objects. [scriptable, uuid(78650582-4e93-4b60-8e85-26ebd3eb14ca)] interface nsIProperties : nsISupports { /** * Gets a property with a given name. * * @return NS_ERROR_FAILURE if a property with that * name doesn't exist. * ...
... the directory containing the application executable is NS_XPCOM_CURRENT_PROCESS_DIR. Given this key, you can acquire the directory service, call Get(), and pass the key. In the example below, appDir will point to the directory that contains the executable. ...
..., and pass the key. In the example below, appDir will point to the directory that contains the executable. ...
...And 3 more matches
Components.utils.Sandbox
omponents.utils.Sandbox(principal); Null principal You can create a null principal using code like: Cc["@mozilla.org/nullprincipal;1"].createInstance(Ci.nsIPrincipal); From Firefox 37 onwards, you can also specify the null principal by simply passing null as the principal argument. options The constructor accepts an optional parameter. This parameter is an object with the following optional properties: freshZone If true creates a new GC region separate from both the calling context's and the sandbox prototype's region. Addons creating sandboxes whose expected lifetime is tied to that of a content window object will want to use sameZoneAs instead. sameZoneAs A JavaScript object in whose garbage collection region the sandbox should be created in. This helps to improve memory usage by a...
... Boolean indicating whether the Components object is available or not in the sandbox. Default: true. If the sandbox interacts with untrusted content this should be set to false when possible to further reduce possible attack surface. wantExportHelpers A Boolean: if true, then createObjectIn(), evalInWindow(), and exportFunction() are available in the sandbox. Default: false. wantGlobalProperties An array of strings. Each string is the name of an object that you want to make available as a global to code running in the sandbox. The exception is "-Promise": the Promise constructor is available by default for sandboxes, and you use this option to remove it from the sandbox. Note that "-Promise" is removed in Firefox 37. The following objects are supported: -Promise (remov...
... wantXrays A Boolean value indicating wheth...
...And 3 more matches
imgICache
CacheForChannel(relevantChannel) If there is no relevant document or channel, null may be passed, but this will cause any image cache requests to use the permanent storage cache (ie. any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter). ...
...vantChannel) If there is no relevant document or channel, null may be passed, but this will cause any image cache requests to use the permanent storage cache (ie. any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter). ...
...rview void clearCache(in boolean chrome); nsIProperties findEntryProperties(in nsIURI uri); void removeEntry(in nsIURI uri); Methods clearCache() Evict images from the cache. void clearCache( in boolean chrome ); Parameters chrome If true, evict only chrome images. If false, evict everything except chrome images. ...
...And 3 more matches
nsIHTMLEditor
nsIDOMElement aAnchorElement); boolean isAnonymousElement(in nsIDOMElement aElement); void makeOrChangeList(in AString aListType, in 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 a...
...ght color of the selection. AString getHighlightColorState( out boolean aMixed ); Parameters aMixed true if there is more than one font color. Return value Color string. "" is returned for none. getIndentState() Document me! void getIndentState( out boolean aCanIndent, out boolean aCanOutdent ); Parameters aCanIndent aCanOutdent getInlineProperty() Gets aggregate properties of the current selection. All object in the current selection are scanned and their attributes are represented in a list of Property object. void getInlineProperty( in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll ); Parameters aProperty The property to get on the selection. aAttribute The attribute of the ...
...formatting. void pasteNoFormatting( in long aSelectionType ); Parameters aSelectionType rebuildDocumentFromSource() Rebuild the entire document from source HTML Needed to be able to edit HEAD and other outside-of-BODY content. void rebuildDocumentFromSource( in AString aSourceString ); Parameters aSourceString HTML source string of the entire new document. removeAllDefaultProperties() Unregisters all default style properties with the editor. void removeAllDefaultProperties(); Parameters None. removeAllInlineProperties() Deletes all the inline properties from all text in the current selection. void removeAllInlineProperties(); Parameters None. removeDefaultProperty() Unregisters a default style property with the editor. void removeDefaultProperty( in nsIAtom a...
...And 3 more matches
Using nsIDirectoryService
This implementation will allow you to Get(), Set(), Define(), and Undefine() nsIFile. Getting a location: Most developers need to find where a file or directory is located. With nsDirectoryService, there are two steps involved. First, you must know what the string key (or property) is that refers to this locations. Header files containing known keys are listed in the Known Locations section of this document. Bear in mind that this list is not static. ...
...l Get() passing the known string key. In the example below, prop is a string that references your requested file locations. ...
...1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsIFile); (The example is taken from the Code snippets section of this site.) Adding a location: There are currently two ways to add a file location to the directory service: directly and delayed. You can directly add a new nsIFile with any property string using the nsIProperties interface: Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .set("MyFileName", file); Now, if your cost is too high to set all of these properties at once, you can register to be a callback that can provide an nsIFile. To do this, you must get the implementation again like above. When you have it...
...And 3 more matches
Debugger.Environment - Firefox Developer Tools
if the debugger encounters the same environment through two different routes (perhaps two functions have closed over the same environment), SpiderMonkey presents the same Debugger.Environment instance to the debugger each time. ...
...Environment instances refer to the same environment in the debuggee, and place its own properties on a Debugger.Environment instance to store metadata about particular environments. (If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Environment instance for a given environment. 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.) If a Debugger.Environment instance's referent is not a debuggee environment, then attempting to access its properties (other than inspectable) or call any its methods throws an instance of Error. Debugger.Environment instances protect their referents from the garbage collector; as long as th...
...s not a debuggee environment, then attempting to access its properties (other than inspectable) or call any its methods throws an instance of Error. Debugger.Environment instances protect their referents from the garbage collector; as long as the Debugger.Environment instance is live, the referent remains live. Garbage collection has no visible effect on Debugger.Environment instances. Accessor Properties of the Debugger.Environment Prototype Object 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 th...
...And 3 more matches
Index - Firefox Developer Tools
Toolbox Debug, Firefox, JavaScript The Browser Toolbox enables you to debug add-ons and the browser's own JavaScript code rather than just web pages like the normal Toolbox. The Browser Toolbox's context is the whole browser rather than just single page on a single tab. 16 DOM Property Viewer DOM, Tools, Web Development The DOM Property Viewer lets you inspect the properties of the DOM as an expandable tree structure, starting from the window object of the current page or the selected iframe. 17 Debugger-API Debugger, Intermediate, Intro, JavaScript, Tools Mozilla's JavaScript engine, SpiderMonkey, provides a debugging interface named Debugger which lets JavaScript code observe and manipulate the execution of other JavaScript code. Both Firefox's...
... find the lexical environment in which the execution is taking place, and so on. 21 Debugger.Memory The Debugger API can help tools observe the debuggee's memory use in various ways: 22 Debugger.Object A Debugger.Object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. The referent's properties do not appear directly as properties of the Debugger.Object instance; the debugger can access them only through methods like Debugger.Object.prototype.getOwnPropertyDescriptor and Debugger.Object.prototype.defineProperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. 23 Debugger.Script A Debugger.Script instance may refer to a s...
...locations Per Call Path Debugger, Tools, Tutorial This page shows how to use the Debugger API to show how many objects a web page allocates, sorted by the function call path that allocated them. 27 Debugger.Object A Debugger.Object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. The referent's properties do not appear directly as properties of the Debugger.Object instance; the debugger can access them only through methods like Debugger.Object.prototype.getOwnPropertyDescriptor and Debugger.Object.prototype.defineProperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. 28 Deprecated tools Deprecated, Tools Over the course of DevToo...
...And 3 more matches
Document - Web APIs
Web › API › Document
Depending on the document's type (e.g. HTML, XML, SVG, ...), a larger API is available: HTML documents, served with the "text/html" content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocument interface. Constructor Document() Creates a new Document object. Properties This interface also inherits fro...
...nt interface describes the common properties and methods for any kind of document. Depending on the document's type (e.g. HTML, XML, SVG, ...), a larger API is available: HTML documents, served with the "text/html" content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocument interface. Constructor Document() Creates a new Document object. Properties This interface also inherits from the Node and EventTarget interfaces. Document.anchorsRead only Returns a list of all of the anchors in the document. Document.body Returns the <body> or <frameset> node of the current document. Document.characterSetRead only Returns the character set being used by the document. Document.compatMode Read only Indicates whether the document is rendere...
...which the document was last modified. Document.locationRead only Returns the URI of the current document. Document.readyStateRead only Returns loading status of the document. Document.referrerRead only Returns the URI of the page that linked to this page. Document.title Sets or gets the title of the current document. Document.URLRead only Returns the document location as a string. Properties included from DocumentOrShadowRoot The Document interface includes the following properties defined on the DocumentOrShadowRoot mixin. Note that this is currently only implemented by Chrome; other browsers still implement them directly on the Document interface. DocumentOrShadowRoot.activeElementRead only Returns the Element within the shadow tree that has focus. Document.fullscreenElement...
...And 3 more matches
Element.getBoundingClientRect() - Web APIs
-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 top-left of the viewport. Empty border-boxes are completely ignored. If all the element's border-boxes are empty, then a rectangle is returned 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 elemen...
...o 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). ...
...lling 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 scrolling position. Cross-browser fallback Scripts requiring high cross-browser compatibility can use window.pageXOffset and window.pageYOffset instead of window.scrollX and window.scrollY. ...
...And 3 more matches
HTMLAnchorElement - Web APIs
The HTMLAnchorElement interface represents hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. This interface corresponds to <a> element; not to be confused with <link>, which is represented by HTMLLinkElement) <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" /><t...
... 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 ...
... 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 ...
...And 3 more matches
HTMLElement - Web APIs
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. HTM...
... 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.contentEdita...
...er. HTMLElement.offsetParent Read only Returns a Element that is the element from which all offset calculations are currently computed. HTMLElement.offsetTop Read only Returns a double, the distance from this element's top border to its offsetParent's top border. HTMLElement.offsetWidth Read only Returns a double containing the width of an element, relative to the layout. HTMLElement.properties Read only Returns a HTMLPropertiesCollection... HTMLElement.spellcheck Is a Boolean that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them. HTMLElement.style Is a CSSStyleDeclaration, an object representing the declarations of an element's style attributes. HTMLOrForeignElement.tabIndex Is a long representing the position of the ...
...And 3 more matches
HTMLIFrameElement - Web APIs
The HTMLIFrameElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. <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="#4D4E53" text-anchor="middle" alignment-bas...
... 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...
... 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. HTMLI...
...And 3 more matches
MediaTrackConstraints - Web APIs
retrieved by calling getConstraints(). For each constraint, you can typically specify an exact value you need, an ideal value you want, a range of acceptable values, and/or a value which you'd like to be as close to as possible. The specifics vary somewhat depending on the type of the constrainable property. To learn more about how constraints work, see Capabilities, constraints, and settings. Properties Some combination--but not necessarily all--of the following properties will exist on the object. This may be because a given browser doesn't support the property, or because it doesn't apply. 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 gr...
...ombination--but not necessarily all--of the following properties will exist on the object. This may be because a given browser doesn't support the property, or because it doesn't apply. 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. ...
... channelCount A ConstrainLong specifying the channel count or range of channel counts which are acceptable and/or required. ...
...And 3 more matches
PerformanceNavigationTiming - Web APIs
For example, this interface can be used to determine how much time it takes to load or unload a document. ...
... PerformanceEntry.name Read only Returns the document's address. PerformanceEntry.startTime Read only Returns a DOMHighResTimeStamp with a value of "0". PerformanceEntry.durati...
... 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 ...
...And 3 more matches
Performance API - Web APIs
e 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 returns a PerformanceTiming object containing latency-related performance information such as the start of navigation time, start and end times for redirects, start and end times for responses, etc. The navigation property returns a PerformanceNavigation object representing the type of navigation that occurs in the given browsing...
...as the start of navigation time, start and end times for redirects, start and end times for responses, etc. The navigation property returns a PerformanceNavigation object representing the type of navigation that occurs in the given browsing context, such as the page was navigated to from history, the page was navigated to by following a link, etc. Interfaces Performance Provides methods and properties containing timing-related performance information for the given page. PerformanceEntry Provides methods and properties the encapsulate a single performance metric that is part of the performance timeline. PerformanceFrameTiming Provides methods and properties containing frame timing data about the browser's event loop. PerformanceMark An abstract interface for performance entries with an en...
...a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. PerformanceMeasure An abstract interface for performance entries with an entry type of "measure". Entries of this type are created by calling performance.measure() to add a namedDOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. ...
...And 3 more matches
Using the Resource Timing API - Web APIs
The Resource Timing API provides a way to retrieve and analyze detailed network timing data regarding the loading of an application's resource(s). An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource such as an XMLHttpRequest, <SVG>, image, script, etc.). The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc. The interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. This document shows the use of Resource Timing interfaces. For more details about the i...
...he See also section. A live version of the examples is available 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. ...
...on, DNS lookup, and TCP connection setup. Those phases and their property names are illustrated in Figure 1. Figure 1. Resource timing properties An application developer can use the property values to calculate the length of time a phase takes and that information can help diagnose performance issues. Timing resource loading phases The following example illustrates using the resource timing properties to calculate the amount of time the following phases take: redirection (redirectStart and redirectEnd ), DNS lookup (domainLookupStart and domainLookupEnd), TCP handshake (connectStart and connectEnd), and response (responseStart and responseEnd). This example also calculates the time from the start of the fetch and request start phases (fetchStart and requestStart, respectively), until the respo...
...And 3 more matches
::first-letter (:first-letter) - CSS: Cascading Style Sheets
low.) A combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element. In that case, ::first-letter will match the first letter of this generated content. CSS3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-letter, introduced in CSS2. ...
...eudo-element and the content property may inject some text at the beginning of the element. In that case, ::first-letter will match the first letter of this generated content. CSS3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-letter, introduced in CSS2. ...
... of the element. In that case, ::first-letter will match the first letter of this generated content. CSS3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-letter, introduced in CSS2. ...
...And 3 more matches
Coordinate systems - CSS: Cascading Style Sheets
ttom-left corner, with positive y-coordinate values being above the origin. 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. It's actually possible to change the definitions and orientations of these coordinate systems using CSS properties such as transform. However, we'll only talk about the standard coordinate system for now. Standard CSSOM coordinate systems There are four standard coordinate systems used by the CSS object model, as described below. Offset Coordinates specified using the "offset" model use the top-left corner of the element being examined, or on which an event has occurred. For example, when a mouse event ...
...for now. Standard CSSOM coordinate systems There are four standard coordinate systems used by the CSS object model, as described below. Offset Coordinates specified using the "offset" model use the top-left corner of the element being examined, or on which an event has occurred. For example, when a mouse event occurs, the position of the mouse as specified in the event's offsetX and offsetY properties are given relative to the top-left corner of the node to which the event has been delivered. The origin is inset by the distances specified by padding-left and padding-top. Client The "client" coordinate system uses as its origin the top-left corner of the viewport or browsing context in which the event occurred. This is the entire viewing area in which the document is presented. Scrolling is n...
...e origin is inset by the distances specified by padding-left and padding-top. Client The "client" coordinate system uses as its origin the top-left corner of the viewport or browsing context in which the event occurred. This is the entire viewing area in which the document is presented. Scrolling is not a factor. On a desktop computer, for example, the MouseEvent.clientX and MouseEvent.clientY properties indicate the position of the mouse cursor at the moment the event occurred, relative to the top-left corner of the browser window. The top-left corner of the window is always (0, 0), regardless of the content of the document or any scrolling that may have been done. In other words, scrolling the document will change the client coordinates of a given position within the document. Page The "page"...
...And 3 more matches
Box alignment in grid layout - CSS: Cascading Style Sheets
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. ...
...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 a horizontal language such as English or Arabic the inline direction runs horizontally. Should you be in a vertical writing mode the inline axis will run vertically. To align things on the inline axis you use the properties that start with justify-, justify-content, justify-items and justify-self. The block axis crosses the inline axis in the direction that blocks are displayed down the page -- for example paragraphs in English are displayed one below the other vertically. This, therefore is the block dimension. ...
...To align things on the inline axis you use the properties that start with justify-, justify-content, justify-items and justify-self. The block axis crosses the inline axis in the direction that blocks are displayed down the page -- for example paragraphs in English are displayed one below the other vertically. This, therefore is the block dimension. To align things on the block axis you use the properties that start with align-, align-content, align-items and align-self. Self alignment justify-self align-self place-self justify-items align-items place-items These properties deal with aligning the item inside the grid area 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...
...And 3 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
To center our box we use the align-items property to align our item on the cross axis, which in this case is the block axis running vertically. ...
... use the align-items property to align our item on the cross axis, which in this case is the block axis running vertically. We use justify-content to align the item on the main axis, which in this case the inline axis running horizontally. You can take a look at the code of this example below. Change the size of the container or nested element and the nested element always remains centered. Properties that control alignment The properties we will look at in this guide are as follows. justify-content -- controls alignment of all items on the main axis. align-items -- controls alignment of all items on the cross axis. align-self -- controls alignment of an individual flex item on the cross axis. align-content -- described in the spec as for "packing flex lines"; controls space between fle...
...f all items on the main axis. align-items -- controls alignment of all items on the cross axis. align-self -- controls alignment of an individual flex item on the cross axis. align-content -- described in the spec as for "packing flex lines"; controls space between flex lines on the cross axis. We will also discover how auto margins can be used for alignment in flexbox. Note: The alignment properties in Flexbox have been placed into their own specification -- CSS Box Alignment Level 3. It is expected that this spec will ultimately supersede the properties as defined in Flexbox Level One. The Cross Axis The align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column. We ...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
to different glyphs or character styles contained within an OpenType font. These include things like ligatures (special glyphs that combine characters like 'fi' or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. These are all referred to as OpenType Features, and are made available to use on the web via specific properties and a low-level control property -- font-feature-settings. This article provides you with all you need to know about using OpenType font features in CSS. Some fonts will have one or more of these features enabled by default (kerning and default ligatures are common examples), while others are left to the designer or developer to choose to enable in specific scenarios. In addition to broad featu...
...nt forms of certain glyphs, which can impact meaning and readability. In cases such as these it's more than just a nicety, but rather an integral part of the content itself. The font features There are a number of different features to consider. They are grouped and explained here according to the main attributes and options covered in the W3C specifications. Note: The examples below show the properties and some example combinations, along with the lower-level syntax equivalents. They may not match exactly due to browser implementation inconsistencies, but in many cases the first example will match the second. The typefaces shown are Playfair Display, Source Serif Pro, IBM Plex Serif, Dancing Script, and Kokoro (all available and free to use, most are on Google Fonts and other services). Kerni...
...f 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. 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...
...And 3 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
{ grid-column-start: 2; grid-column-end: 3; grid-row-start: 1; grid-row-end: 2; } .box4 { grid-column-start: 2; grid-column-end: 4; grid-row-start: 3; grid-row-end: 4; } The grid-column and grid-row shorthands We have quite a lot of code here to position each item. It should come as no surprise to know there is a shorthand. The grid-column-start and grid-column-end properties can be combined into grid-column, grid-row-start and grid-row-end into grid-row. * {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; backgro...
...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...
...he left-hand column line as inline-start is always the point from which text would be written in the current writing mode, inline-end is the final column line of our grid. When we specify our grid area using the grid-area property we first define both start lines block-start and inline-start, then both end lines block-end and inline-end. This seems unusual at first as we are used to the physical properties of top, right, bottom and left but makes more sense if you start to think of websites as being multi-directional in writing mode. Counting backwards We can also count backwards from the block and inline end of the grid, for English that would be the right hand column line and final row line. These lines can be addressed as -1, and you can count back from there - so the penultimate line is -2. I...
...And 3 more matches
border-block-end - CSS: Cascading Style Sheets
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. 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 ...
... 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 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. See border-style. <'color'> The color of the border. See color. Formal defi...
...ne-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. See border-style. <'color'> The color of the border. See color. ...
...And 3 more matches
border-color - CSS: Cascading Style Sheets
s a pull request. Each side can be set individually using border-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-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. ...
...er-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-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. ...
... 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 3 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. To tell the browser to use the whole available space on the screen, and so enabling us to use the env() variables, we need to add a 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...
...in Media query rules). As the spec evolves, it may also be usable in other places such as selectors. Originally provided by the iOS browser to allow developers to place their content in a safe area of the viewport, the safe-area-inset-* values ...
...ort, which is safe to put content into without risking it being cut off by the shape of a non-rectangular display. For rectangular viewports, like your average laptop monitor, their value is equal to zero. For non-rectangular displays -- like a round watch face -- the four values set by the user agent form a rectangle such that all content inside the rectangle is visible. Note: Unlike other CSS properties, user agent-defined property names are case-sensitive. Formal syntax env( <custom-ident> , <declaration-value>? ) Examples The below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available. <p> If the <code>env()</code> function is supported in your browser, this paragraph's text will have...
...And 3 more matches
DOM onevent handlers - Developer guides
Elements can be interactive (links, buttons, images, forms, and so forth) or non-interactive (such as the base <body> element). ...
... call the event handler directly. If the event handler doesn't access any data from the event object, you can leave out the event when calling onclick(). This continues until every handler has been called, unless one of the event handlers explicitly halts the processing of the event by calling stopPropagation() on the event object itself. Non-element objects Event handlers can also be set with properties on non-element objects that generate 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 ...
...(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 a...
...And 3 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
g custom elements for more details). 21 itemid Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference, itemid The itemid global attribute provides microdata in the form of a unique, global identifier of an item. 22 itemprop Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference The itemprop global attribute is used to add properties to an item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>...
.... Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. 23 itemref Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference Properties that are not descendants of an element with the itemscope attribute can be associated with an item using the global attribute itemref. 24 itemscope Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference itemscope is a boolean global attribute that defines the scope of associated metadata. Specifying the itemscope attribute for an element creates a new item, w...
...scope of associated metadata. Specifying the itemscope attribute for an element creates a new item, which results in a number of name-value pairs that are associated with the element. 25 itemtype Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference The global attribute itemtype specifies the URL of the vocabulary that will be used to define itemprop's (item properties) in the data structure. 26 lang Global attributes, HTML, Reference The lang global attribute 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)...
...And 3 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
e access can be chained together: obj.details.color; // orange obj['details']['size']; // 12 The following example creates an object prototype(Person) and an instance of that prototype(you). function Person(name, age) { this.name = name; this.age = age; } // Define an object var you = new Person('You', 24); // We are creating a new person named "You" aged 24. Once created, an object's properties can again be accessed in one of two ways: // dot notation obj.name = 'Simon'; var name = obj.name; And... // bracket notation obj['name'] = 'Simon'; var name = obj['name']; // can use a variable to define a key var user = prompt('what is your key?') obj[user] = prompt('what is its value?') These are also semantically equivalent. The second method has the advantage that the name of the prope...
... key var user = prompt('what is your key?') obj[user] = prompt('what is its value?') These are also semantically equivalent. The second method has the advantage that the name of the property is provided as a string, which means it can be calculated at run-time. However, using this method prevents some JavaScript engine and minifier optimizations being applied. It can also be used to set and get properties with names that are reserved words: obj.for = 'Simon'; // Syntax error, because 'for' is a reserved word obj['for'] = 'Simon'; // works fine Starting in ECMAScript 5, reserved words may be used as object property names "in the buff". This means that they don't need to be "clothed" in quotes when defining object literals. See the ES5 Spec. For more on objects and prototypes see Object.protot...
...ect prototype chains see Inheritance and the prototype chain. Starting in ECMAScript 2015, object keys can be defined by the variable using bracket notation upon being created. {[phoneType]: 12345} is possible instead of just var userPhone = {}; userPhone[phoneType] = 12345. Arrays Arrays in JavaScript are actually a special type of object. They work very much like regular objects (numerical properties can naturally be accessed only using [] syntax) but they have one magic property called 'length'. This is always one more than the highest index in the array. One way of creating arrays is as follows: var a = new Array(); a[0] = 'dog'; a[1] = 'cat'; a[2] = 'hen'; a.length; // 3 A more convenient notation is to use an array literal: var a = ['dog', 'cat', 'hen']; a.length; // 3 Note that ar...
...And 3 more matches
Indexed collections - JavaScript
employee number zero, emp[1] employee number one, and so on. JavaScript does not have an explicit array data type. However, you can use the predefined Array object and its methods to work with arrays in your applications. The Array object has methods for manipulating arrays in various ways, such as joining, reversing, and sorting them. It has a property for determining the array length and other properties for use with regular expressions. Creating an array The following statements create equivalent arrays: let arr = new Array(element0, element1, ..., elementN) let arr = Array(element0, element1, ..., elementN) let arr = [element0, element1, ..., elementN] element0, element1, ..., elementN is a list of values for the array's elements. When these values are specified, the array is initialized w...
...ate arrays with single elements of an arbitrary data type, it is safer to use array literals. Alternatively, create an empty array first before adding the single element to it. In ES2015, you can use the Array.of static method to create arrays with single element. let wisenArray = Array.of(9.3) // wisenArray contains only one element 9.3 Referring to array elements Because elements are also properties, you can access the using property accessors. Suppose you define the following array: let myArray = ['Wind', 'Rain', 'Fire'] You can refer to the first element of the array as myArray[0], the second element of the array as myArray[1], etc... The index of the elements begins with zero. Note: You can also use property accessors to access other properties of the array, like with an object. let...
... The length property is special. It always returns the index of the last element plus one. (In the example below, 'Dusty' is indexed at 30, so cats.length returns 30 + 1). Remember, JavaScript Array indexes are 0-based: they start at 0, not 1. This means that the length property will be one more than the highest index stored in the array: let cats = ...
...And 3 more matches
Regular expressions - JavaScript
sible (including look-ahead, look-behind, and conditional expressions). Character classes Distinguish different types of characters. For example, distinguishing between letters and digits. Groups and ranges Indicate groups and ranges of expression characters. Quantifiers Indicate numbers of characters or expressions to match. Unicode property escapes Distinguish based on unicode character properties, for example, upper- and lower-case letters, math symbols, and punctuation. If you want to look at all the special characters that can be used in regular expressions in a single table, see the following: Special characters in regular expressions. Characters / constructs Corresponding article \, ., \cX, \d, \D, \f, \n, \r, \s, \S, \t, \v, \w, \W, \0, \xhh, \uhhhh, \uhh...
...string. split() Uses a regular expression or a fixed string to break a string into an array of substrings. When you want to know whether a pattern is found in a string, use the test() or search() methods; for more information (but slower execution) use the exec() or match() methods. ...
...an array and update properties of the associated regular expression object and also of the predefined regular expression object, RegExp. If the match fails, the exec() method returns null (which coerces to false). In the following example, the script uses the exec() method to find a match in a string. var myRe = /d(b+)d/g; var myArray = myRe.exec('cdbbdbsbz'); If you do not need to access the properties of the regular expression, an alternative way of creating myArray is with this script: var myArray = /d(b+)d/g.exec('cdbbdbsbz'); // similar to "cdbbdbsbz".match(/d(b+)d/g); however, // "cdbbdbsbz".match(/d(b+)d/g) outputs Array [ "dbbd" ], while // /d(b+)d/g.exec('cdbbdbsbz') outputs Array [ 'dbbd', 'bb', index: 1, input: 'cdbbdbsbz' ]. (See different behaviors for further info ab...
...And 3 more matches
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
The Intl.NumberFormat.prototype.resolvedOptions() method returns a new object with 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. 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 requ...
... notation The value provided for this property in the options argument, if present, or "standard filled in as a default. ...
...s 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 property is only present if the notation is set to "compact". signDisplay The value provided for this property in the options argument, or "auto" filled in as a default. ...
...And 3 more matches
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 the no...
... In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object argument will be coerced to an object. ...
... In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object argument will be coerced to an object. ...
...And 3 more matches
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 making ...
...amples 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 making the set of properties on the object fixed and immutable. ...
...bj) 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 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. ...
...And 3 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 symbol,...
... Shared symbols in the global symbol registry The above syntax using the Symbol() function will not create a global symbol that is available in your whole codebase. To create symbols available across files and even across realms (each of which has its own global scope), use the methods Symbol.for() and Symbol.keyFor() to set and retrieve symbols from the global symbol registry. Finding symbol properties on objects The method Object.getOwnPropertySymbols() returns an array of symbols and lets you find symbol properties on a given object. Note that every object is initialized with no own symbol properties, so that this array will be empty unless you've set symbol properties on the object. Constructor Symbol() Creates a new Symbol object. It is incomplete as a constructor because it does not ...
...Used by for await...of. Symbol.hasInstance A method determining if a constructor object recognizes an object as its instance. Used by instanceof. ...
...And 3 more matches
delete operator - JavaScript
be returned. However, it is important to consider the following scenarios: If the property which you are trying to delete does not exist, delete will not have any effect and will return true. If a property with the same name exists on the object's prototype chain, then, after deletion, the object will use the property from the prototype chain (in other words, delete only has an effect on own properties). Any property declared with var cannot be deleted from the global scope or from a function's scope. As such, delete cannot delete any functions in the global scope (whether this is part from a function definition or a function expression). Functions which are part of an object (apart from the global scope) can be deleted with delete. Any property declared with let or const cannot be ...
...e or from a function's scope. As such, delete cannot delete any functions in the global scope (whether this is part from a function definition or a function expression). Functions which are part of an object (apart from the global scope) can be deleted with delete. Any property declared with let or const cannot be deleted from the scope within which they were defined. Non-configurable properties cannot be removed. This includes properties of built-in objects like Math, Array, Object and properties that are created as non-configurable with methods like Object.defineProperty(). The following snippet gives a simple example: var Employee = { age: 28, name: 'abc', designation: 'developer' } console.log(delete Employee.name); // returns true console.log(delete Employee.age); // ...
...ect.defineProperty(). ...
...And 3 more matches
Classes and Inheritance - Archive of obsolete content
Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. ...
...Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. ...
...ginal object. Every function has an explicit property, known as prototype. When a function is used in a constructor call, JavaScript makes the value of this property the prototype of the newly created object: let shape = Shape(2, 3); Object.getPrototypeOf(shape) == Shape.prototype; // => true All instances of a class have the same prototype. This makes the prototype the perfect place to define properties that are shared between instances of the class. To illustrate this, let's add a member function to the class Shape: Shape.prototype.draw = function () { throw Error("not yet implemented"); } let shape = Shape(2, 3); Shape.draw(); // => Error: not yet implemented Inheritance and Constructors Suppose we want to create a new class, Circle, and inherit it from Shape. Since every Circle is als...
...And 2 more matches
context-menu - Archive of obsolete content
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("img"); myMenuItem.context.add(context); myMenuItem.c...
... regexp or an array of match pattern strings or regexps. PredicateContext(predicateFunction) New in Firefox 29 Creates a context that occurs when predicateFunction returns a true value. See Specifying Contexts above. Parameters predicateFunction : function(context) A function which will be called with an object argument that provide information about the invocation context. context object properties: Property Description documentType The MIME type of the document the menu was invoked in. E.g. text/html for HTML pages, application/xhtml+xml for XHTML, or image/jpeg if viewing an image directly. documentURL The URL of the document the menu was invoked in. targetName The name of the DOM element that the menu was invoked on, in lower-case. ...
... input text box or area if the menu was invoked in one, null otherwise. Item A labeled menu item that can perform an action when clicked. Methods destroy() Permanently removes the item from its parent menu and frees its resources. The item must not be used afterward. If you need to remove the item from its parent menu but use it afterward, call removeItem() on the parent menu instead. Properties label The menu item's label. You can set this after creating the item to update its label later. image The item's icon, a string URL. The URL can be remote, a reference to an image in the add-on's data directory, or a data URI. You can set this after creating the item to update its image later. To remove the item's image, set it to null. data An optional arbitrary value to associate with th...
...And 2 more matches
remote/parent - Archive of obsolete content
consistency and to make writing multiprocess compatible code easier, remoteRequire() will also create a new module loader and load modules in the main process. Parameters id : String The module to load. To use a relative path you must pass the module parameter. module : Object The module to resolve the relative module ID against. To resolve relative to the loading module, pass module here. Properties processes A Processes object. frames A Frames object. Processes The Processes object lets you interact with the processes currently running. You can use it as a simple list of all running processes: const { processes } = require("sdk/remote/parent"); for (var p of processes) { console.log(p.isRemote); } Each element in this list is a Process. There will always be at least one process i...
...re started and stopped: const { processes } = require("sdk/remote/parent"); processes.on("attach", function(process) { console.log("new process is remote: " + process.isRemote); }); Methods forEvery(callback) Calls the callback for every existing process and any new processes created in the future. This is a shortcut for enumerating existing processes and then listening for attach events. Properties port An event emitter that sends messages to and receives messages from all processes. Events attach Event emitted when a new process is started. The event handler is called with a Process representing the new process. detach Event emitted when a process disconnects from the application. It may have been closed normally or it may have crashed. The event handler is called with the Process t...
...hear as frames are created and destroyed. const { frames } = require("sdk/remote/parent"); frames.on("attach", function(frame) { console.log("frame is attached: " + frame.frameElement); }); Methods forEvery(callback) Calls the callback for every existing frame and any new frames created in the future. This is a shortcut for enumerating existing frames and then listening for attach events. Properties port An event emitter that sends messages to and receives messages from all frames. Events attach Event emitted when a new frame is created. The event handler is called with a Frame representing the new frame. detach Event emitted when a frame is removed. For example, the user might have closed a content tab. The event handler is called with the Frame that detached. Process A Process pro...
...And 2 more matches
ui/frame - Archive of obsolete content
move. off(event, listener) This function is an alias for removeListener(). Parameters event : string The event the listener is listening for. Frame supports the following events: attach, detach, load, ready, and message. listener : function The listener to remove. destroy() Destroy the frame. After calling this function, the frame will no longer appear in the UI, and accessing any of its properties or methods will throw an error. Properties url URL for the content loaded into the frame. This is read-only. It's only accessible after the attach event has occurred for this frame. Events attach This event is emitted whenever a new frame instance is constructed and the browser has started to load its document: for example, when the user opens a new browser window, if that window has a tool...
...t: for example, when the user opens a new browser window, if that window has a toolbar containing this frame. Since the event is dispatched asynchronously, the document may already be loaded by the time the event is received. At this point, you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. Arguments event : This contains two properties: source, which defines a postMessage() function which you can use to send messages back to this particular frame instance. But note that at this point you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. origin, which you can use as the targetOrigin argument to postMessage() if you want to communicate with this particular fram...
...ources may still be in the process of loading. It's the equivalent of the point where the frame's document.readyState becomes "interactive": var { Frame } = require("sdk/ui/frame"); var frame = new Frame({ url: "./frame.html" }); frame.on("ready", ping); function ping(e) { // message only this frame instance e.source.postMessage("pong", e.origin); } Arguments event : This contains two properties: source, which defines a postMessage() function which you can use to send messages back to this particular frame instance. origin, which you can use as the targetOrigin argument to postMessage() if you want to communicate with this particular frame instance. load This event is emitted while a frame instance is completely loaded. It's the equivalent of the point where the frame's document.r...
...And 2 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
l-hbox'}, LABEL({'control': 'coord-x', 'value': 'X:'}), TEXTBOX({'id': 'coord-x', 'class': 'coord-box', 'placeholder' : '0'}), LABEL({'control': 'coord-y', 'value': 'Y:'}), TEXTBOX({'id': 'coord-y', 'class': 'coord-box', 'placeholder': '0'}) ... That way you build elements hierarchy with not much interaction with DOM, plus you can see tag properties and it children in a nice, structured way, just like in overlay.xul. You can find working example here. It involves using of firebug.sdk xul.js with few modifications. Step 7: Manually handle global CSS Stylesheets Any Global CSS style sheets which you are using will need to be registered upon load and unregistered when your extension is unloaded. Any CSS files used in any of your own XUL files...
...ion unloadFromWindow(window) { var event = window.document.createEvent("Event"); event.initEvent("myAddonName-unload",false,false); window.dispatchEvent(event); } In each window you can then register on startup to listen for your custom "myAddonName-unload" event and just tear down and clean up when that event or a regular "unload" event comes in. Step 10: Bypass cache when loading properties files The above will get you a working add-on that will install without a Firefox restart. It will even get you a working add-on that will update without a Firefox restart... usually. Some parts work only if you don't look too closely; localization is one of them. As mentioned in the previous section, you'll need to clear the chrome caches on add-on shutdown, namely for chrome images and propert...
... that will install without a Firefox restart. It will even get you a working add-on that will update without a Firefox restart... usually. Some parts work only if you don't look too closely; localization is one of them. As mentioned in the previous section, you'll need to clear the chrome caches on add-on shutdown, namely for chrome images and properties files. Doing this will get an update's new properties file to load, however sometimes this will instead produce an error on the next property access. It just doesn't seem that it can reliably clear the cache correctly, for whatever reason. String changes seem to be fine, however the addition or removal of strings can sometimes produce this error. It's not reliably reproducible, but it does happen. Yes, this is a pain in the ass. The suggestion that...
...And 2 more matches
The Essentials of an Extension - Archive of obsolete content
ags. The Chrome As mentioned earlier, the chrome is composed of 3 sections: content, locale and skin. The content is the most important section, holding user interface (XUL) and script (JS) files. The skin section has the files that define most of the look and feel of the UI (using CSS and images, just like web pages). Finally, the locale section holds all text used in the extension, in DTD and properties files. This division allows other developers to create themes that replace skins, and translators to create localizations in different languages, all of this without having to change your extension or your code. This gives Firefox extensions a great deal of flexibility. Chrome files are accessed through the chrome protocol. This is what a chrome URI looks like: chrome://packagename/section/pa...
...hat allows us to obtain localized strings dynamically, by only providing a "key" that identifies the string. This is what we do on the second line. We call the getString method of the bundle element and get the localized message to be displayed. We then call the window.alert function with the message, just like we would do in an HTML document. Locale There are two types of locale files: DTD and properties, and in this example we use them both. DTD is the most efficient way of showing text in XUL, so you should use it whenever possible. It is somewhat inflexible so it can't be used for dynamically generated text, hence the need for an alternate way of getting localized strings. Looking back at the menu code, you probably noticed some attributes such as this: label="&xulschoolhello.hello.label;"...
...There should only be one per document, which is the reason why we overlay the stringbundleset that is in browser.xul, hence the very generic id. We don't include the insertbefore or insertafter attributes because the ordering of string bundles doesn't make a difference. The element is completely i...
...And 2 more matches
Style System Overview - Archive of obsolete content
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. inherited: 'font-size', 'color', etc. "reset": 'border', 'background', etc. 1 matching rule: use value 2+ matching rules: cascade decides which wins: sort by origin (UA, user, author) & weight (!important), then specificity of selector, then order Example document source <doc> <ti...
...: 1em; } title { 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 ? ? ? ?
...ara: D ? ? quote: A quote: A ? span: E class="emph" The rule tree and style data All of the style structs that can be obtained through a style context add up to around 900 bytes. This is big, and slow to fill in. The rule tree allows sharing. To allow for optimizations, each style struct contains only inherited properties or only "reset" properties. (Thus these structs can be called inherited structs or reset structs.) In the normal case, a style rule has a small number of declarations (hitting only a small number of structs). The rule tree and style data We optimize for the structs for which the rules have no declarations. In this case: inherited structs: same value as parent style context (optimization br...
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
nt handlers. They must specifically pass the object on to the function called through an argument. A cross-browser event handling example follows (note that it means you can't define a global variable named event in your code): <div onclick="handleEvent(event);">Click me!</div> <script> function handleEvent(aEvent) { var myEvent = window.event ? window.event : aEvent; } </script> The properties and functions that the event object exposes are also often named differently in Mozilla and Internet Explorer, as Table 4 shows. Table 4. Event properties differences between Mozilla and Internet Explorer Internet Explorer Name Mozilla Name Description altKey altKey Boolean property that returns whether the alt key was pressed during the event. cancelBubbl...
... event. srcElement target The element to which the event was originally dispatched. toElement currentTarget For mouse events, this is the element to which the mouse moved. type type Returns the name of the event. Attach event handlers Mozilla supports two ways to attach events through JavaScript. The first, supported by all browsers, sets event properties directly on objects. To set a click event handler, a function reference is passed to the object's onclick property: <div id="myDiv">Click me!</div> <script> function handleEvent(aEvent) { // if aEvent is null, means the Internet Explorer event model, // so get window.event. var myEvent = aEvent ? aEvent : window.event; } function onPageLoad(){ document.getElementById("myD...
...handleEvent(aEvent) { // if aEvent is null, it is the Internet Explorer event model, // so get window.event. var myEvent = aEvent ? aEvent : window.event; } function onPageLoad() { var element = document.getElementById("myDiv"); element.addEventListener("click", handleEvent, false); } </script> One advantage of addEventListener() and removeEventListener() over setting properties is that you can have multiple event listeners for the same event, each calling another function. Thus, to remove an event listener requires all three parameters be the same as the ones you use when adding the listener. Mozilla does not support Internet Explorer's method of converting <script> tags into event handlers, which extends <script> with for and event attributes (see Table 5). It also do...
...And 2 more matches
Building Trees - Archive of obsolete content
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 norma...
...ri="?"> <treerow> <treecell 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. 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 checkb...
...than all of them. Once the row height is changed, we can see the full photos. Note: If you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to give each node a unique "id" attribute. These are used to track the current state of the disclosure triangles. Support for this was introduced in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4). Using Tree Properties Since we need to use special CSS for trees, the properties attribute on a cell becomes extremely useful. It can be used to define extra properties for reference later in a stylesheet. For example, if the properties attribute was set to the value "?creator", you could style the photos created by different people differently. Alternatively, you could also use static values (in addition to variable...
...And 2 more matches
Custom Tree Views - Archive of obsolete content
This example can be used for a tree with 10,000 rows. The contents of the cells in the first col...
... This example can be used for a tree with 10,000 rows. The contents of the cells in the first column will be set to the text 'Row X' where X is...
... This example can be used for a tree with 10,000 rows. The contents of the cells in the first column will be set to the text 'Row X' where X is the row number. The contents of the cells in the se...
...And 2 more matches
Element Positioning - Archive of obsolete content
w you to control the size of an element. The quick way is to simply add the width and height attributes on an element, much like you might do on an HTML img tag. An example is shown below: Example 1: Source View <button label="OK" width="100" height="40"/> However, it is not recommended that you do this. It is not very portable and may not fit in with some themes. A better way is to use style properties, which work similarly to style sheets in HTML. The following CSS properties can be used. width This specifies the width of the element. Note that the CSS global skin of the XUL application may also specify a min-width for the buttons and other elements, thus if simply setting the width property does not set the button width as you expect, try also to modify the button min-width property. hei...
...an be used. width This specifies the width of the element. Note that the CSS global skin of the XUL application may also specify a min-width for the buttons and other elements, thus if simply setting the width property does not set the button width as you expect, try also to modify the button min-width property. height This specifies the height of the element. By setting either of the two properties, the element will be created with that width and height. If you specify only one size property, the other is calculated as needed. The size of these style properties should be specified as a number followed by a unit. Flexible elements The sizes are fairly easy to calculate for non-flexible elements. They simply obey their specified widths and heights, and if the size wasn't specified, the elem...
...et 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. The box the button is inside will also continue to grow, unless you set a maximum he...
...And 2 more matches
More Event Handlers - Archive of obsolete content
ent handler is passed an event object. In the attribute form of the event handler, the event object is an implied argument to the script code which can be referred to using the name 'event'. In the addEventListener form, the first argument passed to the listener function will be the event object. Other arguments can be passed to a listener function, if required. The event object has a number of properties which can be examined during an event. For a full list, see the reference. We already saw the event's target property in the last section. It holds a reference to the element where the event occurred. A similar property currentTarget holds the element that is currently having its event listeners handled. In the example below, currentTarget is always the vbox, whereas target would be the specific ...
...he mouse so you should avoid performing lengthy tasks from this handler. mouseout Called when the mouse pointer is moved off of an element. You might then unhighlight the element or remove status text. There are also a set of drag related events, which occur when the user holds down a mouse button and drags the mouse around. Those events are described in Drag and Drop. Mouse Button Event Properties When a mouse button event occurs, a 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 v...
...een clicked quickly in sequence. This allows you to check for single, double or triple clicks. Of course, if you just want to check for double clicks, you can also use the dblclick event instead. The click event will be fired once for the first click, again for the second click, and again for the third click, but the dblclick event will only be fired once for a double click. ...
...And 2 more matches
notificationbox - Archive of obsolete content
Typically the element will be a browser, but any element may be used. The notification element is used for each notification, and will be created automatically for each item. Each notification will slide in and out as needed. This element is used, for example, to implement the yellow information bar in various Firefox windows. The notification box is a vertical box which may have children. The notifications appear at the top of the box. The notifications may be placed at the bottom by setting the dir attribute to reverse. ...
...he web content window for the tab you want to find the notification box for. Also it is possible to call function with the same 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. ...
...This property is read-only. allNotifications Type: nodeList NodeList of all notifications. This property is read-only. notificationsHidden Type: boolean Indicating whether the notification area should be hidden. Events AlertActive Type: Event Fired when...
...And 2 more matches
tabbrowser - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used for holding a set of read-only views of Web documents. It is similar to the browser element, except that multiple documents can be displayed, each in a separate tab. Note: Starting in Firefox 3 (XULRunner/Gecko 1.9), this is only used in the main Firefox window and cannot be used in other XUL windows by third-party applications or extensions. ...
... can be displayed, each in a separate tab. Note: Starting in Firefox 3 (XULRunner/Gecko 1.9), this is only used in the main Firefox window and cannot be used in other XUL windows by third-party applications or extensions. ...
...nt area in the tabbrowser. onbookmarkgroup Not in Firefox Type: script code This code executes when the user chooses the "Bookmark this Group of Tabs" command. onnewtab Not in Firefox Type: script code This script will be called when the new tab button is clicked. tabmodalPromptShowing Type: integer The number of tab modal prompts currently attached to the current tab. Properties browsers Type: nodelist of browser elements Holds a list of the browser elements inside the tabbrowser. canGoBack Type: boolean This read-only property is true if there is a page to go back to in the session history and the Back button should be enabled. canGoForward Type: boolean This read-only property is true if there is a page to go forward to in the sessio...
...And 2 more matches
CSS - Archive of obsolete content
Archive › Web › CSS
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-content-zoom-snap CSS shorthand property is a Microsoft extension that specifies va...
... 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-zoomingThe -ms-content-zooming CSS property is a Microsoft extension that specifi...
...If the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated.-ms-h...
...And 2 more matches
Reference - Archive of obsolete content
I also just read a document on proper inheritance using apply(). ...
...tance and ofcourse Function == Object return false ;) and the following statements also tells me that Function == Object although Math is only an instance of Object... which basicly says Function != Object alert(Function instanceof Object) //true alert(Object instanceof Function) //true alert(Math instanceof Object) //true alert(Math instanceof Function) //false note that the Methods and properties for Object in this reference are also available for Function and vice versa ... Actual Question so my question is , what the heck is going on here ... IS Function same as Object. is Function an instance of Object or is Object an instace of Function ? note that the Methods and properties for Object in this reference are also available for Function and vice versa ... --Aaike82 18:54, 18 August...
...oduced, and why you can infinitely do Function.constructor; //Function Function.constructor.constructor; //Function . . . Function.constructor.constructor.constructor.constructor.constructor . . . ; //Function Note that Math is not a constructor function, but merely a global object with methods and properties useful to perform various mathematical operations. This is why Math instanceof Object evaluates to true, but Math instanceof Function does not. Compare this to the Date object. Like Math, Date is a global object that contains useful methods (Date.parse() and Date.UTC()). In addition to this, however, Date is also a constructor function: it constructs objects of the class Date, and thus is an inst...
...And 2 more matches
Windows Media in Netscape - Archive of obsolete content
s them in detail. GeckoActiveXObject vs. ActiveXObject Both GeckoActiveXObject and ActiveXObject work very similarly, with one key difference: Both take a Programmatic ID (ProgID) and use it to create a reference to the Windows Media Player. The ProgID of Windows Media Player is MediaPlayer.MediaPlayer.1. While the ProgID cannot be used to create a Windows Media Player object that exposes all its properties and methods, it is useful for rapid detections. Here is a code snippet that shows this: var player; try { if (window.ActiveXObject) { player = new ActiveXObject("MediaPlayer.MediaPlayer.1"); } else if (window.GeckoActiveXObject) { player = new GeckoActiveXObject("MediaPlayer.MediaPlayer.1"); } else { // Plugin code using navigator.mimeTypes player = navigator.mimeTypes["appl...
...echanisms won't work owing to a bug in Netscape 7.1. Both ActiveXObject and GeckoActiveXObject can take WMPlayer.OCX.7 as an argument to create the control if Windows Media Player 7 or 9 are present. Unlike using the ProgID as an argument, using WMPlayer.OCX.7 as an argument to both these APIs creates a fully usable reference to the Windows Media Player 7 or 9 control, with all the methods and properties exposed to JavaScript. Furthermore, you know for certain that you are working with the Windows Media 7 or 9 control -- there is no comparable instantiation for the Windows Media Player 6 control. For the sake of brevity, we've made the following code snippet shorter to illustrate the relevant points about the API: var player; try { if(window.ActiveXObject) { player = new ActiveXObject("WM...
...eries SDK. In Netscape 7.1, the codebase attribute of the object element cannot be used to initiate a digitally signed download of the Windows Media control, if it is not present on the machine. The section below on scripting the control covers more on how to detect if the Windows Media Player has not been successfully created. Scripting the Windows Media Player Control The number of methods and properties that are exposed by the Windows Media Player, including the events that the player throws for handling by scripts in the web page containing the control, are covered in detail by the Windows Media Player SDK. This section covers relevant issues concerning the invocation of methods and properties from within web pages that are embedding the Windows Media control. Detecting Successful Creation of t...
...And 2 more matches
Grids - Learn web development
ner"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> <div>Six</div> <div>Seven</div> </div> Note: The fr unit distributes available space, not all space. Therefore if one of your tracks has something large inside it there will be less free space to share out. Gaps between tracks To create gaps between tracks we use the properties grid-column-gap for gaps between columns, grid-row-gap for gaps between rows, and grid-gap to set both at once. .container { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; } These gaps can be any length unit or a percentage, but not an fr unit. Simple Grid Example with fr units body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 Aria...
... .container { display: grid; grid-template-columns: 2fr 1fr 1f...
... .container { 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. ...
...And 2 more matches
How CSS is structured - Learn web development
with CSS. The 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 ...
...declaration. CSS declarations are found within CSS Declaration Blocks. In the example below, highlighting identifies the CSS declaration block.. Finally, CSS declaration blocks are paired with selectors to produce CSS rulesets (or CSS rules). The example below contains two rules: one for the h1 selector and one for the p selector. The colored highlighting identifies the h1 rule. Setting CSS properties to specific values is the primary way of defining layout and styling for a document. The CSS engine calculates which declarations apply to every single element of a page. Important: CSS properties and values are case-sensitive. The property and value in each pair is separated by a colon. (:) Look up different values of properties listed below. Write CSS rules that apply styling to different H...
... calculation isn't something that can be computed in advance and entered as a static value. Another example would be the various values for transform, such as rotate(). <div class="box"></div> .box { margin: 30px; width: 100px; height: 100px; background-color: rebeccapurple; transform: rotate(0.8turn) } The output from the above code looks like this: Look up different values of properties listed below. Write CSS rules that apply styling to different HTML elements: transform background-image, in particular gradient values color, in particular rgb/rgba/hsl/hsla values @rules CSS @rules (pronounced "at-rules") provide instruction for what CSS should perform or how it should behave. Some @rules are simple with just a keyword and a value. For example, @import imports a styles...
...And 2 more matches
create fancy boxes - Learn web development
hallenging because of annoying constraints and crazy freedom in the use of CSS. Let's do some fancy boxes. Before we start getting into the practical side of it, make sure you are familiar with the CSS box model. It's also a good idea, but not a prerequisite, to be familiar with some CSS layout basics. On the technical side, Creating fancy boxes are all about mastering CSS border and background properties and how to apply them to a given box. But beyond the technics its also all about unleashing your creativity. It will not be done in one day, and some web developers spend their whole life having fun with it. We are about to see many examples, but we will always work on the most simple piece of HTML possible, a simple element: <div class="fancy">Hi! I want to be fancy.</div> Ok, that's a very s...
... your creativity. It will not be done in one day, and some web developers spend their whole life having fun with it. We are about to see many examples, but we will always work on the most simple piece of HTML possible, a simple element: <div class="fancy">Hi! I want to be fancy.</div> Ok, that's a very small bit of HTML, what can we tweak on that element? All of the following: Its box model properties: width, height, padding, border, etc. Its background properties: background, background-color, background-image, background-position, background-size, etc. Its pseudo-element: ::before and ::after and some aside properties like: box-shadow, transform, outline, etc. So we have a very large playground. Let the fun begin. Box model tweak The box model alone allows us to do some basic stuff, l...
... Making circles <div class="fancy">Hi! I want to be fancy.</div> This is something that is both very simple and very fun. ...
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
place your previous function with the following: function Person(name) { this.name = name; this.greeting = function() { alert('Hi! I\'m ' + this.name + '.'); }; } The constructor function is JavaScript'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 -...
...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...
...st + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.'); }; this.greeting = function() { alert('Hi! I\'m ' + this.name.first + '.'); }; } Now add in the following line below it, to create an object instance from it: let person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']); You can now see that you can access the properties and methods just like we did previously -- try these in your JS console: person1['age'] person1.interests[1] person1.bio() // etc. Note: If you are having trouble getting this to work, try comparing your code against our version -- see oojs-class-finished.html (also see it running live). Further exercises To start with, try adding a couple more object creation lines of your own, and try get...
...And 2 more matches
Mozilla’s UAAG evaluation report
Does not contradict current specifications for HTML and CSS rendering. 2.2 Provide text view. (P1) C Also known as view source. 2.3 Render conditional content. (P1) VG ALT for IMG: rendered when images turned off. See meta bug 41924 for open issues with the ALT attribute. TITLE for *any* element: rendered as tooltip LONGDESC for IMG element: in context menu - properties content of OBJECT element: ? ALT for AREA element: ? ALT for INPUT element: ? ACRONYM element: supported ABBR element: supported ABBR attribute for TD/TH: not supported SUMMARY for TABLE: supported TITLE for FRAME: ? LONGDESC for FRAME: Not supported, see Bug 3658 NOFRAME for FRAME: Must use user style sheets to render this. A UI for this would be good. ...
...sider this to be a very difficult problem. 2.8 No repair text. (P3) P We have no repair strategy in 2.7 We have no way to configure that alt="" still needs to be repaired 2.9 Render conditional content automatically. (P3) G ALT for IMG: rendered when images turned off TITLE for *any* element: rendered as tooltip LONGDESC for IMG element: in context menu - properties content of OBJECT element: ? ALT for AREA element: ? ALT for INPUT element: ? ACRONYM element: supported ABBR element: supported ABBR attribute for TD/TH: not supported SUMMARY for TABLE: supported TITLE for FRAME: ? LONGDESC for FRAME: Not supported, see Bug 3658 NOFRAME for FRAME: Must use user style sheets to render this. A UI for this would be good. ...
...): Available through DOM HTML: HEADERS attribute (TABLE): Available through DOM HTML: AXIS attribute (TABLE): Available through DOM HTML: TABINDEX attribute: yes, can be used to order sequential navigation HTML: ACCESSKEY attribute: Supported with ALT-{key}, menu key conflict favor the accesskey? HTML: ALT for IMG: yes HTML: LONGDESC for IMG: yes, available in context menu properties HTML: ALT for AREA: ? HTML: ALT for INPUT: ? CSS: TEXT-INDENT: yes CSS: TEXT-ALIGN: yes CSS: WORD-SPACING: yes CSS: LETTER-SPACING: yes CSS: FONT-STRETCH: NI CSS: MARGIN: yes CSS: FLOAT: yes CSS: POSITION: yes CSS: !IMPORTANT: yes CSS: SYSTEM FONTS: yes CSS: SYSTEM COLORS: yes CSS: list types: yes CSS: OUTLINE: no CSS: :before, :afte...
...And 2 more matches
Eclipse CDT Manual Setup
cting an appropriate directory, click OK, then close the "Welcome" tab when the main Eclipse window opens. Before you proceed any further, check that your changes to Eclipse's memory limits have taken effect and are present in Eclipse/Help > About Eclipse > Installation Details > Configuration. To avoid confusion in this and the following sections, note that "workspace preferences" and "project properties" are different things (we'll get to the details below). Whenever you create a new workspace for a Mozilla source tree, you should be sure to turn off the following two settings in the workspace preferences (Window > Preferences, or Eclipse > Preferences) before creating a project in that workspace: in "General > Workspace", disable "Build automatically" in "C/C++ > Indexer", disable "Automat...
...ree). Click on the little green button beside this message to open the "Progress" tab, and keep an eye on the "Refreshing workspace" item as you continue with the steps below. (If an "indexing" item starts after the "Refreshing the workspace" item has finished, click the little red box beside that item to cancel it, since we want to configure the project before the indexer runs.) Initial project properties So that the indexer will run faster and give better results, and so that Eclipse doesn't give results for irrelevant files, you should add some resource filters to have Eclipse ignore certain non-source files and directories. Note, you must not make Eclipse ignore your (main) object directory. That object directory is needed to resolve include paths to the various headers that the build process ...
...that Eclipse doesn't give results for irrelevant files, you should add some resource filters to have Eclipse ignore certain non-source files and directories. Note, you must not make Eclipse ignore your (main) object directory. That object directory is needed to resolve include paths to the various headers that the build process generates/copies there. To create resource filters, open the project properties (different to the workspace preferences!) by selecting Properties from the context menu for the project (root item) in the Project Explorer tab on the left, or by selecting Project > Properties from the menubar. Select "Resource > Resource Filters" on the left of the window that opens, then use the Add button to add the following filters: Add an "Exclude all" filter for folders with a Project ...
...And 2 more matches
Download
persisted across sessions. A new Download object can be created using the Downloads.createDownload() function. Method overview Promise start(); Promise launch(); Promise showContainingDirectory(); Promise cancel(); Promise removePartialData(); Promise whenSucceeded(); Promise finalize([optional] boolean aRemovePartialData); Properties Attribute Type Description canceled Read only boolean Indicates that the download has been canceled. This property can become true, then it can be reset to false when a canceled download is restarted. This property becomes true as soon as the cancel() method is called, though the stopped property might remain false until the cancellation request has been ...
...d 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 download fails, this is set to a DownloadError instance indicating the cause of the failure. If the download has been completed successfully or has been canceled, this property is null. This property is reset to null when a failed download is restart...
...get 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 the default application associated with the contentType property or the extension of the target file. onchange Function This can be set to a function that is called after other properties change. Warning: This property cannot be used if the download is part of a DownloadList. progress Read only number Progress percent, from 0 to 100. Intermediate values are reported only if hasProgress is true. Note: You shouldn't rely on this property being equal to 100 to determine whether the download is completed. You should use the individual state...
...And 2 more matches
Localizing extension descriptions
f Mozilla add-ons, as well as for other metadata about your add-on. Because a new method for doing so was implemented in Gecko 1.9 (Firefox 3), there are two sets of instructions below. Localizing in Gecko 1.9 Gecko 1.9 includes a new, more robust method for localizing add-on descriptions and other metadata. All of the different descriptions now appear in the install.rdf file using em:localized properties. ...
...ncludes a new, more robust method for localizing add-on descriptions and other metadata. All of the different descriptions now appear in the install.rdf file using em:localized properties. Each has at least one em:locale property marking the locale that the information should be used for and then all the various strings for the locale. ...
...ES and vice versa). If there is more than one locale with the same number of matching parts, then use the most general one (e.g., en in preference to en-GB when searching for en-US). The current app locale will be searched for and then there will be a fallback search for en-US. ...
...And 2 more matches
Localizing without a specialized tool
With that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. ...
...le in your x-testing directory and translate the words inside the quotation marks. Be sure to only translate what is in the quotation marks. For the purposes of this tutorial, we will just convert all letters to uppercase, so that the change is visible in the UI. <!ENTITY cmd_engineManager.label "MANAGE SEARCH ENGINES..."> <!ENTITY searchEndCap.label "SEARCH"> Save the file. .properties Files The property file "search.properties" contains the string "Add %S". This string can easily be found in the browser UI by visiting a website that provides a search plugin (like http://developer.mozilla.org/) and clicking on the drop-down arrow in the search box in the upper-right corner of your browser. At the second to bottom of the list of search engines that appears, you'll see, "Add %S...
... en-US source code (mozilla-1.9.2). You can do this by typing: cd ../../ where each ".." represents the prior sub directory before the main directory where you want to be. You can always check the path by typing pwd Once you are in the root working directory with both en-US source and the l10n base, copy the searchbar.dtd file by typing cp mozilla-1.9.2/browser/locales/chrome/browser/search.properties l10n-mozilla-1.9.2/x-testing/browser/chrome/browser/ Open that file and translate the strings that follow the "=". For instance, enter the proper translation for the line "Add %S" cmd_addFoundEngine=ADD "%S" With these two string examples translated, you can now test your work to see immediately where you have translated. Refer to the Building and Testing section of the Create a new localizatio...
...And 2 more matches
Mozilla Style System
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. ...
...StyleSet 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. ...
...ent, 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. ...
...And 2 more matches
Scripting Java
that matter). All the functionality covered in this chapter should thus be considered an extension. Accessing Java Packages 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 stepp...
...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 another convenience by allowing properties of JavaBeans to be accessed directly by their property names. A JavaBean property foo is defined by the methods getFoo and setFoo. Additionally, a boolean property of the same name can be defined by an isFoo method. For example, the following code actually calls the File object's getName and isDirectory methods. js> f.name test.txt js> f.directory false Calling Overloaded Methods The process ...
...g JavaScript argument types (number,number) is ambiguous; candidate methods are: class java.lang.String g(java.lang.String,int) class java.lang.String g(int,java.lang.String) See Java Method Overloading and LiveConnect 3 for a more precise definition of overloading semantics. Implementing Java Interfaces Now that we can access Java classes, create Java objects, and access fields, methods, and properties of those objects, we have a great deal of power at our fingertips. However, there are a few instances where that is not enough: many APIs in Java work by providing interfaces that clients must implement. One example of this is the Thread class: its constructor takes a Runnable that contains a single method run that will be called when the new thread is started. To address this need, Rhino provid...
...And 2 more matches
JSPropertyOp
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 within an active request on cx. The callback does not need to call JS_BeginRequest()). 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 m...
... may veto the ongoing property operation by optionally reporting an error or raising an exception and then returning false. The operation then fails, and the error is 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. The getter callback is called each time JavaScript code accesses the property's value using the syntax obj.prop or obj[propname]. It is also called when the property's value is accessed via JSAPI functions such as JS_GetProperty or (less obviously) JS_CallFunctionName. On entry, *vp contains the property's stored value or...
...th = x), is the value of *vp after the setter is called. This is typically the value of the left-hand side after assignment, as opposed to the value of the right-hand side, as required by ECMA 262-3 ?11.13. This ECMAScript incompatibility is observable when assigning to the length property of an Array, for example. This incompatibility will be fixed in SpiderMonkey 1.8; see bug 312354. Inherited properties. Note that in JavaScript, an object can inherit properties from its prototype. Getters (and sometimes setters; see JS_SetProperty for details) are called even when the property being accessed is found on a prototype and not on obj itself. In this case obj points to the object from which the property is being accessed, not the object on which the property was defined. JSClass hooks JSClass offer...
...And 2 more matches
JSAPI reference
type Added in SpiderMonkey 31 JS::IdentifyStandardConstructor Added in SpiderMonkey 38 Date JS_NewDateObject Added in SpiderMonkey 1.8.5 JS_NewDateObjectMsec Added in SpiderMonkey 1.8.5 JS_ObjectIsDate Added in SpiderMonkey 1.8.5 JS_ClearDateCaches Added in SpiderMonkey 17 JS_Now Intl API JS_SetDefaultLocale Added in SpiderMonkey 24 JS_ResetDefaultLocale Added in SpiderMonkey 24 Properties These functions correspond directly to the ways scripts access object properties: JS_GetProperty JS_GetUCProperty JS_GetPropertyById Added in SpiderMonkey 1.8.1 JS_SetProperty JS_SetUCProperty JS_SetPropertyById Added in SpiderMonkey 1.8.1 JS_HasProperty JS_HasUCProperty JS_HasPropertyById Added in SpiderMonkey 1.8.1 JS_HasOwnProperty Added in JSAPI 45 JS_HasOwnPropertyById Added in...
..."Define" is a lower-level version of "set" that provides access to extra settings and does not call setters. Similarly, "lookup" is a lower-level version of "get" that offers extra options and does not call getters. struct JSPropertyDescriptor Added in SpiderMonkey 1.8 Property attributes JSPROP_ENUMERATE JSPROP_READONLY JSPROP_PERMANENT JSPROP_PROPOP_ACCESSORS...
...ANENT Added in SpiderMonkey 38 JSPROP_IGNORE_VALUE Added in SpiderMonkey 38 JS_AlreadyHasOwnElement Added in SpiderMonkey 1.8 JS_AlreadyHasOwnProperty Added in SpiderMonkey 1.8 JS_AlreadyHasOwnUCProperty Added in SpiderMonkey 1.8 JS_AlreadyHasOwnPropertyById Added in SpiderMonkey 1.8.1 JS_DefineProperty JS_DefineUCProperty JS_DefinePropertyById Added in SpiderMonkey 1.8.1 JS_DefineProperties JS_Enumerate JS_ForwardGetPropertyTo Added in SpiderMonkey 17 JS_ForwardGetElementTo Added in SpiderMonkey 17 JS_GetPropertyDescriptor Added in SpiderMonkey 31 JS_GetPropertyDescriptorById Added in SpiderMonkey 1.8.1 JS_GetOwnPropertyDescriptor Added in SpiderMonkey 31 JS_GetOwnPropertyDescriptorById Added in SpiderMonkey 31 JS_GetOwnUCPropertyDescriptor Added in SpiderMonkey 45 JS_SetAl...
...And 2 more matches
Language bindings
llowing bridging layers are currently available: Components objectThe Components object is the object through which XPConnect functionality is reflected into JavaScript. The Components object is actually a native instance of the nsIXPCComponents interface which is reflected into JavaScript as a top level object using XPConnect.Components.classesComponents.classes is a read-only object whose properties are classes indexed by ContractID.Components.classesByIDComponents.classesByID is a read-only object whose properties are classes indexed by CID.Components.ConstructorCreates 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. These exception objects...
... objects. ...
...nsresult value) indicates the success or failure of an operation, returning true or false respectively.Components.lastResultComponents.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 pu...
...And 2 more matches
WebIDL bindings
xt*, JSObject*); bool IsLong() const; int32_t GetAsLong() const; int32_t& SetAsLong() Owning unions used on the stack should be declared as a RootedUnion<UnionType>, for example, RootedUnion<OwningObjectOrLong>. Date WebIDL Date types are represented by a mozilla::dom::Date struct. C++ reflections of WebIDL declarations WebIDL declarations (maplike/setlike/iterable) are turned into a set of properties and functions on the interface they are declared on. Each has a different set of helper functions it comes with. In addition, for iterable, there are requirements for C++ function implementation by the interface developer. Maplike Example Interface: interface StringToLongMap { maplike<DOMString, long>; }; The bindings for this interface will generate the storage structure for the map, as we...
...ngAlias=propName] This extended attribute can be specified on an attribute and indicates that another property with the specified name will also appear on the interface prototype object and will call the same underlying C++ implementation for the getter and setter. This is more efficient than using the same BinaryName for both attributes, because it shares the binding glue code between them. The properties still have separate getter/setter functions in JavaScript, so from the point of view of web consumers it's as if you actually had two separate attribute declarations on your interface. For example: interface MyInterface { [BindingAlias=otherAttr] readonly attribute boolean attr; }; MyInterface.prototype.otherAttr and MyInterface.prototype.attr will both exist, have separate getter/setter fun...
...nerate extra code to handle possible exceptions. Possibly-throwing methods and attributes get an ErrorResult& argument. [Throws] applies to both methods and attributes; for attributes it means both the getter and the setter can throw. [GetterThrows] applies only to attributes. [SetterThrows] applies only to non-readonly attributes. For interfaces flagged with [JSImplementation], all methods and properties are assumed to be able to throw and do not need to be flagged as throwing. [DependsOn] Used for a method or attribute to indicate what the return value depends on. Possible values are: Everything This value can't actually be specified explicitly; this is the default value you get when [DependsOn] is not specified. This means we don't know anything about the return value's dependencies and h...
...And 2 more matches
Debugger.Source - Firefox Developer Tools
serialized text of a block of WebAssembly code. The two cases are distinguished by the latter having its introductionType property always being "wasm" and the former having its introductionType property never being "wasm". Each Debugger instance has a separate collection of Debugger.Source instances representing the source code that has been presented to the system. A debugger may place its own properties on Debugger.Source instances, to store metadata about particular pieces of source code. Debugger.Source for JavaScript For a Debugger.Source instance representing a piece of JavaScript source code, its properties provide the source code itself as a string, and describe where it came from. Each Debugger.Script instance refers to the Debugger.Source instance holding the source code from which it ...
...sented to the JavaScript implementation more than once, with the same origin metadata, the JavaScript implementation may generate a fresh Debugger.Source instance to represent each presentation, or it may use a single Debugger.Source instance to represent them all. Debugger.Source for WebAssembly For a Debugger.Source instance representing the serialized text of a block of WebAssembly 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 descri...
...he 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 differ, no such emphasized headings will appear. Access...
...And 2 more matches
Examine and edit CSS - Firefox Developer Tools
n CSS and rules view features. You can: 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: nex...
..." under the developer tool settings panel. (Note that this setting is independent of the "Browser styles" checkbox in the Computed view.) User-agent styles are displayed against a different background, and the link to the filename and line number contains the prefix (user agent): element {} rule The element {} rule at the top of the rules list isn't actually a CSS rule. It represents the CSS properties assigned to the element via its style attribute. This also gets the target icon: , giving you a convenient way to highlight the currently selected element in the page. Filtering rules There's a box at the top of the Rules view labeled "Filter Styles": As you type: any rules which don't contain the typed string at all are hidden any declarations which contain the typed string are highlig...
...ove it again. Strict search By default, the search box highlights all declarations which contain any part of the string. For example, searching for "color" will highlight declarations containing border-bottom-color and background-color as well as just color.: If you enclose the search query in backticks, like this: `color`, the search is restricted to exact matches: Expanding shorthand properties Shorthand properties can be expanded to display their related longhand properties by clicking the arrow besides them. Displaying pseudo-elements The Rule view displays the following pseudo-elements, if they are applied to the selected element: ::after ::backdrop ::before ::first-letter ::first-line ::selection :-moz-color-swatch :-moz-number-spin-box :-moz-number-spin-down :-moz-numb...
...And 2 more matches
CSS Typed Object Model API - Web APIs
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. 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 CSSStyle...
...o the StylePropertyMap with the given property and value. StylePropertyMap.delete() Method that removes the CSS declaration with the given property from the StylePropertyMap. StylePropertyMap.clear() Method that removes all declarations in the StylePropertyMap. CSSUnparsedValue 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. CSSUnparsedValue.CSSUnparsedValue() constructor Creates a new CSSUnparsedValue object which represents property values that reference custom properties. CSSUnparsedValue.entries() Method returning 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 (t...
... CSSUnparsedValue.forEach() Method executing a provided function once for each element of the CSSUnparsedValue. ...
...And 2 more matches
HTMLAreaElement - Web APIs
The HTMLAreaElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. <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="#4D4E53" text-anchor="middle" alignm...
... Element.accessKey Is a DOMString containing a single character that switches input focus to the control. HTMLAreaElement.alt Is a DOMString that reflects the alt HTML attribute, containing alternative text for the element. HTMLAreaElement.coords Is a DOMString that reflects the coords H...
... Element.accessKey Is a DOMString containing a single character that switches input focus to the control. HTMLAreaElement.alt Is a DOMString that reflects the alt HTML attribute, containing alternative text for the element. HTMLAreaElement.coords Is a DOMString that reflects the coords HTML attribute, contai...
...And 2 more matches
HTMLBodyElement - Web APIs
The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121...
... HTMLBodyElement.aLink Is a DOMString that represents the color of active hyperlinks. HTMLBodyElement.background Is a DOMString that represents the description of the location of the background image resource. Note that this is not an URI, though some older version of some browsers do expect it. HTMLBodyElem...
... HTMLBodyElement.aLink Is a DOMString that represents the color of active hyperlinks. HTMLBodyElement.background Is a DOMString that represents the description of the location of the background image resource. Note that this is not an URI, though some older version of some browsers do expect it. HTMLBodyElement.bgColor Is a D...
...And 2 more matches
HTMLLinkElement - Web APIs
The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by HTMLAnchorElement). This object inherits all of the properties and methods of the HTMLElement interface. <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"...
... HTMLLinkElement.as Is a DOMString representing the type of content being loaded by the HTML link. HTMLLinkElement.crossOrigin Is a DOMString that corresponds to the CORS setting for this link element. See CORS settings attributes for details. HTMLLinkElement.disabled Is a Boolean which represents whether the link is dis...
... HTMLLinkElement.as Is a DOMString representing the type of content being loaded by the HTML link. HTMLLinkElement.crossOrigin Is a DOMString that corresponds to the CORS setting for this link element. See CORS settings attributes for details. HTMLLinkElement.disabled Is a Boolean which represents whether the link is disabled; currently only...
...And 2 more matches
HTMLScriptElement - Web APIs
JavaScript files should be served with the application/javascript MIME type, but browsers are lenient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. If the script is blocked, its element receives an error event; otherwise, it receives a load event. ...
... HTMLScriptElement.type Is a DOMString representing the MIME type of the script. It reflects the type attribute. HTMLScriptElement.src Is a DOMString representing the URL of an external script. It reflects the src attribute. HTMLScriptElement.event Is a DOMString; an obsolete way of registering event handlers on elements in an HTML doc...
... HTMLScriptElement.type Is a DOMString representing the MIME type of the script. It reflects the type attribute. HTMLScriptElement.src Is a DOMString representing the URL of an external script. It reflects the src attribute. HTMLScriptElement.event Is a DOMString; an obsolete way of registering event handlers on elements in an HTML document. HTMLScriptEl...
...And 2 more matches
HTMLTableCellElement - Web APIs
The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document. <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,monospa...
... 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 ...
... 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 accessibilit...
...And 2 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. For example, because RTP doesn't provide some of these values during negotiation of a WebRTC connect...
...The device ID is a origin-unique string identifying the source of the track; this is usually a GUID. ...
... devices for the speaker and microphone built into a phone would share the same group ID, since they're part of the same physical device. The microphone on a headset would have a different ID, though. This value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling MediaDevices.getUserMedia(). Properties of audio tracks autoGainControl A Boolean which indicates the current value of the autoGainControl property, which is true if automatic gain control is enabled and is false otherwise. channelCount A long integer value indicating the current value of the channelCount property, specifying the number of audio channels present on the track (therefore indicating how many audio samples exist in e...
...And 2 more matches
Using Performance Timeline - Web APIs
]); } // Use getEntriesByName() to get all "mark" entries named "Begin" p = performance.getEntriesByName("Begin", "mark"); for (var i=0; i < p.length; i++) { log ("Begin and Mark [" + i + "]"); print_perf_entry(p[i]); } } PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry i.e. a single performance metric. ...
...mance.getEntriesByName("Begin", "mark"); for (var i=0; i < p.length; i++) { log ("Begin and Mark [" + i + "]"); print_perf_entry(p[i]); } } PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry i.e. a single performance metric. This interface has four properties and a JSON serializer (toJSON(). The following example shows the use of these properties. ...
...i < p.length; i++) { log ("Begin and Mark [" + i + "]"); print_perf_entry(p[i]); } } PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry i.e. a single performance metric. This interface has four properties and a JSON serializer (toJSON(). The following example shows the use of these properties. ...
...And 2 more matches
SVGMeshElement - Web APIs
The SVGMeshElement interface provides access to the properties of <mesh> elements. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/SVGMeshElement" target="_top"><rect x="1" y="1" width="140" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="71" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGMeshElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGeometryElement, and implements the methods of SVGURIReference. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGeometryElement, and implements the methods of SVGURIReference. ...
...And 2 more matches
SVGPolygonElement - Web APIs
The SVGPolygonElement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25"...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGPolygonElement' in that specificatio...
...And 2 more matches
SVGPolylineElement - Web APIs
The SVGPolylineElement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,2...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGPolylineElement' in that specificati...
...And 2 more matches
Web audio spatialization basics - Web APIs
om (defined by the edges of the browser viewport), and in this demo, we can move and rotate it with the provided controls. When we move the boombox, the sound it produces changes accordingly, panning as it moves to the left or right of the room, or becoming quieter as it is moved away from the user or is rotated so the speakers are facing away from them, etc. This is done by setting the different properties of the PannerNode object instance in relation to that movement, to emulate spacialization. Note: The experience is much better if you use headphones, or have some kind of surround sound system to plug your computer into. Creating an audio listener So let's begin! The BaseAudioContext (the interface the AudioContext is extended from) has a listener property that returns an AudioListener objec...
...e 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 = 0; listener.forwardY.value = 0; listener.forwardZ.value = -1; listener.upX.value = 0; listener.upY.value = 1; listener.upZ.value = 0; The forward properties represent the 3D coordinate position of the listener's forward direction (e.g. 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. Creating a panner node Let's create our PannerNode. This has a whole bunch of properties associated with it. Let's take a look at each of ...
...thm that's used to position the audio in 3D space. We can set this to: equalpower -- The default and the general way panning is figured out HRTF -- This stands for 'Head-related transfer function' and looks to take into account the human head when figuring out where the sound is. Pretty clever stuff. Let's use the HRTF model! const pannerModel = 'HRTF'; The coneInnerAngle and coneOuterAngle properties specify where the volume emanates from. By default, both are 360 degrees. Our boombox speakers will have smaller cones, which we can define. The inner cone is where gain (volume) is always emulated at a maximum and the outer cone is where the gain starts to drop away. The gain is reduced by the value of the coneOuterGain value. Let's create constants that store the values we'll use for these para...
...And 2 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. ...
...ext 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. ...
...rit; -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 2 more matches
Handling content breaks in multicol - CSS: Cascading Style Sheets
In this guide we see how Fragmentation works in multicol. Fragmentation basics The CSS Fragmentation specification details how content breaks between the fragmentation containers, or fragmentainers. In multicol, the fragmentainer is the column box. A column box can contain other markup and there are many places where a break would not be ideal. ...
...ragmentation containers, or fragmentainers. In multicol, the fragmentainer is the column box. A column box can contain other markup and there are many places where a break would not be ideal. For example, we would generally prefer that the figcaption of an image not be separated into a new column away from the image it refers to and ending a column with a heading looks strange. The fragmentation properties give us ways to exercise some control over this. There are various places we might want to control our breaks: Breaks inside boxes, for example inside a figure element. Breaks before and after boxes, which would include our heading example above. Breaks between lines. Breaks inside boxes To control breaks inside boxes use the break-inside property. This property takes values of: auto ...
... Breaks between lines. Breaks inside boxes To control breaks inside boxes use the break-inside property. This property takes values of: auto avoid avoid-page avoid-column avoid-region In the example below, we have applied break-inside to the figure element to prevent the caption from becoming separated from the image. Breaks before and after boxes The break-before and break-after properties are used to control breaks before and after elements. They take the following values when in a multicol context: auto avoid avoid-column column In this next example, we are forcing a column break before an h2 element. Breaks between lines The orphans and widows properties are also useful. The orphans property controls the number of lines left on their own at the end of a fragment. The...
...And 2 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
In this guide we will be exploring the three properties that are applied to flex items, which enable us to control the size and flexibility of the items along the main axis -- flex-grow, flex-shrink, and flex-basis. Fully understanding how these properties work with growing and shrinking items is the real key to mastering flexbox. A first look Our three properties control the following aspects of a flex item's flexibility: flex-grow: How much of the positive free space does this item get? flex-shrink: How much negative free space can be removed from this item? flex-basis: What is the size of the item before growing and shrinking happens? The properties are usually expressed as the shorthand flex property. The following code would set the flex-grow property to 2, flex-shrink to 1 and flex-b...
...his item? flex-basis: What is the size of the item before growing and shrinking happens? The properties are usually expressed as the shorthand flex property. The following code would set the flex-grow property to 2, flex-shrink to 1 and flex-basis to auto. .item { flex: 2 1 auto; } If you have read the article Basic Concepts of Flexbox, then you will have already had an introduction to the properties. Here we will explore them in depth in order that you can fully understand what the browser is doing when you use them. Important concepts when working on the main axis There are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis. These relate to the natural size of flex items before any growing or shrinking takes place, and to...
...hat 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 what effects min-content and max-content have as we explore flex-grow and flex-shrink later in this article. Positive and negative free space To talk about these properties we need to understand the concept of positive and negative free space. When a flex container has positive free space, it has more space than is required to display the flex items inside the container. For example, if I have a 500 pixel-wide container, flex-direction is row, and I have three flex items each 100 pixels wide, then I have 200 pixels of positive free space, which could be distributed ...
...And 2 more matches
CSS Fonts - CSS: Cascading Style Sheets
Web › CSS › CSS Fonts
CSS Fonts is a module of CSS that defines font-related properties and how font resources are loaded. It lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character. Basic example The following example shows a simple use of basic font properties to style a paragraph of text. p { width: 600px; margin: 0 auto; font-family: "Helvetica Neue", "Arial", sans-serif; font-style: italic; font-weight: 100; font-variant-ligatures: normal; font-size: 2rem; letter-spacing: 1px; } <p>Three hundred years ago<br> I thought I might get some sleep<br> I stretched myself out onna antique bed<br> An' my spirit did a midnite creep</p> The result is as follows: Variable fonts examples ...
...cing: 1px; } <p>Three hundred years ago<br> I thought I might get some sleep<br> I stretched myself out onna antique bed<br> An' my spirit did a midnite creep</p> The result is as follows: Variable fonts examples You can find a number of variable fonts examples at v-fonts.com and axis-praxis.org; see also our Variable fonts guide for more information and usage information. ...
...to different glyphs or character styles contained within an OpenType font. These include things like ligatures (special glyphs that combine characters like 'fi' or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. These are all referred to as OpenType Features, and are made available to use on the web via specific properties and a low-level control property -- font-feature-settings. This article provides you with all you need to know about using OpenType font features in CSS. Variable fonts guide Variable fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight...
...And 2 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
ual behavior based 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.
...two paragraphs on your page they display one below the other, so it is this direction we describe as the block axis. The inline axis runs across the block axis, it is the direction in which text in regular inline flow runs. We are able to align the content inside grid areas, and the grid tracks themselves on these two axes. 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. I can use the align-items property on the grid container, to align the items using one of the following values: auto normal start end center stretch baseline first baseline ...
...: end; } .item4 { grid-area: d; justify-self: center; } <div class="wrapper"> <div class="item1">Item 1</div> <div class="item2">Item 2</div> <div class="item3">Item 3</div> <div class="item4">Item 4</div> </div> As with align-self and align-items, you can apply justify-items to the grid container, to set the justify-self value for all items. The justify-self and justify-items properties are not implemented in flexbox. This is due to the one-dimensional nature of flexbox, and that there may be multiple items along the axis, making it impossible to justify a single item. To align items along the main, inline axis in flexbox you use the justify-content property. Shorthand properties The place-items property is shorthand for align-items and justify-items. The place-self propert...
...And 2 more matches
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
Firefox initially implemented an early version of the Scroll Snap Specification, called Scroll Snap Points. In Firefox 68 the new version of the specification will be shipped and these old properties removed. In this article, we consider questions that might arise related to compatibility across browsers and versions of browsers when adding support for scroll-snap to your web site or app. What should I do if I used the old Firefox implementation? If you have only used the old Firefox implementation of the specification, with the properties that are detailed in Scroll Snap Points, you should update your code to use the new specification. This will ensure your scroll snapping works in all browsers which implement the specification, including Firefox. If you do not do this your scroll snapping will...
... properties that are detailed in Scroll Snap Points, you should update your code to use the new specification. This will ensure your scroll snapping works in all browsers which implement the specification, including Firefox. If you do not do this your scroll snapping will no longer work in Firefox 68 and up. ...
...sers of old Firefox (or -webkit prefixed Safari), then you can continue to use the old specification as outlined in the example below. In this initial 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 t...
...And 2 more matches
Mozilla CSS extensions - CSS: Cascading Style Sheets
Mozilla applications such as Firefox support a number of special Mozilla extensions to CSS, including properties, values, pseudo-elements and pseudo-classes, at-rules, and media queries. 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. ...
...lasses will only work in Mozilla applications such as Firefox, and are not on a standards track. Some of them apply only to XUL elements. ...
...Once a given property is standardized and implemented without the prefix, the prefixed version is typically dropped after a while. A -moz-animation [Prefixed version still accepted] -moz-animation-delay [Prefixed vers...
...And 2 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
Applications based on WebKit or Blink, such as Safari and Chrome, support a number of special WebKit extensions to CSS. These extensions are generally prefixed with -webkit-. Most -webkit- prefixed properties also work with an -apple- prefix. A few are prefixed with -epub-. WebKit-only properties Note: Avoid using on websites. These properties will only work in WebKit applications. A -webkit-animation-trigger -webkit-app-region -webkit-appearance* -webkit-aspect-ratio B -webkit-backdrop-filter -webkit-background-composite -webkit-border-after** -webkit-border-after-color** -webkit-border-after-style** -webkit-border-after-width** -webkit-border-before** -webkit-border-before-color** -webkit-border-before-style** -webkit-border-before-width** -webkit-border-end** -webkit-...
...e-color -webkit-text-stroke-width -webkit-text-stroke -webkit-text-zoom -webkit-transform-origin-x -webkit-transform-origin-y -webkit-transform-origin-z U -webkit-user-drag -webkit-user-modify * A few are on the standards, unprefixed track ** New syntax has been standardized. Property links to the new synax. Old prefixed syntax is still supported in some browsers. WebKit-prefixed properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y Formerly proprietary properties that are now standard Note: To maximize the compatibility of your CSS, you should use the unprefixed standard properties instead of the prefixed ones listed below. A ...
...Many of these are supported with no prefix as well: see Formerly propri...
...And 2 more matches
border-block - CSS: Cascading Style Sheets
shed 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. ...
...h 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 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 c...
...operties: 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 2 more matches
border-bottom - CSS: Cascading Style Sheets
ottom 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 ... border-bottom-style: dotted; border-bottom: none thick green; ... and the value of border-bottom-style given b...
...efault 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-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> Se...
...e 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 2 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. 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 spec...
...ied 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 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...
...der-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. ...
...And 2 more matches
border-width - CSS: Cascading Style Sheets
The border-width shorthand CSS property sets the width of an element's 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 border-width shorthand CSS property sets the width of an element's 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. ...
... 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. ...
...And 2 more matches
columns - CSS: Cascading Style Sheets
Web › CSS › columns
The columns CSS shorthand property sets the number of columns to use when drawing an element's contents, as well as those columns' widths. The source for this interactive example is stored in a GitHub repository. If 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 number of columns to use when drawing an element's contents, as well as those columns' widths. The source for this interactive example is stored in a GitHub repository. If 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: 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 <'colu...
...th 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. ...
...And 2 more matches
font-variant - CSS: Cascading Style Sheets
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. ...
...evision 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. ...
... none Sets the value of the font-variant-ligatures to none and the values of the other longhand property as normal, their initial value. ...
...And 2 more matches
list-style - CSS: Cascading Style Sheets
The list-style CSS shorthand property allows you set all the list style properties at once. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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 a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
...amples 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 a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
...-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 a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
...And 2 more matches
mask-border - CSS: Cascading Style Sheets
The mask-border CSS shorthand property lets you create a mask along the edge of an element's border. Constituent properties This property is a shorthand for the following CSS properties: mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width Syntax /* source | slice */ mask-border: url('border-mask.png') 25; /* source | slice | repeat */ mask-border: url('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 ...
... 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. ...
...ha mask. See mask-border-mode. ...
...And 2 more matches
offset - CSS: Cascading Style Sheets
Web › CSS › offset
The offset CSS shorthand property sets all the properties required for animating an element along a defined path. Note: Early versions of the spec called this property motion. ...
... The offset CSS shorthand property sets all the properties required for animating an element along a defined path. Note: Early versions of the spec called this property motion. ...
... The offset CSS shorthand property sets all the properties required for animating an element along a defined path. Note: Early versions of the spec called this property motion. ...
...And 2 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. ...
...n-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. ...
...em 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. ...
...And 2 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. ...
...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. ...
...uch 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. ...
...And 2 more matches
Adding captions and subtitles to HTML5 video - Developer guides
ge they want the subtitles displayed in, or to turn them off entirely. We have added the button, but before we make it do anything, we need to build the menu that goes with it. This menu is built dynamically, so that languages can be added or removed later by simply editing the <track> elements within the video's markup. ...
...; padding:2px 5px; border-radius:2px; } Styling the displayed subtitles One of the less well known about and supported features of WebVTT is the ability to style the individual subtitles (something called text cues) via CSS Extensions. The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. ...
... features of WebVTT is the ability to style the individual subtitles (something called text cues) via CSS Extensions. The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. ...
...And 2 more matches
Microdata - HTML: Hypertext Markup Language
t 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 elements. To create an item, the item...
...scope attribute is used. To add a property to an item, the itemprop attribute is used on one of the item's descendants. Vocabularies Google and other major search engines support the Schema.org vocabulary for structured data. This vocabulary defines a standard set of type names and property names, for example, Schema.org Music Event indicates a concert performance, with startDate and location properties to specify the concert's key details. In this case, Schema.org Music Event would be the URL used by itemtype and startDate and location would be itemprop's that Schema.org Music Event defines. Note: More about itemtype attributes can be found at http://schema.org/Thing Microdata vocabularies provide the semantics or meaning of an Item. Web developers can design a custom vocabulary or use voca...
...d encyclopedic articles. This extension was made to solve transliteration problems between the Cyrillic and Latin alphabets. Due 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 (us...
...And 2 more matches
Numbers and dates - JavaScript
tter "X" (0x or 0X). If the digits after 0x are outside the range (0123456789ABCDEF), the following SyntaxError is thrown: "Identifier starts immediately after numeric literal". ...
...Identifier starts immediately after numeric literal". 0xFFFFFFFFFFFFFFFFF // 295147905179352830000 0x123456789ABCDEF // 81985529216486900 0XA // 10 Exponentiation 1E3 // 1000 2e6 // 2000000 0.1e2 // 10 Number object The built-in Number object has properties for numerical constants, such as maximum value, not-a-number, and infinity. You cannot change the values of these properties and you use them as follows: var biggestNum = Number.MAX_VALUE; var smallestNum = Number.MIN_VALUE; var infiniteNum = Number.POSITIVE_INFINITY; var negInfiniteNum = Number.NEGATIVE_INFINITY; var notANum = Number.NaN; You always refer to a property of the predefined Number object as shown above, and not as a property of a Number object you create yourself. The following table summarizes the Nu...
...hem as follows: var biggestNum = Number.MAX_VALUE; var smallestNum = Number.MIN_VALUE; var infiniteNum = Number.POSITIVE_INFINITY; var negInfiniteNum = Number.NEGATIVE_INFINITY; var notANum = Number.NaN; You always refer to a property of the predefined Number object as shown above, and not as a property of a Number object you create yourself. The following table summarizes the Number object's properties. Properties of Number Property Description Number.MAX_VALUE The largest representable number (+-1.7976931348623157e+308) Number.MIN_VALUE The smallest representable number (+-5e-324) Number.NaN Special "not a number" value Number.NEGATIVE_INFINITY Special negative infinite value; returned on overflow Number.POSITIVE_INFINI...
...And 2 more matches
Classes - JavaScript
s the global object. In strict mode, autobinding will not happen; the value of this remains as passed. ...
...In strict mode, autobinding will not happen; the value of this remains as passed. ...
...Support in browsers is limited, but the feature can be used through a build step with system...
...And 2 more matches
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. 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 prope...
...s no getter (accessor descriptors only). set A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). 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. ...
...escriptors only). 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. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. ...
...And 2 more matches
Object.prototype.hasOwnProperty() - JavaScript
One'); // 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'); // returns false o.prop = 'exists'; o.hasOwnProperty('prop'); // returns true Direct vs. ...
...('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'); // returns false o.prop = 'exists'; o.hasOwnProperty('prop'); // returns true Direct vs. ...
...// 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'); // returns false o.prop = 'exists'; o.hasOwnProperty('prop'); // returns true Direct vs. ...
...And 2 more matches
eval() - 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 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, eva...
...iciently because the function arguments names can be minified too as seen in the minified code below. console.log(Function('"use strict";return(function(a){return a(5)})')()(function(a){ return"Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" ")[a%7||0]})); There are also additional safer (and faster!) alternatives to eval() or Function() for common use-cases. Accessing member properties You should not use eval() to convert property names into properties. Consider the following example where the property of the object to be accessed is not known until the code is executed. This can be done with eval(): var obj = { a: 20, b: 30 }; var propName = getPropName(); // returns "a" or "b" eval( 'var result = obj.' + propName ); However, eval() is not necessary here. In fact, its us...
...a" or "b" eval( 'var result = obj.' + propName ); However, eval() is not necessary here. In fact, its use here is discouraged. Instead, use the property accessors, which are much faster and safer: var obj = { a: 20, b: 30 }; var propName = getPropName(); // returns "a" or "b" var result = obj[ propName ]; // obj[ "a" ] is the same as obj.a You can even use this method to access descendant properties. ...
...And 2 more matches
for...of - 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 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. const iterable = [10, 20, 30]; for (let value of iterable) { value += 1; console.log(value); } // 11 // 21 // 31 Iterating over a String const ite...
...this.i++, done: false }; } return { value: undefined, done: true }; } }; } }; for (const value of iterable) { console.log(value); } // 0 // 1 // 2 Difference between for...of and for...in Both for...in and for...of statements iterate over something. The main difference between them is in what they iterate over. The for...in statement iterates over the enumerable properties of an object, in an arbitrary order. The for...of statement iterates over values that the iterable object defines to be iterated over. The following example shows the difference between a for...of loop and a for...in loop when used with an Array. Object.prototype.objCustom = function() {}; Array.prototype.arrCustom = function() {}; const iterable = [3, 5, 7]; iterable.foo = 'hello'; for (con...
..., "foo" } } for (const i of iterable) { console.log(i); // logs 3, 5, 7 } Let us look into the above code step by step. Object.prototype.objCustom = function() {}; Array.prototype.arrCustom = function() {}; const iterable = [3, 5, 7]; iterable.foo = 'hello'; Every object will inherit the objCustom property and every object that is an Array will inherit the arrCustom property since these properties have been added to Object.prototype and Array.prototype, respectively. The object iterable inherits the properties objCustom and arrCustom because of inheritance and the prototype chain. for (const i in iterable) { console.log(i); // logs 0, 1, 2, "foo", "arrCustom", "objCustom" } This loop logs only enumerable properties of the iterable object, in arbitrary order. It doesn't log array elemen...
...And 2 more matches
Animation performance and frame rate - Web Performance
Animation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. For animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the greatest issue. Code based animations, be it CSS, SVG, <canvas>, webGL or other JavaScript animations, can cause performance issues even if the bandwidth footprint is small. These animations can consume CPU and/or cause jank. While performance is sensitive to...
...r, the performance cost of modifying a CSS property can vary from one property to another. It's commonly accepted that 60 frames per second is the rate at which animations will appear smooth. For a rate of 60 frames per second, the browser has 16.7 milliseconds to execute scripts, recalculate styles and layout if needed, and repaint the area being updated. Slow scripts and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. The rendering waterfall The process a browser uses to paint changes to a page when an element is animating CSS properties can be described as a waterfall consisting of the following steps: Recalculate Style: when a property for an element changes, the browser must recalculate computed styles. Layout: next, the browser...
... changing. Rather, the page is being repainted, repeatedly, based on JavaScript canvas API functions. When a canvas is animating a drawing, the canvas animation can be described as a waterfall consisting of the following steps: These sequenced need to fit into a single frame, since the screen isn't updated until it is complete. CSS property cost In the context of the rendering waterfall, some properties are more expensive than others: Property type Cost Examples Properties that affect an element's geometry or position trigger a style recalculation, a layout and a repaint. left max-width border-width margin-left font-size Properties that don't affect geometry or position, but are not rendered in their own layer, do n...
...And 2 more matches
patternUnits - SVG: Scalable Vector Graphics
The patternUnits attribute indicates which coordinate system to use for the geometry properties of the <pattern> element. ...
... The patternUnits attribute indicates which coordinate system to use for the geometry properties of the <pattern> element. ...
... Only one element is using this attribute: <pattern> html,body,svg { height:100% } <svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <!-- All geometry properties are relative to the current user space --> <pattern id="p1" x="12.5" y="12.5" width="25" height="25" patternUnits="userSpaceOnUse"> <circle cx="10" cy="10" r="10" /> </pattern> <!-- All geometry properties are relative to the target bounding box --> <pattern id="p2" x=".125" y=".125" width=".25" height=".25" patternUnits="objectBoundingBox"> <circle cx="10" cy="10" r="10" /> </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" widt...
...And 2 more matches
Content type - SVG: Scalable Vector Graphics
ber 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 specified, must be in lower case. ...
...gth in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length>. Within the SVG DOM, a <coordinate> is represented as an SVGLength or an SVGAnimatedLength. Frequency <frequency> Frequency values are used with aural properties. As defined in CSS2, a frequency value is a <number> immediately followed by a frequency unit identifier. The frequency unit identifiers are: Hz: Hertz kHz: kilo Hertz Frequency values may not be negative. FuncIRI <FuncIRI> Functional notation for a reference. The syntax for this reference is the same as the css uri. ICCColor <icccolor> An <icccolor> is an ICC color spe...
... 1.1 (2nd Edition): IRI references. Length <length> A length is a distance measurement, given as a number along with a unit. Lengths are specified in one of two ways. When used in a stylesheet, a <length> is defined as follows: length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")? See the CSS2 specification for the meanings of the unit identifiers. ...
...And 2 more matches
panel - Archive of obsolete content
ton. If this is supplied the panel will be shown 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...
...d // aligned to the bottom of the content area require("sdk/panel").Panel({ position: { bottom: 0 } }).show(); // Show the panel centered vertically and // aligned to the left of the content area require("sdk/panel").Panel({ position: { left: 0 } }).show(); // Centered panel, default behavior require("sdk/panel").Panel({}).show(); As with the CSS top, bottom, left, and right properties, setting both top and bottom or both left and right will implicitly set the panel's height or width relative to the content window: // Show the panel centered horizontally, with: // - the top edge 40px from the top // of the content window // - the bottom edge 100px from the bottom // of the content window require("sdk/panel").Panel({ position: { top: 40, bottom: 100 } }).show()...
...izontally, with: // - the top edge 40px from the top // of the content window // - the bottom edge 100px from the bottom // of the content window require("sdk/panel").Panel({ position: { top: 40, bottom: 100 } }).show(); If you set both top and bottom, but also set the panel's height explicitly using the height property, then the panel will ignore bottom, just as CSS does for its properties with the same name: // Show the panel centered horizontally, with: // - the top edge 40px from the top // of the content window // - a height of 400px require("sdk/panel").Panel({ position: { top: 40, bottom: 100, }, height: 400 }).show(); // This is equivalent to: require("panel").Panel({ position { top: 40 }, height: 400 }).show(); The same principle is appl...
... Registers an event listener with the panel. Parameters type : string The type of event to listen for. listener : function The listener function that handles the event. removeListener(type, listener) Unregisters an event listener from the panel. Parameters type : string The type of event for which listener was registered. listener : function The listener function that was registered. Properties port EventEmitter object that allows you to: send events to the content script using the port.emit function receive events from the content script using the port.on function See the guide to communicating using port for details. isShowing Tells if the panel is currently shown or not. This property is read-only. height The height of the panel in pixels. width The width of the panel ...
request - Archive of obsolete content
nt in regards to the Twitter API calls and need to be updated Make simple network requests. For more advanced usage, check out the net/xhr module, based on the browser's XMLHttpRequest object. Globals Constructors Request(options) This constructor creates a request object that can be used to make network requests. The constructor takes a single parameter options which is used to set several properties on the resulting Request. Parameters options : object Optional options: Name Type url 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...
...ete" event. Registered event listeners are passed a Response object. Each Request object is designed to be used once. Attempts to reuse them will throw an error. Since the request is not being made by any particular website, requests made here are not subject to the same-domain 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("sd...
...ter.com/1.1/application/rate_limit_status.json", onComplete: function (response) { if (response.json.remaining_hits) { latestTweetRequest.get(); } else { console.log("You have been rate limited!"); } } }).get(); Methods get() Make a GET request. head() Make a HEAD request. post() Make a POST request. put() Make a PUT request. delete() Make a DELETE request. Properties url headers content contentType response Events complete The Request object emits this event when the request has completed and a response has been received. Arguments Response : Listener functions are passed the response to the request as a Response object. Response The Response object contains the response to a network request issued using a Request object. It is returned by the get...
...st has completed and a response has been received. Arguments Response : Listener functions are passed the response to the request as a Response object. Response 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 ...
preferences/service - Archive of obsolete content
Example: var name = "extensions.checkCompatibility.nightly"; require("sdk/preferences/service").reset(name); getLocalized(name, defaultValue) Gets the localized value for an application preference name. Parameters name : string defaultValue : string Preference value. Returns string : Localized preference value, returns a default value if no preference is set. ...
...ility.nightly"; require("sdk/preferences/service").reset(name); getLocalized(name, defaultValue) Gets the localized value for an application preference name. Parameters name : string defaultValue : string Preference value. Returns string : Localized preference value, returns a default value if no preference is set. Some preferences refer to a properties file. So that prefs.get returns the properties file URL whereas prefs.getLocalized returns the value defined in the properties file. Example: var prefs = require("sdk/preferences/service"); var name = "general.useragent.locale"; prefs.get(name); // is equal to "chrome://global/locale/intl.properties" prefs.getLocalized(name) // is equal to "en-US" setLocalized(name, value) Sets the localized application preference name to value. Paramete...
...ile. Example: var prefs = require("sdk/preferences/service"); var name = "general.useragent.locale"; prefs.get(name); // is equal to "chrome://global/locale/intl.properties" prefs.getLocalized(name) // is equal to "en-US" setLocalized(name, value) Sets the localized application preference name to value. Parameters name : string Preference name. ...
.../intl.properties" prefs.getLocalized(name) // is equal to "en-US" setLocalized(name, value) Sets the localized application preference name to value. Parameters name : string Preference name. ...
Miscellaneous - Archive of obsolete content
Disabling JavaScript programmatically // Disable JS in the currently active tab from the context of browser.xul gBrowser.docShell.allowJavascript = false; If this isn't your browser, you should save the value and restore it when finished. If you wish to block selected scripts based on their URI, implement nsIContentPolicy. ...
...ell.allowJavascript = false; If this isn't your browser, you should save the value and restore it when finished. If you wish to block selected scripts based on their URI, implement nsIContentPolicy. Using string bundles from JavaScript Assuming the extension has myext.properties with name/value pairs such as: invalid.url=The speficied URL, %S, is invalid. That was attempt number %S. ...
...operties with name/value pairs such as: invalid.url=The speficied URL, %S, is invalid. That was attempt number %S. ...
...turn this._bundle.GetStringFromName(msg); } }; alert(common.getLocalizedMessage("invalid.url")) Another similar alternative (using both GetStringFromName and formatStringFromName), is: var fcBundle = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService) .createBundle("chrome://myext/locale/myext.properties"); function getStr(msg, args){ //get localised message if (args){ args = Array.prototype.slice.call(arguments, 1); return fcBundle.formatStringFromName(msg,args,args.length); } else { return fcBundle.GetStringFromName(msg); } } /* Usage */ alert(getStr("invalid.url", "http://bad/url/", "3")); //for message with parameters alert(getStr("invalid.url")); //for message without par...
Jetpack Processes - Archive of obsolete content
e given message name. createHandle() Similar to nsIJetpack.createHandle(), this function creates a new handle and returns it. createSandbox() This creates a new JavaScript sandbox and returns its global scope. This global scope does not contain privileged APIs, or any non-standard JavaScript objects for that matter, though new globals can be endowed by simply attaching them to the global scope as properties. evalInSandbox(aSandbox, aScript) Evaluates the given script contents in the given sandbox's global scope. At minimum, JavaScript 1.8.1 is used. Individual lines of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. gc() Synchronously performs garbage collection. Handles Messages that communicate between the browser and jetpack process...
...d to specify filename and line number information for debugging purposes. gc() Synchronously performs garbage collection. Handles Messages that communicate between the browser and jetpack process may contain only serializable (JSON) data and handles. A handle can be used to provide context for messages. Either the browser or the jetpack implementation may create one. A handle keeps any arbitrary properties attached to it alive, but those properties are not transmitted across the process boundary. These arbitrary properties are the primary means through which context can be provided for messages; for instance, if the handle is meant to represent a network request, an XMLHttpRequest instance can be attached to the handle on the chrome process. Because a handle's existence crosses process boundaries a...
...nreachable in both processes and a memory leak is created. To prevent such memory leaks, a process can either invalidate a handle, immediately preventing it from being passed as a message argument, or it can unroot the handle, allowing it to be passed as a message argument until all references to it are removed, at which point it is garbage collected. Handles have the following native methods and properties: invalidate() Invalidates the handle. Either process may invalidate a handle when it is no longer useful. createHandle() Creates a child handle which becomes invalid when its parent does. This is useful for associating handles to the lifetime of a particular window, context menu, or other element, and helping ensure that they do not leak. parent The parent handle of the object, if any. Read-only...
...ges core:process-error(context) When the jetpack process crashes, this message is sent to the parent. If a crash report minidump is available, the context.dumpID property will list the minidump ID of the crash report that was collected. core:exception(error) When an exception occurs in a Jetpack script and is not caught, this message is sent to the parent. The error object contains the following properties: fileName, lineNumber, and message. History See bug 556846 and bug 578821 for details. Sample Code For example code, check out the unit tests. See also nsIJetpackService nsIJetpack ...
findbar - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] In Gecko 1.9, the findbar widget moved into toolkit, so it's available to any XUL application, as well as extensions. For example, the standard findbar in Firefox 3.5 looks like this on the Mac: You may attach a findbar to a particular browser element by either setting the findbar's browserid attribute to the ID of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself. ...
...e this on the Mac: You may attach a findbar to a particular browser element by either setting the findbar's browserid attribute to the ID of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself. Attributes browserid, findnextaccesskey, findpreviousaccesskey, highlightaccesskey, matchcaseaccesskey Properties browser, findMode Methods close, onFindAgainCommand, 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 con...
... 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 "Match case" checkbox in the findbar. ...
...ess 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 "Match case" checkbox in the findbar. ...
Manipulating Lists - Archive of obsolete content
ULSelectControlElement interface so any XUL elements which implement this interface have these methods. This includes the menulist, radiogroup and tabs elements. For example, to add a new item to a menulist, you can use the same syntax as for a listbox. The right kind of element will be appended in each situation. ...
...ontrolElement interface provides two additonal properties, selectedIndex and selectedItem. The former returns the index of the selected item while the latter returns the selected element. For instance the selectedItem of a menulist will be the menuitem that is selected. If no item is selected, selectedIndex will return -1, while selectedItem will return null. Getting the selected item These two properties are commonly inspected during a select event, as in the following example: Example 2 : Source View <listbox id="thelist" onselect="alert(this.selectedItem.label);"> <listitem label="Short"/> <listitem label="Medium"/> <listitem label="Tall"/> </listbox> The select event is fired for a listbox when an item in the list is selected. The select handler here displays an alert containing the ...
...ore convenient to use functions of the tabbox element 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 <scri...
...diogroup> Listboxes also support multiple selection and the functions of the nsIDOMXULMultiSelectControlElement interface. This interface provides a number of functions specifically for handling multiple selection. For example the selectedItems property holds a list of the items that are selected, while the selectedCount property holds the number of items selected. Typically, you will use these properties to iterate over the list and perform some operation for each item. Be careful when iterating over the selected items; if you modify the items in the list while iterating, the list will change and the selection properties may return different values. This is one reason why it is useful to manipulate the list by the item rather than by index. Deleting selected items The following example shows a ...
Tree View Details - Archive of obsolete content
e 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 see child items. Empty containers will not have a twisty, but will still be treated like a container. When the user clicks the twisty to open a row, the tree will call the view's toggleOpenState method. The view shoul...
... << PreviousNext >> ...
... << PreviousNext >> ...
... << PreviousNext >> ...
arrowscrollbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A box which provides scroll arrows along its edges for scrolling through the contents of the box. The user only needs to hover the mouse over the arrows to scroll the box. This element is typically used for large popup menus. Hovering the mouse over one of the (active) arrows triggers a scroll event. More information is available in the XUL Tutorial. ...
...croll arrows along its edges for scrolling through the contents of the box. The user only needs to hover the mouse over the arrows to scroll the box. This element is typically used for large popup menus. Hovering the mouse over one of the (active) arrows triggers a scroll event. More information is available in the XUL Tutorial. ...
...lean true initially enables smooth scrolling for the corresponding arrowscrollbox, false disables it. Currently, smooth scrolling supports horizontal arrowscrollboxes only. 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. ...
... enables smooth scrolling for the corresponding arrowscrollbox, false disables it. Currently, smooth scrolling supports horizontal arrowscrollboxes only. 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. ...
browser - Archive of obsolete content
It is similar to an iframe except that it holds a page history and contains additional methods to manipulate the currently displayed page. Are you here looking for information about the Firefox web browser, or because you'd like to download the latest version of Firefox? Get Firefox Most of the properties and methods of the browser will rarely be used and can only be called from chrome URLs. Other URLs will need to use the document and history objects to change the displayed document. ...
... A XUL <browser> element represents a frame which is expected to contain a view of a Web document. It is similar to an iframe except that it holds a page history and contains additional methods to manipulate the currently displayed page. Are you here looking for information about the Firefox web browser, or because you'd like to download the latest version of Firefox? Get Firefox Most of the properties and methods of the browser will rarely be used and can only be called from chrome URLs. Other URLs will need to use the document and history objects to change the displayed document. Attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disablesecurity, droppedLinkHandler, homepage, showcaret, src, type Properties accessibleType, canGoBack, ...
...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 A value indicating the type of accessibility object for the element. canGoBack Type: boolean This read-only property is true if there is a page to go back to in the session history and the Back button should be enabled. canGoForward Type: boolean This read-only property is true if there is a page to go forward ...
...od. docShell Type: nsIDocShell This read-only property contains the nsIDocShell object for the document. documentCharsetInfo Obsolete since Gecko 12.0 Type: nsIDocumentCharsetInfo 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...
button - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A button that can be pressed by the user. Event handlers can be used to trap mouse, keyboard and other events. It is typically rendered as a grey outset rectangle. You can specify the label of the button using the label attribute or by placing content inside the button. More information is available in the XUL tutorial. ...
...se, keyboard and other events. It is typically rendered as a grey outset rectangle. You can specify the label of the button using the label attribute or by placing content inside the button. More information is available in the XUL tutorial. Attributes accesskey, autocheck, checkState, checked, command, crop, dir, disabled, dlgtype, group, icon, image, label, open, orient, tabindex, type Properties accessKey, accessibleType, autoCheck, checkState, checked, command, crop, dir, disabled, dlgType, group, image, label, open, orient, tabIndex, type Examples <button label="Press Me" oncommand="alert('You pressed me!');"/> Attributes accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appea...
... are unchecked. 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. 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 ...
...n the main part of the button is pressed. panel Similar to the menu type, this opens a popup. Place a panel element inside the button. panel elements are popups that support any type of content. radio The button acts like a radio button. Only one button in the group can be on a once. repeat This button will fire its command event repeatedly while the mouse button is held down. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. autoCheck Type: boolean Gets and sets the value of the autoCheck attribute. checkState Type: integer, values 0, 1, or 2 Gets and sets the valu...
datepicker - Archive of obsolete content
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. ...
...e 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 properties may be used to retrieve and modify each component of the date separately. !!Attention: there is also a datepicker in TB-calendar with differing definitions for members (value is a Date there) The change event is fired whenever the date is changed. However, as described in Mozilla bug #799219, a change event handler may encounter erratic behavior when the date is changed using the keyboard inste...
...id 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 text. If the elem...
...ed. 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. value Type: string The initial value of the datepicker in the form YYYY-MM-DD. Properties date Type: integer The currently selected date of the month from 1 to 31. Set this property to change the selected date. dateLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before the date when it is less than 10. dateValue Type: Date The date that is currently entered or sel...
deck - Archive of obsolete content
Archive › Mozilla › XUL › deck
The first item is at index 0. ...
...The first item is at index 0. ...
...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 ...
...x 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. ...
image - Archive of obsolete content
Archive › Mozilla › XUL › image
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Summary An element that displays an image, much like the HTML img element. The src attribute can be used to specify the URL of the image. More information is available in the XUL tutorial. Note: Prior to Gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth. The new behavior aligns more with the HTML <img> element and shrinks both the width and height down proportionally. ...
...ify the URL of the image. More information is available in the XUL tutorial. Note: Prior to Gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth. The new behavior aligns more with the HTML <img> element and shrinks both the width and height down proportionally. Attributes onerror, onload, src, validate Properties accessibleType, src Style classes alert-icon, error-icon, message-icon, question-icon Examples <image src='Firefoxlogo.png' width='135' height='130'/> Attributes onerror Type: script code This event is sent to an image element when an error occurs loading the image. image.onload Type: script code This event handler will be called on the image element when the image ...
...cates 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. ...
...e 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. ...
listcell - 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. ...
...An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. ...
... 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. ...
...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. ...
member - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Used within a rule's conditions element to match elements that are containers or are contained within another element. Both the container and child attributes may use variables. More information is available in the XUL tutorial. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Used within a rule's conditions element to match elements that are containers or are contained within another element. Both the container and child attributes may use variables. More information is available in the XUL tutorial. ...
... container Type: ? A variable reference to a node that is expected to be a container. If the variable is the same as the uri attribute on the content element, the resource must be a container element in order to match. Inherite...
... child Type: ? A variable reference to a node that is expected to be a child of the element that is referred to by the container element. container Type: ? A variable reference to a node that is expected to be a container. If the variable is the same as the uri attribute on the content element, the resource must be a container element in order to match. ...
menubar - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A container that usually contains menu elements. On the Macintosh, the menubar is displayed along the top of the screen, and all non-menu related elements inside the menubar will be ignored. To look native (at least on Windows), the menubar element needs to be placed inside a toolbox element. More information is available in the XUL tutorial. ...
...elated ] A container that usually contains menu elements. On the Macintosh, the menubar is displayed along the top of the screen, and all non-menu related elements inside the menubar will be ignored. To look native (at least on Windows), the menubar element needs to be placed inside a toolbox element. More information is available in the XUL tutorial. ...
... </menu> </menubar> Attributes grippyhidden SeaMonkey only 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. ...
...he 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. ...
menuitem - Archive of obsolete content
<< XUL Reference home [ 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. ...
...amples | 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type: character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu that the item is inside, if any, o...
... menuitem and menuseparator elements in Firefox 3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. 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. ...
menupopup - Archive of obsolete content
When a menupopup is open, it floats above the window and may extend outside the window border. There are several ways in which a menupopup may be used: It may be placed inside a menu, menulist, toolbarbutton, or a button with the type attribute set to "menu" to create a popup that will open when the menu or button is pressed. It may be attached to any element using the popup attribute. When the element is clicked with the left mouse button, the menupopup will be displayed. It may be attached to any element using the context attribute. ...
...tached to any element using the context attribute. When a context menu is opened, the menupopup will be displayed. A context menu may be opened by right-clicking the element, or by pressing the menu key on the keyboard. More information is available in the XUL tutorial and Popup Guide. Attributes ignorekeys, left, onpopuphidden, 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://slash...
...gle 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 top Type: integer Overrides the vertical position of the popup specified by the showPopup method. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. anchorNode Type: nsIDOMElement This read-only property holds the DOM node that was specified as the anchor when opening the popup. popupBoxObject Type: nsIPopupBoxObject This read-only property holds the nsIPopupBoxObject that implements the popup...
...esponds to the popupanchor attribute on the element. The align argument corresponds to the popupalign attribute on the element. The anchor and align arguments are ignored if either x or y are not -1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the ne...
progressmeter - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A meter which can be used to display the progress of a lengthy operation. It is drawn as a bar that is filled as the operation completes. In addition, an indeterminate progressmeter may be created by setting the mode attribute to undetermined. This is used when the length of time to complete an operation is not known beforehand. More information is available in the XUL tutorial. ...
...e 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. ...
... max Type: integer Gets and sets the value of the max attribute. mode Type: string Gets and sets the value of the mode attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menul...
... Type: integer Gets and sets the value of the max attribute. mode Type: string Gets and sets the value of the mode attribute. 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. ...
<statusbarpanel> - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox 4 note The status bar has been removed. Refer to the add-on bar. An individual element of a statusbar. This is a special type of button which is drawn differently. Unlike normal buttons, a statusbarpanel can only have a label or an image but not both. This element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. ...
.... Refer to the add-on bar. An individual element of a statusbar. This is a special type of button which is drawn differently. Unlike normal buttons, a statusbarpanel can only have a label or an image but not both. This element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. ...
...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. ...
...lement. 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. ...
timepicker - Archive of obsolete content
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. ...
...our 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 time separately. The change event is fired whenever the time is changed. However, as described in Mozilla bug #799219, a change 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-han...
...ndler 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 disabled. Disabled...
...uld be used in combination with setting hideseconds to true. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. value Type: string The initial value of the timepicker in either the form HH:MM:SS or HH:MM. Properties amIndicator Type: string The string value displayed for hours between midnight and noon, defaulting to AM. This value is determined from the user's locale. dateValue Type: Date The date that is currently entered or selected in the datepicker as a Date object. disabled Type: boolean Gets and sets the value of the disabled att...
tooltip - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used for the tooltip popups. For text-only tooltips, this element doesn't need to be used; instead you may just add a tooltiptext attribute to an element. More information is available in the XUL tutorial. ...
...tes | Properties | Methods | Related ] This element is used for the tooltip popups. For text-only tooltips, this element doesn't need to be used; instead you may just add a tooltiptext attribute to an element. More information is available in the XUL tutorial. ...
...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 Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. label Type: string Gets and sets the value of the label attribute. popupBoxObject Type: nsIPopupBoxObject This read-only property holds the nsIPopupBoxObject that implements the popup. You wouldn't normally need to use this proper...
...esponds to the popupanchor attribute on the element. The align argument corresponds to the popupalign attribute on the element. The anchor and align arguments are ignored if either x or y are not -1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new...
treecell - Archive of obsolete content
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. ...
...ion 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 indeterminate. properties Type: space-separated list of property names Sets the properties of the element, which can be used to style the element. For more information, see Styling a Tree. ref Type: URI For template-generated elements, this attribute is used to specify the root RDF node where content generation begins. This will correspond to the value of an about attribute on an RDF container. This attribute s...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. ...
...ializable 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. ...
wizardpage - Archive of obsolete content
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. ...
... 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. ...
...create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Properties next Type: string wizardpage id Set to the pageid of the next page 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 one, except that last page. pageid Type: string wizardpage id This attribute s...
... sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: string wizardpage id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. ...
XULRunner tips - Archive of obsolete content
nsions.update.enabled", true); pref("extensions.update.interval", 86400); pref("extensions.dss.enabled", false); pref("extensions.dss.switchPending", false); pref("extensions.ignoreMTimeChanges", false); pref("extensions.logging.enabled", false); pref("general.skins.selectedSkin", "classic/1.0"); // NB these point at AMO pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties"); If your application is based on Gecko 2.0, you need to register a component through the new component registration because the extension manager uses FUEL, namely Application.restart(), to restart...
...ou open the JS Shell and other tools provided by the extension. Branding Branding is a chrome package containing product-specific information (e.g. the product name, vendor, and logo). Some XULRunner components (in particular, the Extension Manager) depend on branding, in the sense that they expect to find certain strings in chrome://branding/locale/brand.dtd and chrome://branding/locale/brand.properties. ...
...rome package containing product-specific information (e.g. the product name, vendor, and logo). Some XULRunner components (in particular, the Extension Manager) depend on branding, in the sense that they expect to find certain strings in chrome://branding/locale/brand.dtd and chrome://branding/locale/brand.properties. In order to satisfy these dependencies, you can save Firefox's brand.dtd/brand.properties to chrome/locale/branding folder, modify them appropriately, and register a locale provider for branding by adding the following line to your chrome manifest: locale branding en-US chrome/locale/branding/ The location you put the branding files in doesn't matter, as long as you register it appropriately in the manifest. In addition, a branding content package must be registered to include the ...
...Without these settings Password Manager will not store login details. pref("signon.rememberSignons", true); pref("signon.expireMasterPassword", false); pref("signon.SignonFileName", "signons.txt"); Y...
Browser Detection and Cross Browser Support - Archive of obsolete content
any web authors continued to use the vendor/version approach to distinguishing web browsers in their client side scripts. Since the user agent string was exposed as a property of the navigator object (e.g. navigator.userAgent), many web authors used the same logic in their client side scripts as they had used earlier in their server side browser detection. In addition to navigator.userAgent other properties such as appName and appVersion were available in the navigator object which could be used in browser vendor/version detection strategies. The classic example of this vendor/version client side detection strategy can be found in the Ultimate Browser Sniffer. This script and variants of it can be found today on many web sites where it is a common source of detection problems. Netscape Navigator 4...
...increased since the introduction of Netscape 6 in November 2000. The best approach to take advantage of these IE compatibility features in Gecko is to use object based feature detection. This will automatically use any such features in Gecko if they are available in the version of Gecko being used. See the DOM Client Object Cross-Reference for more details on which Internet Explorer's objects and properties are supported by which version of Gecko. A number of Internet Explorer features are not supported by Gecko. These include the window.event object, behaviors, filters, transitions, and ActiveX. How (and when) to use the navigator object when detecting Gecko Unless you specifically need to detect if Gecko is being used, do not use these methods. These methods should only be used in circumstances...
...navigator object when detecting Gecko Unless you specifically need to detect if Gecko is being used, do not use these methods. These methods should only be used in circumstances which can not be handled by using object feature detection such as when specific versions of Gecko must be excluded for security reasons. Note: For client side detection, we recommend using the navigator object and it's properties. All of the information reported in the navigator is also available in the user agent string which can be used in server side situations. Product navigator.product is specific to Gecko browsers and will always return 'Gecko'. The is a quick and simple means of determining that a browser is based upon Gecko. CVS Branch Tag Beginning in Gecko 0.9.0 (Netscape 6.1 in Gecko 0.9.2), navigator.userA...
... elm.style.left = x; elm.style.top = y; } else { // Gecko/Internet Explorer 4+ // W3C DOM Style states that elm.style.left is a string // containing the length followed by the unit. e.g. 10px // Gecko will allow you to omit the unit only in Quirks // mode. // Gecko REQUIRES the unit when operating in Standards ...
New in JavaScript 1.8.5 - Archive of obsolete content
The following is a changelog for JavaScript 1.8.5. This version was included in Firefox 4. New features in JavaScript 1.8.5 New functions Function Description Object.create() Creates a new object with the specified prototype object and properties. bug 492840 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.getOwnPropertyDescriptor() Returns a property descriptor for a named pr...
...bug 518663 Object.preventExtensions() Prevents any extensions of an object. ...
... Object.getOwnPropertyDescriptor() Returns a property descriptor for a named property on an object. bug 505587 Object.keys() Returns an array of all enumerable properties on an object. bug 307791 Object.getOwnPropertyNames() Returns an array of all enumerable and non-enumerable properties on an object. bug 518663 Object.preventExtensions() Prevents any extensions of an object. bug 492849 Object.isExtensible() Determines if extending of an object is allowed. bug 492849 Object.seal() Prevents other code from deleting properties of an object. bug 492845 ...
...bug 492844 Object.isFrozen() Determines if an object was frozen. bug 492844 Array.isArray() Checks if a variable is an array. ...
What is CSS? - Learn web development
ing 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-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; } ...
.... 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. The individual property pages on MDN give you a quick way to look up properties and their values when you forget, or want to know what else you can use as a value. Note: You can find links to all the CSS property pages (along with other CSS features) listed on the MDN CSS reference. Alternatively, you should get used to searching for "mdn css-feature-name" in your favourite search engine whenever you need to find out more information about a CSS feature. For example, try s...
...! CSS Modules As there are so many things that you could style using CSS, the language is broken down into modules. You'll see reference to these modules as you explore MDN and many of the documentation pages are organized around a particular module. For example, you could take a look at the MDN reference to the Backgrounds and Borders module to find out what its purpose is, and what different properties and other features it contains. You will also find links to the CSS Specification that defines the technology (see below). At this stage you don't need to worry too much about how CSS is structured, however it can make it easier to find information if, for example, you are aware that a certain property is likely to be found among other similar things and are therefore probably in the same specif...
...t how CSS is structured, however it can make it easier to find information if, for example, you are aware that a certain property is likely to be found among other similar things and are therefore probably in the same specification. For a specific example, let's go back to the Backgrounds and Borders module -- you might think that it makes logical sense for the background-color and border-color properties to be defined in this module. And you'd be right. CSS Specifications All web standards technologies (HTML, CSS, JavaScript, etc.) are defined in giant documents called specifications (or simply "specs"), which are published by standards organizations (such as the W3C, WHATWG, ECMA, or Khronos) and define precisely how those technologies are supposed to behave. CSS is no different -- it is deve...
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
other rules */ .stockSymbol { font-weight: normal; } <!-- most text is in bold, except "GE", which is red and not bold --> <div id="stockTicker"> NYS: <span class="stockSymbol">GE</span> +1.0 ... </div> To avoid this kind of 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: bol...
...div { color: black; } #orange { color: orange; } .green { color: green; } <div id="orange" class="green" style="color: red;">This is red</div> The rules are more complicated when the selector has multiple parts. More detailed information about how selector specificity is calculated can be found in the CSS 2.1 Specification chapter 6.4.3. ...
...#orange { color: orange; } .green { color: green; } <div id="orange" class="green" style="color: red;">This is red</div> The rules are more complicated when the selector has multiple parts. More detailed information about how selector specificity is calculated can be found in the CSS 2.1 Specification chapter 6.4.3. What do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do? These properties, called prefixed properties, are extensions to the CSS standard. They allow use of experimental and non-standard features in browsers without polluting the regular namespace, preventing future incompatibilities to arise when the standard is extended. The use of such properties on production websites is not recommended -- they have already created a huge web compatibility mess. For example, many ...
...se prefixes in your work, you are advised to write your code in a way that uses the prefixed versions first, but then includes a non-prefixed standard version afterwards so it can automatically override the prefixed versions where supported. For example: -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); Note: For more information on dealing with prefixed properties, see Handling common HTML and CSS problems -- Handling CSS prefixes from our Cross-browser testing module. Note: See the Mozilla CSS Extensions page for more information on the Mozilla-prefixed CSS properties. How does z-index relate to positioning? The z-index property specifies the stack order of elements. An element with a higher z-index/stack order is always rendered in front of an ele...
Client-side form validation - Learn web development
ing forms using JavaScript You must use JavaScript if you want to take control over the look and feel of native error messages or to deal with legacy browsers that do not support HTML's built-in form validation. In this section we will look at the different ways to do this. ...
... validationMessage: Returns a localized message describing the validation constraints that the control doesn't satisfy (if any). If the control is not a candidate for constraint validation (willValidate is false) or the element's value satisfies its constraints (is valid), this will return an empty string. validity: Returns a ValidityState object that contains ...
...le on the above elements. validationMessage: Returns a localized message describing the validation constraints that the control doesn't satisfy (if any). If the control is not a candidate for constraint validation (willValidate is false) or the element's value satisfies its constraints (is valid), this will return an empty string. validity: Returns a ValidityState object that contains several properties describing the validity state of the element. You can find full details of all the available properties in the ValidityState reference page; below is listed a few of the more common ones: patternMismatch: Returns true if the value does not match the specified pattern, and false if it does match. If true, the element matches the :invalid CSS pseudo-class. tooLong: Returns true if the valu...
...ata. If it has then we remove any error message being shown. If the data is not valid, we run showError() to show the appropriate error. Every time we try to submit the form, we again check to see if the data is valid. If so, we let the form submit. If not, we run showError() to show the appropriate error, and stop the form submitting with preventDefault(). The showError() function uses various properties of the input's validity object to determine what the error is, and then displays an error message as appropriate. Here is the live result: Note: You can find this example live on GitHub as detailed-custom-validation.html (see also the source code.) The constraint validation API gives you a powerful tool to handle form validation, letting you have enormous control over the user interface a...
Introduction to web APIs - Learn web development
tion on a lot more 3rd party APIs at the Programmable Web API directory. How do APIs work? Different JavaScript APIs work in slightly different ways, but generally, they have common features and similar themes to how they work. They are based on objects Your code interacts with APIs using one or more JavaScript objects, which serve as containers for the data the API uses (contained in object properties), and the functionality the API makes available (contained in object methods). Note: If you are not already familiar with how objects work, you should go back and work through our JavaScript objects module before continuing. Let's return to the example of the Web Audio API -- this is a fairly complex API, which consists of a number of objects. The most obvious ones are: AudioContext, which...
... how objects work, you should go back and work through our JavaScript objects module before continuing. Let's return to the example of the Web Audio API -- this is a fairly complex API, which consists of a number of objects. The most obvious ones are: AudioContext, which represents an audio graph that can be used to manipulate audio playing inside the browser, and has a number of methods and properties available to manipulate that audio. MediaElementAudioSourceNode, which represents an <audio> element containing sound you want to play and manipulate inside the audio context. AudioDestinationNode, which represents the destination of the audio, i.e. the device on your computer that will actually output it -- usually your speakers or headphones. So how do these objects interact? If you look at...
...ings, although in this case, it's a graphical context rather than an audio context. Its context object is created by getting a reference to the <canvas> element you want to draw on, and then calling its HTMLCanvasElement.getContext() method: const canvas = document.querySelector('canvas'); const ctx = canvas.getContext('2d'); Anything that we want to do to the canvas is then achieved by calling properties and methods of the context object (which is an instance of CanvasRenderingContext2D), for example: Ball.prototype.draw = function() { ctx.beginPath(); ctx.fillStyle = this.color; ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI); ctx.fill(); }; Note: You can see this code in action in our bouncing balls demo (see it running live also). They use events to handle changes in state We ...
... We already discussed events earlier on in the course in our Introduction to events article, which looks in detail at what client-side web events are and how they are used in your code. If you are not already familiar with how client-side web API events work, you should go and read this article first before continuing. Some web APIs contain no events, but most contain at least a few. The handler properties that allow us to run functions when events fire are generally listed in our reference material in separate "Event handlers" sections. We already saw a number of event handlers in use in our Web Audio API example above. To provide another example, instances of the XMLHttpRequest object (each one represents an HTTP request to the server to retrieve a new resource of some kind) has a number of eve...
Object building practice - Learn web development
the <canvas> element, then calls the getContext() method on it to give us a context on which we can start to draw. The resulting constant (ctx) is the object that directly represents the drawing area of the canvas and allows us to draw 2D shapes on it. Next, we set constants called width and height, and the width and height of the canvas element (represented by the canvas.width and canvas.height properties) to equal the width and height of the browser viewport (the area that the webpage appears on -- this can be gotten from the Window.innerWidth and Window.innerHeight properties). Note that we are chaining multiple assignments together, to get the variables all set quicker -- this is perfectly OK. The last bit of the initial script looks as follows: function random(min, max) { const num = Math...
...und the screen. Since these balls will all behave in the same way, it makes sense to represent them with an object. Let's start by adding the following constructor to the bottom of our code. function Ball(x, y, velX, velY, color, size) { this.x = x; this.y = y; this.velX = velX; this.velY = velY; this.color = color; this.size = size; } Here we include some parameters that define the properties each ball needs in order to function in our program: x and y coordinates -- the horizontal and vertical coordinates where the ball starts on the screen. This can range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). horizontal and vertical velocity (velX and velY) -- each ball is given a horizontal and vertical velocity; in real ter...
...t (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() method to the Ball()'s prototype: Ball.prototype.draw = function() { ctx.beginPath(); ctx.fillStyle = this.color; ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI); ctx.fill(); } Using this function, we can tell the ball to draw itself onto th...
...our pen to draw something on it: First, we use beginPath() to state that we want to draw a shape on the paper. Next, we use fillStyle to define what color we want the shape to be -- we set it to our ball's color property. Next, we use the arc() method to trace an arc shape on the paper. Its parameters are: The x and y position of the arc's center -- we are specifying the ball's x and y properties. The radius of the arc -- in this case, the ball's size property. The last two parameters specify the start and end number of degrees around the circle that the arc is drawn between. Here we specify 0 degrees, and 2 * PI, which is the equivalent of 360 degrees in radians (annoyingly, you have to specify this in radians). That gives us a complete circle. If you had specified only 1 * PI, you...
TypeScript support in Svelte - Learn web development
ollowing: import type { TodoType } from '../types/todo.type' export let todo: TodoType The first warning we get is TypeScript telling us to define the type of the update() function's updatedTodo variable. This can be a little tricky because updatedTodo contains only the attributes of the todo that have been updated. That means it's not a complete todo -- it only has a subset of a todo's properties. For these kinds of cases, TypeScript provides several utility types to make it easier to apply these common transformations. What we need right now is the Partial<T> utility, which allows us to represent all subsets of a given type. The partial utility returns a new type based on the type T, where every property of T is optional. We'll use it in the update() function -- update yours like s...
..., where every property of T is optional. We'll use it in the update() function -- update yours like so: function update(updatedTodo: Partial<TodoType>) { todo = { ...todo, ...updatedTodo } // applies modifications to todo dispatch('update', todo) // emit update event } With this we are telling TypeScript that the updatedTodo variable will hold a subset of the TodoType properties. Now svelte-check tells us that we have to define the type of our action function parameters: ./07-next-steps/src/components/Todo.svelte:45:24 Warn: Parameter 'node' implicitly has an 'any' type, but a better type may be inferred from usage. (ts) const focusOnInit = (node) => node && typeof node.focus === 'function' && node.focus() ./07-next-steps/src/components/Todo.svelte:47:28 Warn...
...: export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue } The | operator lets us declare variables that could store values of two or more types. A JsonValue could be a string, a number, a boolean, and so on. In this case we are also making use of recursive types, to specify that a JsonValue can have an array of JsonValue, and also an object with properties of type JsonValue. We will import our JsonValue type and use it accordingly. Update your localStore.ts file like this: // localStore.ts import { writable } from 'svelte/store' import type { JsonValue } from './types/json.type' export const localStore = (key: string, initial: JsonValue) => { // receives the key of the local storage and an initial value const toString = (valu...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Handling common HTML and CSS problems - Learn web development
YPE, 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 generally be customized to be stricter or more relaxed in the...
...be used in production websites -- they are subject to change or removal without warning, and cause cross browser issues. This is particularly a problem when developers decide to only use say, the -webkit- version of a property -- meaning that the site won't work in other browsers. This actually happens so much that other browsers have started to implement -webkit- prefixed versions of various CSS properties, so they will work with such code. Usage of prefixes by browser vendors has declined recently precisely because of these types of problems, but there are still some that need attention. If you insist on using prefixed features, make sure you use the right ones. You can look up what browsers require prefixes on MDN reference pages, and sites like caniuse.com. If you are unsure, you can also find ...
...This is useful for finding out what versions of the property are implemented in that browser. At the time of writing, both Firefox and Chrome implemented -webkit- prefixed and non-prefixed versions of transform! Once you've found out which prefixes you need to support, you should write them all out in your CSS, for example: -ms-tr...
...E 10 and old versions of iOS/desktop Safari respectively support incompatible old versions of the flexbox spec. This results in some interesting browser prefix juggling if you want to try to use flexbox across all these browsers (see Advanced Cross-Browser Flexbox to get an idea). Layout features aren't as easy to provide graceful fallbacks for as simple colors, shadows, or gradients. If layout properties are ignored, your entire design will likely fall to pieces. Because of this, you need to use feature detection to detect whether visiting browsers support those layout features, and selectively apply different layouts depending on the result (we will cover feature detection in detail in a later article). For example, you could apply a flexbox layout to modern browsers, then instead apply a float...
Accessibility/LiveRegionDevGuide
/AT-SPI point of view as part of the Orca Live Region Support project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2. Sometimes the very best guide for some developers is the code itself. Please refer to the liveregions and Gecko Python modules in Orca for a real world example. For more information about Live Regions, please read the ARIA properties spec or the live region report to learn about ARIA Live Region markup and the Live Region API Support document for the latest Firefox API with regards to Live Regions. As always, we're open to questions and suggestions for changes in community forums. Priority Queue The heart of any live region support module is the priority queue. It is responsible for queuing messages derived from live regi...
...on API Support document for the latest Firefox API with regards to Live Regions. As always, we're open to questions and suggestions for changes in community forums. Priority Queue The heart of any live region support module is the priority queue. It is responsible for queuing messages derived from live region events, where priority is determined by chronological order and the live politeness properties. In addition to the standard priority queue methods, additional methods will need to be implemented that purge the queue based on one of the priority criterion. The "purge by timestamp" method will be used to remove old messages that are no longer deemed relevant while "purge by politeness" is used to satisfy the ARIA live politeness specification. The later method will be explained in detail bel...
...o a list, trigger both an object changed and a text changed event. Both events should not be acted upon or double announcements would result. Instead, all text changed events should be examined for the presence of an embed character. If one is present, the text changed event should be discarded because an object changed event will follow. Filtering User Actions This paragraph describes object properties and event naming schemes that are used to help an AT determine if an event is an actual live region event or is the result of user action. Filtering for Performance The most significant difference between AT-SPI and IAccessible2 is that AT-SPI is an inter-process communication service while IAccessible2 runs in process. As a result, care must be taken in an AT-SPI based application to minimize...
...LECTABLE is not a live region. An event containing an object that has the attribute "container-live" is a live region. However, many web sites do not have proper ARIA markup so this cannot be used by itself. An event containing an object that has an attribute "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 pr...
mozbrowsercontextmenu
ilities between implementations and the behavior may change in the future. The mozbrowsercontextmenu event is fired when the user tried to access a context menu over a browser <iframe>. This event can be used to control what will appear in the menu. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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 ...
...A Menu object (see The Menu object, below) representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the DOM element clicked on, which contains the menu's id. contextmenuItemSelected An anonymous function that fires when a menu item is selected. The MenuSystem object An object defining a standard context menu that will be displayed. Its properties are as follows: documentURI A DOMString representing the URL of the document the menu is associated with. uri A DOMString. In the case of an image or video context menu, this is the src of the image or video clicked on to get the context menu. In the case of an link context menu, it is the link's href. text A DOMString representing the text of the link clicked on, in the case of a link co...
... context menu. method A DOMString representing the method of a form, in the case of a form context menu. name A DOMString representing the name of a form, in the case of a form context menu. The Menu object An object representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the DOM element clicked on, which contains the menu's id. Its properties are as follows: type A DOMString representing the type of context menu displayed. It can be menu (a full menu) or menuitem (a single menu item.) label A DOMString equal to the label attribute of the DOM node the context menu is accessed on. icon The menu item's icon, if the context menu being accessed is a menu item. id The menu item's id, if the context menu being accessed is a menu it...
JavaScript Tips
an XUL overlay, wrap functions and variables inside an object with a unique name to avoid conflicting with existing or future function and variable names. var UniqueName = { _privateMember: 3, publicMember: "A string", init: function() { this.doSomething(this.anotherMember); }, doSomething: function(aParam) { alert(aParam); } }; XPConnect Don't use object methods and properties more than you have to. It is often faster to store the result in a temporary variable. Don't call methods that you don't have to. For instance, windowManager.getEnumerator(aType).hasMoreElements() may be replaced with windowManager.getMostRecentWindow(aType) != null for a single window. Don't query interfaces unless you need to access methods and properties of that interface. You do not have to...
...ists, call hasAttribute instead. Prefer to loop through childNodes rather than using first/lastChild with next/previousSibling. But prefer hasChildNodes() to childNodes.length > 0. Similarly prefer document.getElementsByTagName(aTag).item(0) != null to document.getElementsByTagName(aTag).length > 0. Prefer to use localName rather than tagName. XUL elements have many of the attributes mapped to properties. ...
...childNodes rather than using first/lastChild with next/previousSibling. But prefer hasChildNodes() to childNodes.length > 0. Similarly prefer document.getElementsByTagName(aTag).item(0) != null to document.getElementsByTagName(aTag).length > 0. Prefer to use localName rather than tagName. XUL elements have many of the attributes mapped to properties. This was done for a reason, so use them! The properties are: align allowEvents contextMenu datasources dir flex height id left maxHeight maxWidth minHeight minWidth observes orient pack persist ref statusText top tooltip tooltipText width XUL also maps the ordinal attribute but this defaults to "1" if it is not present. XUL also maps the class attribute, but unfortunately...
...atusText top tooltip tooltipText width XUL also maps the ordinal attribute but this defaults to "1" if it is not present. XUL also maps the class attribute, but unfortunately class is a reserved identifier, so the property is named className. (The property could have been implemented as ["class"'] but that just looks silly.) XUL also maps the hidden and collapsed attributes to properties, but note that these are boolean properties whereas the above list are all string properties. XUL also maps other useful properties and methods using XBL bindings; these vary from element to element. For best performance give ids to all important elements. However in addition to locating elements by tag name XUL also allows you to locate an element by attribute, starting at any element in the d...
Addon
An Addon represents an add-on that is either installed or can be installed. Instances can be created using the many getAddon methods on the AddonManager object. The interface can represent many different kinds of add-ons and as such, some of the methods and properties are considered "required" and others "optional," which means that the optional methods or property may not exist on Addon instances for some types of add-ons. API consumers should take care to verify the existence of these methods or properties before relying on them. Overview of required methods void isCompatibleWith(in string appVersion, in string platformVersion) void findUpdates(in UpdateListener listener, in integer reason, in string appVersion, in string platformVersion) Overview of optional methods ...
... blocklistState Read only integer The current blocklist state of this add-on; see nsIBlocklistService for possible values. creator Read only AddonAuthor The crea...
... 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 functional. For some add-ons this will change immediately based on the appDisabled and userDisabled properties; for others it will only change after an application restart. isCompatible Read only boolean True or false depending on whether the add-on is compatible with the current application version and platform version. isPlatformCompatible Read only boolean True or false depending on whether the add-on is compatible with the current operating system. name Read on...
...ating or cannot be updated at all. scope Read only integer Indicates what scope the add-on is installed in, per profile, user, system, or application. type Read only string The type of the add-on. userDisabled boolean True if the user wants this add-on to be disabled. version Read only string The version of the add-on. Optional properties Attribute Type Description aboutURL Read only string The URL of the about dialog to display 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 in...
CustomizableUI.jsm
ntainer) Fired when a widget's DOM node is not overflowing its container, a toolbar, anymore. onWindowOpened(aWindow) Fired when a new customizable (ie browser) window is opened. onWindowClosed(aWindow) Fired when a customizable (ie browser) window is closed. ...
...s regarding customization. Parameters aListener the listener object to add removeListener() Remove a listener added with addListener. Parameters aListener the listener object to remove registerArea() Register a customizable area with CustomizableUI. Parameters aAreaId The name of the area to register. Can only contain alphanumeric characters, dashes (-) and underscores (_). aProperties The properties of the area. The following properties are recognized: Property Description type The type of area. Either TYPE_TOOLBAR (default) or TYPE_MENU_PANEL. anchor For a menu panel or overflowable toolbar, the anchoring node for the panel. legacy Set to true if you want CustomizableUI to automatically migrate the currentset a...
...s have finished (that is, there has been 1 endBatchUpdate call for each beginBatchUpdate call). If any of the endBatchUpdate calls pass aForceDirty=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 descri...
... whose place we need to check Return value "toolbar" if the node is in a toolbar, "panel" if it is in the menu panel, "palette" if it is in the (visible!) customization palette, undefined otherwise. isBuiltinToolbar() Check if a toolbar is builtin or not. Parameters aToolbarId the ID of the toolbar you want to check Return value true if the toolbar is builtin, false otherwise. Properties For readability, the properties are split according to purpose: Dynamic getters Attribute Type Description areas Array Always returns an up to date Array of all the area IDs that are currently registered with CustomizableUI. inDefaultState bool Whether we're in a default state. Note that non-removable non-default widgets and non-existing widget...
PopupNotifications.jsm
isplaying popup notification panels. Note: This code module is imported by Firefox chrome windows, so you don't have to do it yourself in most extensions. Method overview void locationChange(); Notification getNotification(id, browser); void remove(notification); Notification show(browser, id, message, anchorID, mainAction, secondaryActions, options); Properties Attribute Type Description isPanelOpen Boolean Returns true if the notification panel is currently visible, false if it is not. Methods locationChange() The consumer can call this method to let the popup notification module know that the current browser's location has changed. This lets the notification service update the active notifications as appropriate...
...ject uses the notification-popup-box element). mainAction A JavaScript object literal 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 display...
...ject 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. ...
... timeout A timestamp (milliseconds since the epoch) indicating the earliest time after which the notification can be automatically dismissed. ...
WebRequest.jsm
The WebRequest API is modeled on Chrome's webRequest extension API, which makes it easier to write cross-browser add-on code. There are some differences between this API and Chrome's, though: see Chrome incompatibilities for the details. Usage To import WebRequest, use code like: let {WebRequest} = Cu.import("resource://gre/modules/WebRequest.jsm", {}); The WebRequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onBeforeRequest onBeforeSendHeaders onSendHeaders onHeadersReceived onResponseStarted onCompleted Each of these objects defines two functions: addListener(callback, filter, opt_extraInfoSpec) removeListener(callback) Adding listeners Use addListener to add a listener to a particular event. It takes one man...
...mples of using addListener(). To remove a listener for an event, call removeListener on the event in question, passing it the listener to remove. Filtering The filter argument is the second argument to addListener(). If you don't pass filter, then the listener is invoked for every web request the browser makes that triggers that particular event. filter is an object that may contain up to two properties: urls and types. Name Type Description urls MatchPattern Only invoke the listener for URLs that match one of the patterns. types Array of Strings. An array of resource types. Only invoke the listener for resource types that match one of the types given. To specify match patterns, first import the "MatchPattern.jsm" module, then construct a ...
... HTTP headers. See some examples of canceling, redirecting, and modifying request headers. Events The events exported by WebRequest.jsm are triggered at the various stages of making a request. This section describes the stage corresponding 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...
...nd of resource being fetched. It's used in two places: filtering requests by type, and as the type property of the argument passed to the listener. The following types are supported: "main_frame" "sub_frame" "stylesheet" "script" "image" "object" "xmlhttprequest" HTTP headers HTTPs headers are represented as objects with two properties, name and value: Name Type Description name String Header name, for example "Content-Type" value String Header value, for example "image/png" Chrome incompatibilities Although this API is modeled on Chrome's webRequest extension API, there are some differences. We're working on addressing them, though. filtering by windowId and tabId is...
Localization content best practices
established format for localization comments: it's important to follow the format as closely as possible, since there are a number of automated tools that parse these comments for easier access and use by localizers. DTD files <!-- LOCALIZATION NOTE (entity name): {{privacy}} will be replaced at run-time by an active link. the string 'privacy-link' will be used as text for this link. --> Properties files # LOCALIZATION NOTE(privacy-text): {{privacy}} will be replaced at run-time by an # active link. the string 'privacy-link' will be used as text for this link. privacy-text = By proceeding you accept the {{privacy}}. privacy-link = Privacy Terms File-wide comments should use the same format, they should be at the top of the file (after the license header) and just drop the (entity name/ke...
...'t hardcode characters Typically white spaces, commas, or other separators (":", "|"). If you need a trailing white space in a string, use the Unicode character \u0020 (that's usually a bad sign, you're concatenating it to another string). At some point, someone will accidentally trim that whitespace. Remove unused strings If you're removing features, don't leave around unused strings in the .properties file. Tooltips If a string is used as a tooltip, it should not end in a period (in English). Tooltips are never written in imperative mood but infinitive mood instead. Hence the proper absence of periods to indicate this isn't just a matter of consistency for en-US, as it is also vital info for localizers. Menu and control labels The labels on controls and menu titles, menu option strings, an...
...shortcuts When translating Firefox strings from /devtools/ folder, you may see some keys like this: inspector.searchHTML.key=CmdOrCtrl+F The first part of the string `CmdOrCtrl` should not be translated. You may only translate the letter to better match your locale. This key shortcut definition matches the Electron key shortcut definition. Create localizable UI CSS issues Some CSS text/font properties may cause problems with text legibility when applied to certain language texts. Avoid using Italic for CJKT. This acronym stands for: Chinese (Simplified and Traditional), Japanese, Korean, and Taiwanese. The text-transform property is not reliable for some locales; for example, text-transform: uppercase won't work properly with languages such as Irish/Gaelic. For example, App Size in English...
... W3C has a good guide on the length ratios a developer should be prepared for. Test localizability As a developer, you should always test your patches not just for code errors, but also for localizability issues in case they involve string or UI changes. Gecko and mozilla-central First, make sure that there are no hard-coded strings, and all strings are available in localization files (.dtd, .properties). One possible way to test a patch for localizability issues is to alter the en-US localization files, adding extraneous characters to the original strings: this can help to identify both hard-coded strings and "flexibility issues" in the UI. Changing existing strings Updating Entity Names If you are changing a string such that its meaning has changed, you must update the entity or property na...
Using the viewport meta tag to control layout on mobile browsers
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 how users are allowed to zoom the page in or out. Usage of user-scalable=no can cause accessibility issues to users with visual impairments such as low vision. A pixel is not a pixel In recent years, screen resolutions have risen to the size that individual pixels are hard to distinguish with the human eye. For example, recent smartphones generally have a 5-inch screens with resoluti...
... high dpi screens, pages with initial-scale=1 will effectively be zoomed by browsers. Their text will be smooth and crisp, but their bitmap images will probably not take advantage of the full screen resolution. To get 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 ...
... viewport width. For example, if your layout needs at least 500 pixels of width then you can use the following markup. When the screen is more than 500 pixels wide, the browser will expand the viewport (rather than zoom in) to fit the screen: <meta name="viewport" content="width=500, initial-scale=1"> Other attributes that are available are minimum-scale, maximum-scale, and user-scalable. These properties affect the initial scale and width, as well as limiting changes 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 switchin...
...ment CSS Device AdaptationThe definition of '<meta name="viewport">' in that specification. Working Draft Non-normatively describes the Viewport META element There is clearly demand for the viewport meta tag, since it is supported by most popular mobile browsers and used by thousands of web sites. It would be good to have a true standard for web pages to control viewport properties. As the standardization process proceeds, we at Mozilla will work to keep up to date with any changes. ...
Mozilla Style System Documentation
c style changes are also tricky because the style contexts don't have pointers 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 *d...
...format [element type: rule node]: [doc: B] ,------------' | `-----------. [title: C] [para: F] [para: D] | | [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 cont...
...ts. 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 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 specif...
...er rule node every time they are needed. The code that does this sharing work is mostly in nsStyleContext::GetStyleData, nsRuleNode::GetStyleData, and nsRuleNode::WalkRuleTree. When nsRuleNode::WalkRuleTree computes a struct, it walks the rules, starting with the style context's rule node, towards the root of the rule tree. It uses the appropriate declaration struct and has each rule fill in any properties specified by that rule that are not filled in already. The walking stops when all of the properties are filled in or when the root of the rule tree is reached. Then the style struct is computed from the declaration and stored at the appropriate location in the rule tree or on the style context. Problems: Dynamic style changes often destroy too much data. CSS Stylesheet backend CSS Stylesheet L...
JSAPI Cookbook
ror types, such as SyntaxError or TypeError, use JS_ReportErrorNumber instead. JavaScript also supports throwing any value at all, not just Error objects. Use JS_SetPendingException to throw an arbitrary JS::Value from C/C++. // JavaScript throw exc; /* JSAPI */ JS_SetPendingException(cx, exc); return false; When JS_ReportError creates a new Error object, it sets the fileName and lineNumber properties to the line of JavaScript code currently at the top of the stack. This is usually the line of code that called your native function, so it's usually what you want. JSAPI code can override this by creating the Error object directly and passing additional arguments to the constructor: // JavaScript throw new Error(message, filename, lineno); /* JSAPI */ bool ThrowError(JSContext *cx, JSObject *g...
...ending. * It will be automatically restored when we return, unless we call savedState.drop(). */ JS::AutoSaveExceptionState savedState(cx); if (!JS_CallFunctionName(cx, global, "cleanup", 0, NULL, &r)) { /* The new error replaces the previous one, so discard the saved exception state. */ savedState.drop(); return false; } return success; Object properties Getting a property // JavaScript var x = y.myprop; The JSAPI function that does this is JS_GetProperty. It requires a JSObject * argument. Since JavaScript values are usually stored in JS::Value variables, a cast or conversion is usually needed. In cases where it is certain that y is an object (that is, not a boolean, number, string, null, or undefined), this is fairly straightforward. Use J...
... You can use this function to create a constant property, one that can't be overwritten or deleted. Specify writable: false to make the property read-only and configurable: false to prevent it from being deleted or redefined. The flag enumerable: true causes this property to be seen by for-in loops. // JavaScript Object.defineProperty(obj, "prop", {value: 123, ...
...hese settings, simply omit the property attribute bits you don't want. /* JSAPI */ if (!JS_DefineProperty(cx, obj, "prop", INT_TO_JSVAL(123), JS_PropertyStub, JS_StrictPropertyStub, JSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT)) { return false; } Defining a property with a getter and setter Object.defineProperty() can be used to define properties in terms of two accessor functions. // JavaScript Object.defineProperty(obj, "prop", {get: GetPropFunc, set: SetPropFunc, enumerable: true}); In the JSAPI version, GetPropFunc and SetPropFunc are C/C++ functions of type JSNative. /* JSAPI */ if (!JS_DefineProperty(cx, obj, "prop", JS::UndefinedValue(), ...
JS::CompileOptions
t handler content attribute or an event handler IDL attribute, this returns the name of that attribute, a string. Otherwise, this returns NULL. JSScript *introductionScript() const Returns a pointer to JSScript which introduces the file. bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) Copy compile options from rhs. Returns false if it failed to duplicate owning properties. bool setFile(JSContext *cx, const char *f) Duplicate null-terminated string f for filename(). Returns false if it failed to duplicate. bool setFileAndLine(JSContext *cx, const char *f, unsigned l) Duplicate null-terminated string f for filename() and set lineno property. Returns false if it failed to duplicate. bool setSourceMapURL(JSContext *cx, const char16_t *...
... l) OwningCompileOptions &setIntroductionType(const char *t) bool setIntroductionInfo(JSContext *cx, const char *introducerFn, const char *intro, unsigned line, JSScript *script, uint32_t offset) Duplicate null-terminated string introducerFn for introducerFilename and set introductionType, introductionLineno, introductionScriptRoot, introductionOffset, and hasIntroductionInfo properties. Returns false if it failed to duplicate. Methods of JS::CompileOptions Method Description JSObject *element() const Same as JS::OwningCompileOptions. JSString *elementAttributeName() const JSScript *introductionScript() const CompileOptions &setFile(const char *f) Sets each property and returns the instance itself. CompileOpt...
... versionSet bool true if version is set. utf8 bool true if the character set of the source code is UTF-8. lineno unsigned Line number of the first line of the source code (1-origin). column unsigned Colum...
... versionSet bool true if version is set. utf8 bool true if the character set of the source code is UTF-8. lineno unsigned Line number of the first line of the source code (1-origin). column unsigned Column number of th...
JS_DefineFunctions
Name Type Description cx JSContext * The context in which to define functions. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
... JSContext. obj JS::Handle&lt;JSObject*&gt; The object on which functions are to be defined. fs const JSFunctionSpec * A NULL-terminated array of function specifications. Each element of the array defines an individual function. behavior PropertyDefinitionBehavior See below. Added in SpiderMonkey 38 enum PropertyDefinitionBehavior { DefineAllProperties, OnlyDefineLateProperties, DontDefineLateProperties }; Name Description DefineAllProperties Define all properties regardless of their flags. OnlyDefineLateProperties Define only properties which have a JSPROP_DEFINE_LATE flag. DontDefineLateProperties Define only properties which have no JSPROP_DEFINE_LATE flag. Description JS_Defi...
... 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. ...
...ement 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, it stops defining functions and returns false. See Also MXR ID Search for JS_DefineFunctions JS_CallFunctionName JS_DefineObject JS_DefineProperties JS_NewFunction bug 959787 - make fs type...
Property attributes
getter is a JavaScript Function, not a C/C++ function. See JS_DefineProperty for details. MXR ID Search for JSPROP_GETTER JSPROP_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...
...pects of inheriting the property via the prototype chain are affected. Do not depend on this. See bug 575997. MXR ID Search for JSPROP_SHARED JSPROP_INDEX The property's id is represented internally as an integer, not a string. Obsolete since JSAPI 39 This flag has an additional special meaning when used with JS_DefineProperty, JS_FS, and other APIs that define properties: it means that the name parameter is actually an integer unsafely cast to a pointer type, not a string. MXR ID Search for JSPROP_INDEX JSPROP_DEFINE_LATE Don't define property when initially creating the constructor. Some objects like Function/Object have self-hosted functions that can only be defined after the initialization is already finished. Added in SpiderMonkey 38...
...NFIGURABLE If set, will allow redefining a non-configurable property, but only on a non-DOM global. This is a temporary hack that will need to go away in bug 1105518. Added in SpiderMonkey 38 MXR ID Search for JSPROP_REDEFINE_NONCONFIGURABLE JSPROP_RESOLVING Resolve hooks and enumerate hooks must pass this flag when calling JS_Define* APIs to reify lazily-defined properties. JSPROP_RESOLVING is used only with property-defining APIs. It tells the engine to skip the resolve hook when performing the lookup at the beginning of property definition. This keeps the resolve hook from accidentally triggering itself: unchecked recursion. For enumerate hooks, triggering the resolve hook would be merely silly, not fatal, except in some cases involving non-configurable...
... JSPROP_RESOLVING is used only with property-defining APIs. It tells the engine to skip the resolve hook when performing the lookup at the beginning of property definition. This keeps the resolve hook from accidentally triggering itself: unchecked recursion. For enumerate hooks, triggering the resolve hook would be merely silly, not fatal, except in some cases involving non-configurable properties. Added in SpiderMonkey 45 MXR ID Search for JSPROP_RESOLVING JSPROP_IGNORE_ENUMERATE Ignore the value in JSPROP_ENUMERATE. This flag only valid when defining over an existing property. Added in SpiderMonkey 38 MXR ID Search for JSPROP_IGNORE_ENUMERATE JSPROP_IGNORE_READONLY Ignore the value in JSPROP_READONLY. This flag only valid when defi...
Parser API
o available since Firefox 7; it can be imported into the global object via: Components.utils.import("resource://gre/modules/reflect.jsm") or into a specified object via: Components.utils.import("resource://gre/modules/reflect.jsm", obj) Built-in objects Whether in SpiderMonkey shell or Firefox (after importing), the global singleton object Reflect currently contains just the parse method. Properties of the Reflect object The Reflect object currently consists of a single method. Reflect.parse(src[, options]) Coerces src to a string and parses the result as a JavaScript program. By default, the parsing returns a Program object (see below) representing the parsed abstract syntax tree (AST). Additional options may be provided via the options object, which can include any of the following pro...
...under Builder Objects. target String Default: script A type of the parsing target, can be either script or module. If parsing fails due to a syntax error, an instance of SyntaxError is thrown. The syntax error object thrown by Reflect.parse() has the same message property as the syntax error that would be thrown by eval(src). The lineNumber and fileName properties of the syntax error object indicate the source location of the syntax error. Node objects By default, Reflect.parse() produces Node objects, which are plain JavaScript objects (i.e., their prototype derives from the standard Object prototype). All node types implement the following interface: interface Node { type: string; loc: SourceLocation | null; } The type field is a string repr...
...nd side of an assignment may be any expression in general, an expression can also be a pattern. interface ThisExpression <: Expression { 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", respectiv...
...destructuring pattern. Since the left-hand 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 | ...
Split object
er than Mozilla that embed SpiderMonkey should avoid using split objects. The window object Split objects were introduced to resolve a problem posed by the window object. Three interrelated requirements on the window object seemed to conflict. The window object is the global object for scripts in Web pages. Firefox has to maintain this for Web compatibility. For performance, access to global properties must be fast. There is a glaring difference in the lifetime of the window object as seen from two different angles. Suppose a script in page A, in tab TA, has a reference to the window object of page B in another tab TB. The window object for tab TB must persist as the user navigates from page to page in that tab. To the script in page A, the window must appear to be a single object that ...
...n by calling it, it is indirectly accessing tab TB's window. The Function object carries a reference to the window, via the scope chain. To further complicate matters, A and B are in the same security domain, so security checks between them automatically succeed. This makes the problem resistant to a wrapper-based approach.) Older versions of Firefox accomplished this by blowing away all window properties every time a user navigated to another page, then reusing the window. Each page, even on Back, had to load from scratch. This was slow. Circa Firefox 1.5, the decision was made to cache layout information and JavaScript state across navigation. A new approach for window was needed. Security privileges are granted to JS code on the basis of the scope chain of the executing code. SpiderMonk...
...ects. ...And yet, there is special code in jsobj.h with a comment about fixing some kind of interaction between with an split objects. Write that down, it'll be on the test.) Split objects were the solution. The inner window object is different for each page a browser window visits. It serves as the "globals" object and provides the JSPrincipals for scripts on that page. Access to inner window properties is fast. The outer window object is the object returned by window.open. It represents the window or tab itself and survives as the user navigates in that window or tab. The window object's JSClass.resolve hook ensures that properties of the inner object are visible via the outer object, if the running code has the right principals to access them. This privilege check may be slow. See wikimo:Gecko...
.... Inner and outer objects are in certain other respects the same object: If Object.hasOwnProperty is called on an inner object, and the named property is found on an outer object, that's considered close enough and hasOwnProperty returns true. Note that none of the rules listed here affects ordinary property accesses. SpiderMonkey's split object support, by itself, does not cause inner object properties to appear on the outer object or vice versa. Split objects that need this behavior must implement it in custom JSClass hooks. In the case of window, each half has custom hooks. ...
XForms Accessibility
as stripped out as it was believed the focus model was dependent on the content which used it. So, yes we don't care about navindex in XForms. 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. ...
...n the content which used it. So, yes we don't care about navindex in XForms. 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. ...
...ccessible 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 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 ...
... listbox checkboxes group select1 Allows the user to choose a single value from a list of pre-defined values (see the spec, the docs). It can have the following representations: combobox listbox radio group Additional Elements These elements may be used as child elements to the form controls described above. Some of these elements are not accessible itself but they makes accessibility properties for XForms elements that hold them. label Specifies the label for the xforms control (see the spec, the docs). Every form control other than the output element must contain a label element. The value of label element is used as name of accessible object. help Specifies contextual help for the containing form control (see the spec, the docs). The help element has ROLE_ALERT role. hint Simila...
Components.classes
Note that Components.classes reflects only those component classes that have been previously installed and registered with the component manager using ContractIDs. ...
... Note that Components.classes reflects only those component classes that have been previously installed and registered with the component manager using ContractIDs. ...
... Note that Components.classes reflects only those component classes that have been previously installed and registered with the component manager using ContractIDs. ...
...er 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 array as follows: var clazz0 = Components.classes["@mozilla.org/messenger;1"]; clazz0 is the class object for the ContractID @mozilla.org/messenger;1, which is not usually used by itself, but whose createInstance and getS...
nsDirectoryService
rence Summary The XPCOM Directory Service. This service returns the locations of "well known" directories in an OS-independent manner. For instance, it can give you the path of the system's temporary directory, desktop directory, current working directory, and so on. Class ID f00152d0-b40b-11d3-8c9c-000064657374 ContractID @mozilla.org/file/directory_service;1 Supported Interfaces nsIProperties nsIDirectoryService Remarks This component is a singleton and should therefore be accessed via the XPCOM Service Manager. Example Code #include "nsXPCOM.h" #include "nsCOMPtr.h" #include "nsDirectoryServiceDefs.h" #include "nsIServiceManager.h" #include "nsIProperties.h" /** * Get the location of the system's "temp" directory. */ nsresult GetTempDir(nsIFile **aResult) { nsresul...
... #include "nsXPCOM.h" #include "nsCOMPtr.h" #include "nsDirectoryServiceDefs.h" #include "nsIServiceManager.h" #include "nsIProperties.h" /** * Get the location of the system's "temp" directory. ...
...location of the system's "temp" directory. ...
... NS_GET_IID(nsIProperties), getter_AddRefs(directory)); if (NS_FAILED(rv)) return rv; rv = directory->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), aResult); return rv; } Note that NS_OS_TEMP_DIR is defined in nsDirectoryServiceDefs.h along with a number of other Directory Service keys. ...
nsIStringBundle
Inherits from: nsISupports Last changed in Gecko 1.7 This interface is used by XUL:stringbundle to retrieve strings. It is recommended that you use the methods of XUL:stringbundle to access these functions unless necessary. Alternatively, a string bundle can be created within a javascript context with nsIStringBundleService. ...
...formatStringFromID() Returns a formatted string with the given ID from the string bundle, where each occurrence of %S (uppercase) is replaced by each successive element in the supplied array. You may also use other formatting codes. You can only pass Unicode strings in. The ID should refer to a string in the bundle that uses %S, and the number of strings you pass MUST be the same here and in the properties file (That is you can't omit %1 and use only %2). Do NOT try to use any other types. This uses nsTextFormatter::smprintf. wstring formatStringFromID( in long aID, [array, size_is(length)] in wstring params, in unsigned long length ); Parameters aID The ID of the string to retrieve. params Parameters to pass in to the string. length The length of the parameter list. Return value...
...ngFromName() Returns a formatted string with the given key name from the string bundle, where each occurrence of %S (uppercase) is replaced by each successive element in the supplied array. You may also use other formatting codes, but can only pass Unicode strings in. The name should refer to a string in the bundle that uses %S, and the number of strings you pass MUST be the same here and in the properties file (That is you can't omit %1 and use only %2). Do NOT try to use any other types. This uses nsTextFormatter::smprintf to do the dirty work. wstring formatStringFromName( in wstring aName, [array, size_is(length)] in wstring params, in unsigned long length ); Parameters aName The name of the string to retrieve. params Parameters to pass in to the string. length The length of th...
... 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 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 nsIStringBu...
nsIStringBundleService
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 createExtensible...
... nsIStringBundle 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 u...
... flushBundles() Flushes the string bundle cache - useful when the locale changes or when we need to get some extra memory back. ...
...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 properties file(s) have been registered. Return value An extensible bundle corresponding to the properties file(s). 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. formatStatusMessage() Formats a message string from a status code and status arguments. Typically used to format a message...
DevTools API - Firefox Developer Tools
ool with the given ID has finished its initialization and is ready to be used. The panel is the object returned by the ToolDefinition.build() method. {toolId}-destroy(toolbox, panel) A tool with the given ID is about to be destroyed. The panel is the object returned by the ToolDefinition.build() method. Toolbox A Toolbox is a frame for the ToolPanels that is debugging a specific target. Properties target Target. The Target this toolbox is debugging. hostType Toolbox.HostType. The type of the host this Toolbox is docked to. The value is one of the Toolbox.HostType constants. zoomValue The current zoom level of the Toolbox. Constants The Toolbox constructor contains following constant properties. Toolbox.HostType.BOTTOM Host type for the default toolbox host at...
... The Toolbox the tool is being built for. Return value: A ToolPanel for the tool. onKey(panel, toolbox) Optional. A method that is called when the keyboard shortcut for the tool is activated while the tool is the active tool. Parameters: panel {ToolPanel} - The ToolPanel for the tool. toolbox {Toolbox} - The toolbox for the shortcut was triggered for. Return value: Undefined. Properties The ToolDefinition object can contain following properties. Most of them are optional and can be used to customize the presense of the tool in the Browser and the Toolbox. id String, required. An unique identifier for the tool. It must be a valid id for an HTML Element. url String, required. An URL of the panel document. label String, optional. The tool's name. If undefined t...
...w tab has been added {tabId}-ready Tab is loaded and can be used {tabId}-selected Tab has been selected and is visible {tabId}-unselected Tab has been unselected and is not visible show The sidebar has been opened. hide The sidebar has been closed. Examples Register a tool gDevTools.registerTool({ // FIXME: missing key related properties. ...
... hide The sidebar has been closed. Examples Register a tool gDevTools.registerTool({ // FIXME: missing key related properties. ...
Web Console remoting - Firefox Developer Tools
"sourceName": "http://localhost/~mihai/mozilla/test.js", "lineText": "", "lineNumber": 6, "columnNumber": 0, "category": "content javascript", "timeStamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } The packet is similar to nsIScriptError - for simplicity. We only removed several unneeded properties and changed how flags work. The private flag tells if the error comes from a private window/tab (added in Firefox 24). Starting with Firefox 24 the errorMessage and lineText properties can be long string actor grips if the string is very long. Console API messages The window.console API calls send internal messages throughout Gecko which allow us to do whatever we want for each call. The Web ...
...soleObj20" }, " 960 739 3.141592653589793 %a", "zuzu", { "type": "null" }, { "type": "undefined" } ] } } Similar to how we send the page errors, here we send the actual console event received from the nsIObserverService. We change the arguments array - we create ObjectActor instances for each object passed as an argument - and, lastly, we remove some unneeded properties (like window IDs). In the case of long strings we use the LongStringActor. The Web Console can then inspect the arguments. The private flag tells if the console API call comes from a private window/tab (added in Firefox 24). We have small variations for the object, depending on the console API call method - just like there are small differences in the console event object received from the obse...
... "exceptionMessage": null, "helperResult": null } exception holds the JSON-ification of the exception thrown during evaluation. exceptionMessage holds the exception.toString() result. result has the result ObjectActor instance. helperResult is anything that might come from a JSTerm helper result, JSON stuff (not content objects!). In Firefox 23: we renamed the error and errorMessage properties to exception and exceptionMessage respectively, to avoid conflict with the default properties used when protocol errors occur. Autocomplete and more The autocomplete request packet: { "to": "conn0.console9", "type": "autocomplete", "text": "d", "cursor": 1 } The response packet: { "from": "conn0.console9", "matches": [ "decodeURI", "decodeURIComponent", "defaultStat...
...ons to the evaluateJS request packet. Firefox 24: new private flags for the console actor notifications, bug 874061. Also added the lastPrivateContextExited notification for the global console actor. Firefox 24: new isXHR flag for the networkEvent notification, bug 859046. Firefox 24: removed the message property from the pageError packet notification, bug 877773. The lineText and errorMessage properties can be long string actors now. Firefox 25: added the url option to the evaluateJS request packet. Firefox 25: added the getPreferences and sendHTTPRequest request packets to the console actor, bug 886067 and bug 731311. Conclusions As of this writing, this document is a dense summary of the work we did in bug 768096 and subsequent changes. We try to keep this document up-to-date. We hope thi...
Attr - Web APIs
Web › API › Attr
Properties name Read only The attribute's name. namespaceURI Read only A DOMString representing the namespace URI of the attribute, or null if there is no namespace. localName Read only A DOMString representing the local part of the qu...
... Properties name Read only The attribute's name. ...
...nchor="middle" alignment-baseline="middle">Attr</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Warning: Starting in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), a number of deprecated properties and methods output warning messages to the console. You should revise your code accordingly. See Deprecated properties and methods for a complete list. Properties name Read only The attribute's name. namespaceURI Read only A DOMString representing the namespace URI of the attribute, or null if there is no namespace. localName Read only A DOMString representing the local part of the qualified name of the attribute. prefix Read only A DOMString representing the namespace prefix of the attribute, or null if no prefix is specified. ownerElement ...
...ribute 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, 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 attri...
AudioListener - Web APIs
The AudioListener 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-...
...ientation and position in Firefox, Internet Explorer and Safari. Deprecated features AudioListener.dopplerFactor A double value representing the amount of pitch shift to use when rendering a doppler effect. AudioListener.speedOfSound Is a double value representing the speed of sound, in meters per second. In a previous version of the specification, the dopplerFactor and speedOfSound properties and the setPosition() method could be used to control the doppler effect applied to AudioBufferSourceNodes connected downstream -- these would be pitched up and down according to the relative speed of the PannerNode and the AudioListener. These features had a number of problems: Only AudioBufferSourceNodes were pitched up or down, not other source nodes. The behavior to adopt when an AudioBuf...
...ad a number of problems: Only AudioBufferSourceNodes were pitched up or down, not other source nodes. The behavior to adopt when an AudioBufferSourceNode was connected to multiple PannerNodes was unclear. Because the velocity of the panner and the listener were not AudioParams, the pitch modification could not be smoothly applied, resulting in audio glitches. Because of these issues, these properties and methods have been removed. The setOrientation() and setPosition() methods have been replaced by setting their property value equivilents. For example setPosition(x, y, z) can be achieved by setting positionX.value, positionY.value, and positionZ.value respectively. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode wo...
...D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
BluetoothRemoteGATTCharacteristic - Web APIs
The BluetoothRemoteGattCharacteristic interface of the Web Bluetooth API represents a GATT Characteristic, which is a basic data element that provides further information about a peripheral's service. ...
... BluetoothRemoteGattCharacteristic interface of the Web Bluetooth API represents a GATT Characteristic, which is a basic data element that provides further information about a peripheral's service. ...
... BluetoothRemoteGATTCharacteristic.uuidRead only Returns a DOMString containing the UUID of the characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement characteristic. BluetoothRemoteGATTCharacteristic.propertiesRead only Returns t...
...isticEventHandlers; Properties BluetoothRemoteGATTCharacteristic.serviceRead only Returns the BluetoothGATTService this characteristic belongs to. BluetoothRemoteGATTCharacteristic.uuidRead only Returns a DOMString containing the UUID of the characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement characteristic. BluetoothRemoteGATTCharacteristic.propertiesRead only Returns the properties of this characteristic. BluetoothRemoteGATTCharacteristic.valueRead only The currently cached characteristic value. This value gets updated when the value of the characteristic is read or updated via a notification or indication. Methods BluetoothRemoteGATTCharacteristic.getDescriptor() Returns a Promise that resolves to the first BluetoothGATTDescriptor...
CSSStyleDeclaration - Web APIs
A CSSStyleDeclaration object can be exposed using three different APIs: Via HTMLElement.style, which deals with the inline styles of a single element (e.g., <div style="...">). Via the CSSStyleSheet API. For example, document.styleSheets[0].cssRules[0].style returns a CSSStyleDeclaration object on the first CSS rule in the document's first stylesheet. Via Window.getComputedStyle(), which exposes the CSSStyleDeclaration object as a read-only interface. ...
...les[0].style returns a CSSStyleDeclaration object on the first CSS rule in the document's first stylesheet. Via Window.getComputedStyle(), which exposes the CSSStyleDeclaration object as a read-only interface. Attributes CSSStyleDeclaration.cssText Textual representation of the declaration block. Setting this attribute changes the style. CSSStyleDeclaration.lengthRead only The number of properties. See the item() method below. CSSStyleDeclaration.parentRuleRead only The containing CSSRule. CSS Properties CSSStyleDeclaration.cssFloat Special alias for the float CSS property. CSSStyleDeclaration named properties Dashed and camel-cased attributes for all supported CSS properties. Methods CSSStyleDeclaration.getPropertyPriority() Returns the optional priority, "important". CS...
... 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 Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleDeclaration' in that specific...
... Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSStyleDeclaration' in that specification. Obsolete Initial definition ...
CSSValueList - Web APIs
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. ...
...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. ...
... CSSValueList.lengthRead only An unsigned long representing the number of CSSValues in the list. Methods CSSValueList.item() This method is used to retrieve a CSSValue by ordinal index. The order in this collection represents the order of the values in the CSS style property. If index is greater than or equal to the number of values in the...
... CSSValueList.lengthRead only An unsigned long representing the number of CSSValues in the list. Methods CSSValueList.item() This method is used to retrieve a CSSValue by ordinal index. The order in this collection represents the order of the values in the CSS style property. If index is greater than or equal to the number of values in the list, this returns n...
Using dynamic styling information - Web APIs
l> <head> <title>Modifying a stylesheet rule with CSSOM</title> <style type="text/css"> body { background-color: red; } </style> <script type="text/javascript"> var stylesheet = document.styleSheets[0]; stylesheet.cssRules[0].style.backgroundColor="blue"; </script> </head> <body> The stylesheet declaration for the body's background color is modified via JavaScript. </body> </html> The list of properties available in the DOM from the style property is given on the DOM CSS Properties List page. To modify styles to a document using CSS syntax, one can insert rules or insert <style> tags whose innerHTML property is set to the desired CSS. Modify an element's style The element style property (see also the section "DOM Style Object" below) can also be used to get and set the styles on an element. H...
...hapter for more information on how to use this method. DOM Style Object The style object represents an individual style statement. Unlike the individual rules available from the document.styleSheets collection, the style object is accessed from the document or from the elements to which that style is applied. It represents the in-line styles on a particular element. ...
... style object represents an individual style statement. Unlike the individual rules available from the document.styleSheets collection, the style object is accessed from the document or from the elements to which that style is applied. It represents the in-line styles on a particular element. ...
... 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. 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. ...
Console.table() - Web APIs
Web › API › Console › table
. 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. ...
...types The data argument may be an array or an object. ...
...sole.table(["apples", "oranges", "bananas"]); // an object whose properties are strings function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var me = new Person("John", "Smith"); console.table(me); Collections of compound types If the elements in the array, or properties in the object, are themselves arrays or objects, then their elements or properties are enumerated in the row, one per column: // an array of arrays var people = [["John", "Smith"], ["Jane", "Doe"], ["Emily", "Jones"]] console.table(people); // an array of objects function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var john = new Person("John", "Smith"); var jane = new Person("Jane", "Doe"); var emily = new Person("Emily", "J...
... // an array of objects function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var john = new Person("John", "Smith"); var jane = new Person("Jane", "Doe"); var emily = new Person("Emily", "Jones"); console.table([john, jane, emily]); Note that if the array contains objects, then the columns are labeled with the property name. // an object whose properties are objects var family = {}; family.mother = new Person("Jane", "Smith"); family.father = new Person("John", "Smith"); family.daughter = new Person("Emily", "Smith"); console.table(family); Restricting the columns displayed By default, console.table() lists all elements in each row. You can use the optional columns parameter to select a subset of columns to display: // an array of objects...
DocumentType - Web APIs
DocumentType.entities Read only A NamedNodeMap of entities declared in the DTD. Every node in this map implements the Entity interface. DocumentType.internalSubset Read only A DOMString of the internal subset, or null if there is none. Eg "<!ELEMENT foo (bar)>". DocumentType.name Read only A DOMStri...
... DocumentType.entities Read only A NamedNodeMap of entities declared in the DTD. Every node in this map implements the Entity interface. DocumentType.internalSubset Read only A DOMString of the internal subset, or null if there is none. Eg "<!ELEMENT foo (bar)>". DocumentType.name Read only A DOMString, eg "html" for <!D...
... methods from its parent, Node, and implements the ChildNode interface. ChildNode.remove() Removes the object from its parent children list. Specifications Specification Status Comment DOMThe definition of 'DocumentType' in that specification. Living Standard Added implemention of the ChildNode interface. Removed the internalSubset, entities, and notation properties. ...
... Document Object Model (DOM) Level 1 SpecificationThe definition of 'DocumentType' in that specification. ...
Introduction to the DOM - Web APIs
be accessed by various browsers with different DOMs. For example, the standard DOM specifies that the getElementsByTagName method in the code below must return a list of all the <p> elements in the document: const paragraphs = document.getElementsByTagName("p"); // paragraphs[0] is the first <p> element // paragraphs[1] is the second <p> element, etc. alert(paragraphs[0].nodeName); All of the properties, methods, and events available for manipulating and creating web pages are organized into objects (for example, the document object that represents the document itself, the table object that implements the special HTMLTableElement DOM interface for accessing HTML tables, and so forth). This documentation provides an object-by-object reference to the DOM. The modern DOM is built using multiple AP...
...ce: border attribute if(tableAttrs[i].nodeName.toLowerCase() == "border") table.border = "1"; } // HTMLTableElement interface: summary attribute table.summary = "note: increased border"; Core Interfaces in the DOM This section lists some of the most commonly-used interfaces in the DOM. The idea is not to describe what these APIs do here but to give you an idea of the sorts of methods and properties you will see very often as you use the DOM. These common APIs are used in the longer examples in the DOM Examples chapter at the end of this book. The document and window objects are the objects whose interfaces you generally use most often in DOM programming. In simple terms, the window object represents something like the browser, and the document object is the root of the document itself. Ele...
...s chapter at the end of this book. The document and window objects are the objects whose interfaces you generally use most often in DOM programming. In simple terms, the window object represents something like the browser, and the document object is the root of the document itself. Element inherits from the generic Node interface, and together these two interfaces provide many of the methods and properties you use on individual elements. These elements may also have specific interfaces for dealing with the kind of data those elements hold, as in the table object example in the previous section. The following is a brief list of common APIs in web and XML page scripting using the DOM. document.getElementById(id) document.getElementsByTagName(name) document.createElement(name) parentNode.append...
...The following screenshot gives you some idea of how interfaces can be grouped together for testing. Figure 0.1 Sample DOM Test Page In this example, the drop-down menus dynamically update such DOM--accessible aspects of the web page as its background c...
EffectTiming - Web APIs
Properties delay Optional The number of milliseconds to delay the start of the animation. Defaults to 0. ...
... Properties delay Optional The number of milliseconds to delay the start of the animation. Defaults to 0. ...
... Properties delay Optional The number of milliseconds to delay the start of the animation. Defaults to 0. ...
...by Element.animate(), KeyframeEffectReadOnly(), and KeyframeEffect() to describe timing properties for animation effects. These properties are all optional, although without setting a duration the animation will not play. Simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. Properties delay Optional The number of milliseconds to delay the start of the animation. Defaults to 0. direction Optional Whether the animation runs forwards (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 ite...
ElementCSSInlineStyle.style - Web APIs
The style property has the same (and highest) priority in the CSS cascade as an inline style declaration set via the style attribute. ...
... The 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. 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. 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 ...
...ighest) 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-case and not kebab-...
...untouched elt.style.color = "blue"; Getting style information The style property is not useful for completely learning about the styles applied on the element, since it represents only the CSS declarations set in the element's inline style attribute, not those that come from style rules elsewhere, such as style rules in the <head> section, or external style sheets. To get the values of all CSS properties for an element you should use Window.getComputedStyle() instead. The following code snippet demonstrates the difference between the values obtained using the element's style property and that obtained using the getComputedStyle() method: <!DOCTYPE HTML> <html> <body style="font-weight:bold;"> <div style="color:red" id="myElement">..</div> </body> </html> var element = document.getElem...
FileSystemFileEntry - Web APIs
Methods file() Creates a new File object which can be used to read the file. Obsolete methods createWriter() Creates a new FileWriter object which allows writing to the file represented by the file system entry. ...
... Methods file() Creates a new File object which can be used to read the file. ...
... Methods file() Creates a new File object which can be used to read the file. Obsolete methods createWriter() Creates a new FileWriter object which allows writing to the file represented by the file system entry. ...
... Methods file() Creates a new File object which can be used to read the file. Obsolete methods createWriter() Creates a new FileWriter object which allows writing to the file represented by the file system entry. ...
Fullscreen API - Web APIs
h many requiring vendor prefixes and/or not implementing the latest specification. See the Browser compatibility section below for details on support for this API. You may wish to consider using a library such as Fscreen for vendor agnostic access to the Fullscreen API. Interfaces The Fullscreen API has no interfaces of its own. Instead, it augments several other interfaces to add the methods, properties, and event handlers needed to provide full-screen functionality. These are listed in the following sections. Methods The Fullscreen API adds methods to the Document and Element interfaces to allow turning off and on full-screen mode. Methods on the Document interface Document.exitFullscreen() Requests that the user agent switch from full-screen mode back to windowed mode. Returns a Promise...
...e full-screen mode has been completely shut off. Methods on the Element interface Element.requestFullscreen() Asks the user agent to place the specified element (and, by extension, its descendants) into full-screen mode, removing all of the browser's UI elements as well as all other applications from the screen. Returns a Promise which is resolved once full-screen mode has been activated. Properties The Document interface provides properties that can be used to determine if full-screen mode is supported and available, and if full-screen mode is currently active, which element is using the screen. DocumentOrShadowRoot.fullscreenElement The fullscreenElement property tells you the Element that's currently being displayed in full-screen mode on the DOM (or shadow DOM). If this is null, the...
... being allowed, or full-screen mode not being supported). Event handlers The Fullscreen API defines two events which can be used to detect when full-screen mode is turned on and off, as well as when errors occur during the process of changing between full-screen and windowed modes. Event handlers for these events are available on the Document and Element interfaces. Note: These event handler properties are not available as HTML content attributes. In other words, you cannot specify event handlers for fullscreenchange and fullscreenerror in the HTML content. They must be added by JavaScript code. Event handlers on documents Document.onfullscreenchange An event handler for the fullscreenchange event that's sent to a Document when that document is placed into full-screen mode, or when that d...
... Element.onfullscreenchange An event handler 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...
HTMLEmbedElement - Web APIs
This topic describes the HTMLEmbedElement interface as defined in the standard. It does not address earlier, non-standardized version of the interface. ...
... 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 ...
... 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. HTMLEm...
...ce. HTMLEmbedElement.width Is a DOMString that reflects the width HTML attribute, containing the displayed width of the resource. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLEmbedElement' in that specification. Living Standard Adds two obsolete properties, name and align, to help with compatibility with old Web sites. HTML5The definition of 'HTMLEmbedElement' in that specification. Recommendation Initial definition. ...
HTMLFieldSetElement - Web APIs
The HTMLFieldSetElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. <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="#4D4E53" text-anchor="middle" alignment-base...
... HTMLFieldSetElement.disabled A Boolean reflecting the disabled HTML attribute, indicating whether the user can interact with the control. HTMLFieldSetElement.elementsRead only The elements belonging to this field set. The type of this property depends on the version of the spec that is implemented by the browser. HTMLFieldSetElement.formR...
... HTMLFieldSetElement.disabled A Boolean reflecting the disabled HTML attribute, indicating whether the user can interact with the control. HTMLFieldSetElement.elementsRead only The elements belonging to this field set. The type of this property depends on the version of the spec that is implemented by the browser. HTMLFieldSetElement.formRead only An HTMLFor...
...ate. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLFieldSetElement' in that specification. Living Standard HTML 5.1The definition of 'HTMLFieldSetElement' in that specification. Recommendation HTML5The definition of 'HTMLFieldSetElement' in that specification. Recommendation The following properties have been added: disabled, elements, name, type, valdiationMessage, validity, and willValidate. The following methods have been added: checkValidity(), setCustomValidity(). Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLFieldSetElement' in that specification. Obsolete No change Document Object Model (DOM) Level 1 SpecificationThe definitio...
HTMLHRElement - Web APIs
The HTMLHRElement interface provides special properties (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating <hr> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyli...
... HTMLHRElement.align Is a DOMString, an enumerated attribute indicating alignment of the rule with respect to the surrounding context. HTMLHRElement.color Is a DOMString representing the name of the color of the rule. HTMLHRElement.noshade Is a Boolean that sets the rule to have no shading. HTMLHRElement.size Is a DOMString re...
... HTMLHRElement.align Is a DOMString, an enumerated attribute indicating alignment of the rule with respect to the surrounding context. HTMLHRElement.color Is a DOMString representing the name of the color of the rule. HTMLHRElement.noshade Is a Boolean that sets the rule to have no shading. HTMLHRElement.size Is a DOMString representing the height...
...arent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHRElement' in that specification. Living Standard The color property has been added, as an obsolete property, to increase compatibility with the existing web. HTML5The definition of 'HTMLHRElement' in that specification. Recommendation Following properties are now obsolete: align, noshade, size, and width. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLHRElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLHRElement' in that specification. Obsolete Initial definitio...
HTMLLIElement - Web APIs
The HTMLLIElement interface exposes specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating list elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event...
... 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...
... 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 a...
...s 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 HTML Living StandardThe definition of 'HTMLLIElement' in that specification. Living Standard HTML5The definition of 'HTMLLIElement' in that specification. Recommendation The following property is now obsolete: type. Document Object Model (DOM) Level 2 HTML Specificat...
HTMLMediaElement - Web APIs
The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. ...
... HTMLMediaElement.audioTracks A AudioTrackList that lists the AudioTrack objects contained in the element. HTMLMediaElement.autoplay A Boolean that reflects the autoplay HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so ...
... HTMLMediaElement.audioTracks A AudioTrackList that lists the AudioTrack objects contained in the element. HTMLMediaElement.autoplay A Boolean that reflects the autoplay HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption. Note: Automatical...
...ly seeks to the given time. HTMLMediaElement.load() Resets the media to the beginning and selects the best available source from the sources provided using the src attribute or the <source> element. HTMLMediaElement.mozCaptureStream() [enter description] HTMLMediaElement.mozCaptureStreamUntilEnded() [enter description] HTMLMediaElement.mozGetMetadata() Returns Object, which contains properties that represent metadata from the playing media resource as {key: value} pairs. A separate copy of the data is returned each time the method is called. This method must be called after the loadedmetadata event fires. HTMLMediaElement.pause() Pauses the media playback. HTMLMediaElement.play() Begins playback of the media. HTMLMediaElement.seekToNextFrame() Seeks to the next frame in the m...
HTMLMenuElement - Web APIs
The HTMLMenuElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menu> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text...
... Living Standard No change from latest snapshot, Unknown HTML 5.2The definition o...
... Living Standard No change from latest snapshot, Unknown HTML 5.2The definition of 'HTMLMenuElement' in that spec...
... Living Standard No change from latest snapshot, Unknown HTML 5.2The definition of 'HTMLMenuElement' in that specification. Recommendat...
HTMLMenuItemElement - Web APIs
The HTMLMenuItemElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menuitem> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarg...
... Recommendation Snapshot of the HTML Living Standard. Initial definition. ...
... Recommendation Snapshot of the HTML Living Standard. Initial definition. ...
... Recommendation Snapshot of the HTML Living Standard. Initial definition. ...
HTMLObjectElement - Web APIs
The HTMLObjectElement interface provides special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. <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="#4D4...
... 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 archi...
... 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...
... Status Comment HTML Living StandardThe definition of 'HTMLObjectElement' in that specification. Living Standard HTML5The definition of 'HTMLObjectElement' in that specification. Recommendation The W3C specification is a latest of a previous version of HTML Living Standard Technically, the property tabindex is now defined on HTMLElement. The following properties are now obsolete: align, archive, border, code, codeBase, codeType, declare, hspace, standby, and vspace. The following properties have been added: typeMustMatch, contentWindow, willValidate, validity, and validationMessage. The following methods have been added: checkValidity() and setCustomValidity(). Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTML...
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="#4D4E5...
... 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" val...
... 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 t...
...e values: "data", "ref", or "object". 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. ...
HTMLPreElement - Web APIs
The HTMLPreElement interface exposes specific properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). <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="#4D4E53" text-anchor="middle" alignment-baseline="m...
... 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 t...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLPreElement' in that specification. ...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLPreElement' in that specification. ...
HTMLProgressElement - Web APIs
The HTMLProgressElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. <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="#4D4E53" text-anchor="middle" alignment-base...
... 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 indetermin...
... 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 ...
... 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.labelsRead only Returns NodeList containing the list of <label> elements that are labels for this element. Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLProgressElement' in that specification. Living Standard HTML 5.1The definition of 'HTMLProgressElement' in that specification. Recommendation HTML5The definition of 'HTMLProgressElement' in that specification. Recommend...
HTMLQuoteElement - Web APIs
The HTMLQuoteElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> 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="#4D4E53" text-anchor="midd...
... HTMLQuoteElement.cite Is a DOMString reflecting the cite HTML attribute, containing a URL for the source of the quotation. Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLQuoteElement' in that speci...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLQuoteElement' in that specification. Living S...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLQuoteElement' in that specification. ...
HTMLSelectElement - Web APIs
The HTMLSelectElement interface represents a <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline p...
... HTMLSelectElement.autofocus A Boolean reflecting the autofocus HTML attribute, which indicates whether the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specifi...
... HTMLSelectElement.autofocus A Boolean reflecting the autofocus HTML attribute, which indicates whether the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. HTMLSelectElement.disabled A Bool...
...ment' in that specification. Living Standard Since the latest snapshot, HTML5, it adds the autocomplete property and the reportValidity() method. HTML5The definition of 'HTMLSelectElement' in that specification. Recommendation Is a snapshot of HTML Living Standard. It adds the autofocus, form, required, labels, selectedOptions, willValidate, validity and validationMessage properties. The tabindex property and the blur() and focus() methods have been moved to HTMLElement. The methods item(), namedItem(), checkValidity() and setCustomValidity(). Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLSelectElement' in that specification. Obsolete options now returns an HTMLOptionsCollection. length now returns an unsigned long. ...
HTMLSpanElement - Web APIs
The HTMLSpanElement interface represents a <span> element and derives from the HTMLElement interface, but without implementing any additional properties or methods. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 12...
... Methods This interface has no methods, but inherits methods from: HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLSpanElement' in that specification. Living Standard HTML 5.2The definition of 'HTMLSpanElement' in that spe...
... Methods This interface has no methods, but inherits methods from: HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLSpanElement' in that specification. Living Standard HTML 5.2The definition of 'HTMLSpanElement' in that specification. Recommendation ...
... y="65" width="150" height="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">HTMLSpanElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties, but inherits properties from: HTMLElement. Methods This interface has no methods, but inherits methods from: HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLSpanElement' in that specification. Living Standard HTML 5.2The definition of 'HTMLSpanElement' in that specification. Recommendation HTML 5.1The defi...
HTMLStyleElement - Web APIs
The HTMLStyleElement interface represents a <style> element. It inherits properties and methods from its parent, HTMLElement, and from LinkStyle. This interface doesn't allow to manipulate the CSS it contains (in most case). To manipulate CSS, see Using dynamic styling information for an overview of the objects used to manipulate specified CSS properties using the DOM. <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...
... 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) ...
... 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). Link...
...an 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 properties from its parent, HTMLElement, and LinkStyle. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLStyleElement' in that specification. Living Standard HTML 5.1The definition of 'HTMLStyleElement' in that specification. Recommendation HTML5The definition of 'HTMLStyleElement' in that specification. Rec...
HTMLTableCaptionElement - Web APIs
The HTMLTableCaptionElement interface special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating table caption elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></...
... HTMLTableCaptionElement.align Is a DOMString which represents an enumerated attribute indicating alignment of the caption with respect to the table. Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTM...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTableCaptionElement'...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTableCaptionElement' in that specification. Living Standard No change from HTML5. ...
HTMLTableElement - Web APIs
The HTMLTableElement interface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document. <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="#4D4E53" text-anchor="middle" ali...
... HTMLTableElement.caption Is a HTMLTableCaptionElement representing the first <caption> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <caption>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is given, it is inserted in the tree as the first child of thi...
... HTMLTableElement.caption Is a HTMLTableCaptionElement representing the first <caption> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <caption>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is given, it is inserted in the tree as the first child of this element and the fir...
... a <thead> appear first, in tree order, and those members of a <tbody> last, also in tree order. The HTMLCollection is live and is automatically updated when the 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 ba...
HTMLTableRowElement - Web APIs
The HTMLTableRowElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table. <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="#4D4E53" text-anchor="middle" alignment-baseline="...
... 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 cel...
... 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 o...
...lement' in that specification. Living Standard HTML5The definition of 'HTMLTableRowElement' in that specification. Recommendation The parameter of insertCell is now optional and default to -1. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLTableRowElement' in that specification. Obsolete The cells, rowIndex, and selectionRowIndex properties are now read-only. The methods insertCell and deleteCell can raise exceptions. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLTableRowElement' in that specification. Obsolete Initial definition. ...
HTMLUListElement - Web APIs
The HTMLUListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating unordered list elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">...
... 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...
... 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...
... that behavior in modern pages. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLUListElement' in that specification. Living Standard HTML5The definition of 'HTMLUListElement' in that specification. Recommendation The compact and type properties have been obsoleted. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLUListElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLUListElement' in that specification. Obsolete Initial definition. ...
HTMLUnknownElement - Web APIs
The HTMLUnknownElement interface represents an invalid HTML element and derives from the HTMLElement interface, but without implementing any additional properties or methods. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="...
... Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLUnknownElement' in that specification. Living Standard No change from HTML5. HTML5The definition of 'HTMLUnknownElemen...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLUnknownElement' in that specification. Living Standard No change from HTML5. HTML5The definition of 'HTMLUnknownElement' in that specification. Recommendation...
...oke-width="2px" /><text x="401" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLUnknownElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties No specific property; inherits properties from its parent, HTMLElement. Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLUnknownElement' in that specification. Living Standard No change from HTML5. HTML5The definition of 'HTMLUnknownElement' in that specification. Recommendation Initial definition. ...
HTMLVideoElement - Web APIs
The list of supported media formats varies from one browser to the other. You should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
... 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...
... 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 onl...
...ht 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 CSS pixels. Gecko-specific properties HTMLVideoElement.mozParsedFrames Read only Returns an unsigned long with the count of video frames that have been parsed from the media resource. HTMLVideoElement.mozDecodedFrames Read only Returns an unsigned long with the count of parsed video frames that have been decoded into images. HTMLVideoElement.mozPresentedFrames Read only Returns an unsigned long with the count of decoded...
PerformanceFrameTiming - Web APIs
PerformanceEntry.name Returns the document's address. PerformanceEntry.startTime Returns the timestamp when the frame was started. PerformanceEntry.duration R...
... PerformanceEntry.name Returns the document's address. PerformanceEntry.startTime Returns the timestamp when the frame was started. PerformanceEntry.duration Returns a timestamp indicating the ...
... PerformanceEntry.name Returns the document's address. PerformanceEntry.startTime Returns the timestamp when the frame was started. PerformanceEntry.duration Returns a timestamp indicating the difference between the startTimes of two successive frame...
... PerformanceEntry.name Returns the document's address. ...
PerformanceMark - Web APIs
PerformanceEntry.name Returns the name given to the mark when it was created via a call to performance.mark(). PerformanceEntry.startTime Returns the DOMHighResTimeStamp when performance.mark() was calle...
... PerformanceEntry.name Returns the name given to the mark when it was created via a call to performance.mark(). PerformanceEntry.startTime Returns the DOMHighResTimeStamp when performance.mark() was called. PerformanceEntry.duration Ret...
... PerformanceEntry.name Returns the name given to the mark when it was created via a call to performance.mark(). PerformanceEntry.startTime Returns the DOMHighResTimeStamp when performance.mark() was called. PerformanceEntry.duration Returns "0". (A mark has no duration.) Methods This inter...
...th="2px" /><text x="276" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceMark</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but it extends the following PerformanceEntry properties by qualifying/constraining the properties as follows: PerformanceEntry.entryType Returns "mark". PerformanceEntry.name Returns the name given to the mark when it was created via a call to performance.mark(). PerformanceEntry.startTime Returns the DOMHighResTimeStamp when performance.mark() was called. PerformanceEntry.duration Returns "0". (A mark has no duration.) Methods This interface has no methods. Example See the exa...
PerformanceMeasure - Web APIs
PerformanceEntry.name Returns the name given to the measure when it was created via a call to performance.measure(). PerformanceEntry.startTime Returns a timestamp given to the measure when performan...
... PerformanceEntry.name Returns the name given to the measure when it was created via a call to performance.measure(). PerformanceEntry.startTime Returns a timestamp given to the measure when performance.measure() was called. Performa...
... PerformanceEntry.name Returns the name given to the measure when it was created via a call to performance.measure(). PerformanceEntry.startTime Returns a timestamp given to the measure when performance.measure() was called. PerformanceEntry.duration Returns a DOMHighResTimeStamp that is ...
...2px" /><text x="291" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceMeasure</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but it extends the following PerformanceEntry properties by qualifying/constrainting the properties as follows: PerformanceEntry.entryType Returns "measure". PerformanceEntry.name Returns the name given to the measure when it was created via a call to performance.measure(). PerformanceEntry.startTime Returns a timestamp given to the measure when performance.measure() was called. PerformanceEntry.duration Returns a DOMHighResTimeStamp that is the duration of the measure (typically, the...
PerformancePaintTiming - Web APIs
PerformanceEntry.name Returns either "first-paint" or "first-contentful-paint". PerformanceEntry.startTime Returns the timestamp when the paint ocurred. Perfor...
... PerformanceEntry.name Returns either "first-paint" or "first-contentful-paint". PerformanceEntry.startTime Returns the timestamp when the paint ocurred. PerformanceEntry.duration Returns 0. ...
... PerformanceEntry.name Returns either "first-paint" or "first-contentful-paint". PerformanceEntry.startTime Returns the timestamp when the paint ocurred. PerformanceEntry.duration Returns 0. Methods This interface has no methods. Example functio...
... PerformanceEntry.name Returns either "first-paint" or "first-contentful-paint". ...
Pointer events - Web APIs
ice-specific handling is desired, pointer events defines a pointerType property to inspect the device type which produced the event. The events needed to handle generic pointer input are analogous to mouse events (mousedown/pointerdown, mousemove/pointermove, etc.). Consequently, pointer event types are intentionally similar to mouse event types. Additionally, a pointer event contains the usual properties present in mouse events (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 poin...
...ace is the PointerEvent interface which has a constructor plus several event types and associated global event handlers. The standard also includes some extensions to the Element and Navigator interfaces. The following sub-sections contain short descriptions of each interface and property. PointerEvent interface The PointerEvent interface extends the MouseEvent interface and has the following properties. (All of the following properties are Read only .) pointerId A unique identifier for the pointer causing the event. width The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. height the height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer. pressure the normalized pressure of the pointer input in the range of 0 to ...
...l.onpointermove = move_handler; el.onpointerup = up_handler; el.onpointercancel = cancel_handler; el.onpointerout = out_handler; el.onpointerleave = leave_handler; el.gotpointercapture = gotcapture_handler; el.lostpointercapture = lostcapture_handler; } </script> <body onload="init();"> <div id="target"> Touch me ... </div> </body> </html> Event properties This example illustrates accessing all of a touch event's properties. <html> <script> var id = -1; function process_id(event) { // Process this event based on the event's identifier } function process_mouse(event) { // Process the mouse pointer event } function process_pen(event) { // Process the pen pointer event } function process_touch(eve...
...cted the screen when there were no other active pens contacting the screen. Determining button states Some 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 ...
RTCRemoteOutboundRtpStreamStats - Web APIs
localId A DOMString which is used to find the local RTCInboundRtpStreamStats object which shares the same Synchronization Source (SSRC). ...
... localId A DOMString which is used to find the local RTCInboundRtpStreamStats object which shares the same Synchronization Source (SSRC). ...
... localId A DOMString which is used to find the local RTCInboundRtpStreamStats object which shares the same Synchronization Source (SSRC). ...
... localId A DOMString which is used to find the local RTCInboundRtpStreamStats object which shares the same Synchronization Source (SSRC). ...
RTCRtpStreamStats - Web APIs
RTCRtpStreamStats is the base class for all RTP-related statistics reports. It's based on RTCStats and adds the following additional fields. ...
... RTCRtpStreamStats is the base class for all RTP-related statistics reports. It's based on RTCStats and adds the following additional fields. ...
...hich interface the method is called on. RTCRtpStreamStats is the base class for all RTP-related statistics reports. It's based on RTCStats and adds the following additional fields. Note: This interface was called RTCRTPStreamStats until a specification update in the spring of 2017. Check the Browser compatibility table to know if and when the name change was implemented in specific 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. kind A DOMString whose value is "audio" if the a...
...lue of MediaStreamTrack.id. transportId A DOMString uniquely identifying the object which was inspected to produce the RTCTransportStats object associated with this RTP stream. Obsolete fields mediaType Renamed to kind in the specification in February 2018. See Browser compatibility in RTCRtpStreamStats.kind to determine when browsers made the transition. Local-only measurements These properties are computed locally, and are only available to the device receiving the media stream. Their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is. firCount A count of the total number of Full Intra Request (FIR) packets received by the sender. This statistic is only available t...
SVGCursorElement - Web APIs
The SVGCursorElement interface provides access to the properties of <cursor> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" s...
... SVGCursorElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <cursor> element. SVGCursorElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given <cursor> element. Methods This interface doesn't implement a...
... SVGCursorElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <cursor> element. SVGCursorElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given <cursor> element. Methods This interface doesn't implement any specific methods, but inherits methods...
...#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGCursorElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent, SVGElement, and implements properties from SVGURIReference. SVGCursorElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <cursor> element. SVGCursorElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given <cursor> element. Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGElement. Specifications ...
SVGDefsElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits properties from its parent, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDefsElement' in that specific...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDefsElement' in that specification. Candidate Recommendation Replaced the inherit...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDefsElement' in that specification. Candidate Recommendation Replaced the inheritance from SVGElementSVGTe...
...aco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGDefsElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface doesn't implement any specific properties, but inherits properties from its parent, SVGGraphicsElement. Methods This interface doesn't implement any specific methods, but inherits properties from its parent, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDefsElement' in that specification. Candidate Recommendation Replaced the inheritance from SVGElementSVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, and SVGTransformable by SVGGraphicsElement Scalable Vec...
SVGFEFloodElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement, and implements methods from SVGFilterPrimitiveStandardAttributes. Specifications ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement, and implements methods from SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filte...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement, and implements methods from SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects Module Level 1T...
... x="396" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEFloodElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement, and implements properties from SVGFilterPrimitiveStandardAttributes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement, and implements methods from SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFloodElement' in that specification. Wo...
SVGFEMergeElement - Web APIs
Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Spec...
... 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 Effec...
... 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 defi...
... x="396" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEMergeElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface not provide any specific properties, but inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. 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 'SVGFEMergeElement' in that specification. Working Draft ...
SVGFontElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGExternalResourcesRequired and SVGStylable. Specifications Specification Status Comment Sca...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGExternalResourcesRequired and SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (S...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGExternalResourcesRequired and SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defini...
...ke="#D4DDE4" stroke-width="2px" /><text x="71" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFontElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but inherits properties from its parent, SVGElement and implements properties from SVGExternalResourcesRequired and SVGStylable. Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGExternalResourcesRequired and SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontElement' in that specification. Rec...
SVGForeignObjectElement - Web APIs
The SVGForeignObjectElement interface provides access to the properties of <foreignObject> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121...
... SVGForeignObjectElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeignObjectElement.y Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeig...
... SVGForeignObjectElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeignObjectElement.y Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeignObjectElement.width Read only An SVGAn...
...e="#D4DDE4" stroke-width="2px" /><text x="146" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGForeignObjectElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent, SVGGraphicsElement and implements properties from SVGURIReference. SVGForeignObjectElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeignObjectElement.y Read only An SVGAnimatedLength corresponding to the x attribute of the given <foreignObject> element. SVGForeignObjectElement.width Read only An SVGAnimatedLength corresponding to the width attribute of the given...
SVGMissingGlyphElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGMissingGlyphElement' in that s...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGMissingGlyphElement' in that specification. Recomme...
...E4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGMissingGlyphElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but inherits properties from its parent, SVGElement and implements properties from SVGStylable. Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGStylable. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGMissingGlyphElement' in that specification. Recommendation Initial definition ...
SVGSymbolElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement, and implements methods from SVGFitToViewBox. Specifications Specification ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement, and implements methods from SVGFitToViewBox. Specifications Specification Status Comment Scalable Vector Graphics (SVG) ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement, and implements methods from SVGFitToViewBox. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSy...
..." y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGSymbolElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGGraphicsElement, and implements properties from SVGFitToViewBox. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement, and implements methods from SVGFitToViewBox. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSymbolElement' in that specification. Candidate Recommendation Change...
SVGTRefElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGTextPositioningElement and implements properties from SVGURIReference. Specifications Specification Status Comment Scalable Vector Graphics (SV...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definit...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGTRefElement' ...
...roke-width="2px" /><text x="71" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGTRefElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but inherits properties from its parent, SVGTextPositioningElement and implements properties from SVGURIReference. Methods This interface has no methods but inherits methods from its parent, SVGTextPositioningElement and implements properties from SVGURIReference. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGTRefElement' in that specification. Recommendation Initial definition ...
SVGUseElement - Web APIs
SVGUseElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given element. SVGUseElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given element. SVGUseElement.width Read only An SVGAnimatedLengt...
... SVGUseElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given element. SVGUseElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given element. SVGUseElement.width Read only An SVGAnimatedLength corresponding to the width attribute of...
...e="#D4DDE4" stroke-width="2px" /><text x="196" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGUseElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGGraphicsElement and implements properties from SVGURIReference. SVGUseElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given element. SVGUseElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given element. SVGUseElement.width Read only An SVGAnimatedLength corresponding to the width attribute of the given element. SVGUseElement.height Read only An SVGAnimatedLeng...
...returns null. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement and implements methods from SVGURIReference. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGUseElement' in that specification. Candidate Recommendation Redefined the properties instanceRoot and animatedInstanceRoot. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGUseElement' in that specification. Recommendation Initial definition ...
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 StylePr...
...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 StylePropertyMapReadOnly object. ...
...eate an array of properties of interest and use the StylePropertyMapReadOnly's get() method to get only those values. ...
...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']; // iterate thru our properties of interest for ( let i = 0; i < ofInterest.length; i++ ) { // properties const cssProperty = document.createElement('dt'); cssProperty.appendChild(document.createTextNode(ofInterest[i])); stylesList.appendChild(cssProperty); // values const cssValue = document.createElement('dd'); cssValue.appendChild(document.createTextNode( styleMap.get(ofInterest[i]))); stylesList.appendChil...
WebRTC connectivity - Web APIs
answer to the caller. The caller receives the answer. The caller calls RTCPeerConnection.setRemoteDescription() to set the answer as the remote description for its end of the call. It now knows the configuration of both peers. Media begins to flow as configured. Pending and current descriptions Taking one step deeper into the process, we find that localDescription and remoteDescription, the properties which return these two descriptions, aren't as simple as they look. Because during renegotiation, an offer might be rejected because it proposes an incompatible format, it's necessary that each endpoint have the ability to propose a new format but not actually switch to it until it's accepted by the other peer. For that reason, WebRTC uses pending and current descriptions. The current descriptio...
...rejected because it proposes an incompatible format, it's necessary that each endpoint have the ability to propose a new format but not actually switch to it until it's accepted by the other peer. For that reason, WebRTC uses pending and current descriptions. The current description (which is returned by the RTCPeerConnection.currentLocalDescription and RTCPeerConnection.currentRemoteDescription properties) represents the description currently in actual use by the connection. This is the most recent connection that both sides have fully agreed to use. The pending description (returned by RTCPeerConnection.pendingLocalDescription and RTCPeerConnection.pendingRemoteDescription) indicates a description which is currently under consideration following a call to setLocalDescription() or setRemoteDescr...
...'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, pendingRemoteDescription includes any remote ICE candidates which have been provided by calls to RTCPeerConnection.addIceCandidate(). See the individual articles on these properties and methods for more specifics, and Codecs used by WebRTC for information about codecs supported by WebRTC and which are compatible with which browsers. The codecs guide also offers guidance to help you choose the best codecs for your needs. ICE candidates As well as exchanging information about the media (discussed above in Offer/Answer and SDP), peers must exchange information about the netwo...
...s to an ongoing session. Aborting the call would be an excessive reaction in that situation. Instead, you can initiate an ICE rollback. A rollback restores the SDP offer (and the connection configuration by extension) to the configuration it had the last time the connection's signalingState was stable. To programmatically initiate a rollback, send a description whose type is rollback. Any other properties in the description object are ignored. In addition, the ICE agent will automatically initiate a rollback when a peer that had previously created an offer receives an offer from the remote peer. In other words, if the local peer is in the state have-local-offer, indicating that the local peer had previously sent an offer, calling setRemoteDescription() with a received offer triggers rollback so t...
Using the Web Animations API - Web APIs
imation effects. It is one of the most performant ways to animate on the Web, letting the browser make its own internal optimizations without hacks, coercion, 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 di...
... Currently, there should be at least two keyframes specified (representing the starting and ending states of the animation sequence). If your keyframe list has only one entry, Element.animate() may throw a NotSupportedError exception in some browsers until they are updated. So to recap, the keys are equally spaced by default unless you specify an offset on a key. Handy, no? Representing timing properties We'll also need to create an object of timing properties (an AnimationEffectTimingProperties object) corresponding to the values in Alice's animation: var aliceTiming = { duration: 3000, iterations: Infinity } You'll notice a few differences here from how equivalent values are represented in CSS: For one, the duration is in milliseconds as opposed to seconds -- 3000 not 3s. Like WindowT...
...ime to bring them both together with the Element.animate() method: document.getElementById("alice").animate( aliceTumbling, aliceTiming ) And boom: the animation starts playing (see the finished version on Codepen). The animate() method can be called on any DOM element that could be animated with CSS. And it can be written in several ways. ...
...We can divide her duration in half to get the midpoint for her animation's timeline, setting her to be normal height. Now we can reverse and play her animation in either direction to make her grow smaller or larger! And we can do th...
window.postMessage() - Web APIs
The ownership of these objects is given to the destination side and they are no longer usable on the sending side. The dispatched event otherWindow can listen for dispatched messages by executing the following JavaScript: window.addEventListener("message", receiveMessage, false); function receiveMessage(event) { if (event.origin !== "http://example.org:8080") return; // ... } The properties of the dispatched message are: data The object passed from the other window. origin The origin of the window that sent the message at the time postMessage was called. This string is the concatenation of the protocol and "://", the host name if one exists, and ":" followed by a port number if a port is present and differs from the default port for the given protocol. Examples of typical orig...
... establish two-way communication between two windows with different origins. Security concerns If you do not expect to receive messages from other sites, do not add any event listeners for message events. This is a completely foolproof way to avoid security problems. If you do expect to receive messages from other sites, always verify the sender's identity using the origin and possibly source properties. Any window (including, for example, http://evil.example.com) can send a message to any other window, and you have no guarantees that an unknown sender will not send malicious messages. Having verified identity, however, you still should always verify the syntax of the received message. Otherwise, a security hole in the site you trusted to send only trusted messages could then open a cross-site s...
... event.origin); } window.addEventListener("message", receiveMessage, false); Notes Any window may access this method on any other window, at any time, regardless of the location of the document in the window, to send it a message. Consequently, any event listener used to receive messages must first check the identity of the sender of the message, using the origin and possibly source properties. This cannot be overstated: Failure to check the origin and possibly source properties enables cross-site scripting attacks. As with any asynchronously-dispatched script (timeouts, user-generated events), it is not possible for the caller of postMessage to detect when an event handler listening for events sent by postMessage throws an exception. postMessage() schedules the MessageEvent to be di...
... The value of the origin property when the sending window contains a javascript: or data: URL is the origin of the script that loaded the URL. Using window.postMessage in extensions window.postMessage is available to JavaScript running in chrome code (e.g., in extensions and privileged code), but the source property of the dispatched event is always null as a security restriction. (The other properties have their expected values.) It is not possible for content or web context scripts to specify a targetOrigin to communicate directly with an extension (either the background script or a content script). Web or content scripts can use window.postMessage with a targetOrigin of "*" to broadcast to every listener, but this is discouraged, since an extension cannot be certain the origin of such messa...
WorkerGlobalScope - Web APIs
in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. This interface is usually specialized by each worker type: DedicatedWorkerGlobalScope for dedicated workers, SharedWorkerGlobalScope for shared workers, and ServiceWorkerGlobalScope for ServiceWorker. The self property returns the specialized scope for each context. Properties This interface inherits properties from the EventTarget interface and WindowOrWorkerGlobalScope and WindowEventHandlers mixins. Standard properties WorkerGlobalScope.navigator Read only 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. WorkerGlobalScope.self Read only R...
...eturns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope or ServiceWorkerGlobalScope. WorkerGlobalScope.location Read only 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. Non-standard properties WorkerGlobalScope.performance Read only Returns the Performance associated with the worker. It is a regular performance object, except that only a subset of its property and methods are available to workers. WorkerGlobalScope.console Read only Returns the Console associated with the worker. Properties implemented from elsewhere WindowOrWorkerGlobalScope.caches Read only Returns...
...losing this particular scope. In newer browser versions, close() is available on DedicatedWorkerGlobalScope and SharedWorkerGlobalScope instead. This change was made to stop close() being available on service workers, as it isn't supposed to be used there and always throws an exception when called (see bug 1336043). Example You won't access WorkerGlobalScope directly in your code; however, its properties and methods are inherited by more specific global scopes such as DedicatedWorkerGlobalScope and SharedWorkerGlobalScope. For example, you could import another script into the worker and print out the contents of the worker scope's navigator object using the following two lines: importScripts('foo.js'); console.log(navigator); Since the global scope of the worker script is effectively the globa...
...from WorkerGlobalScope, you can run lines such as those above without specifying a parent object. Specifications Specification Status Comment HTML Living StandardThe definition of 'WorkerGlobalScope' in that specification. Living Standard ...
Accessibility documentation index - Accessibility
t consists of the IDs of the HTML elements you want to concatenate into a single accessible name. 12 How to file ARIA-related bugs ARIA, Bugzilla The state of ARIA technology has always depended on the community. If you notice an implementation issue, please take a little time and let the developers know. ...
...depended on the community. If you notice an implementation issue, please take a little time and let the developers know. Here's where to file bugs: 13 Using ARIA: Roles, states, and properties ARIA, Accessibility, Overview, Reference ARIA defines semantics that can be applied to elements, with these divided into roles (defining a type of user interface element) and states and properties that are supported by a role. Authors must assign an ARIA role and the appropriate states and properties to an element during its life-cycle, unless the element already has appropriate ARIA semantics (via use of an appropriate HTML element). Addition of ARIA semantics only exposes extra information to a browser's accessibility API, and does not affect a page's DOM. 14 ARIA Technique Te...
... the maximum value allowed for a range widget such as a slider, spinbutton or progressbar. 27 Using the aria-valuemin attribute ARIA, Accessibility, NeedsContent The aria-valuemin attribute is used to define the minimum value allowed for a range widget such as a slider, spinbutton or progressbar. If the aria-valuenow has a known maximum and minimum, the author SHOULD provide properties for aria-valuemax and aria-valuemin.The value of aria-valuemin MUST be less than or equal to the value of aria-valuemax. 28 Using the aria-valuenow attribute ARIA, Accessibility, NeedsContent The aria-valuenow attribute is used to define the current value for a range widget such as a slider, spinbutton or progressbar. If the current value is not known, the author should not s...
...l default of reading in document source order. The property serves to define element relationships utilizing ARIA relationship attributes and the aria-flowto property. 41 WAI-ARIA Roles ARIA, ARIA Roles, Accessibility, Reference, Roles This page lists reference pages covering all the WAI-ARIA roles discussed on MDN. For a full list of roles, see Using ARIA: Roles, States, and Properties 42 ARIA: Comment role ARIA, ARIA Role, Comment, Reference, annotations The comment landmark role semantically denotes a comment/reaction to some content on the page, or to a previous comment. 43 ARIA: Complementary role ARIA, ARIA Role, Reference, role-complementary The complementary landmark role is used to designate a supporting section that relates to ...
-moz-outline-radius - CSS: Cascading Style Sheets
and 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, three or four <outline-radius> values, represents one of: <length> See <length> for po...
...set, the first one applies to the top-Left corner, the second one to the top-right and bottom-left corners and the third one to the bottom-right corner. If four values are set, the first one applies to the top-left corner, the second one to the top-right corner, the third one to the bottom-right corner and the fourth one to the bottom-left corner. ...
... corner, the second one to the top-right corner, the third one to the bottom-right corner and the fourth one to the bottom-left corner. ...
...he properties of the shorthand:-moz-outline-radius-topleft: refer to the corresponding dimension of the border box-moz-outline-radius-topright: refer to the corresponding dimension of the border box-moz-outline-radius-bottomright: refer to the corresponding dimension of the border box-moz-outline-radius-bottomleft: refer to the corresponding dimension of the border boxComputed valueas each of the properties of the shorthand:-moz-outline-radius-topleft: as specified-moz-outline-radius-topright: as specified-moz-outline-radius-bottomright: as specified-moz-outline-radius-bottomleft: as specifiedAnimation typeas each of the properties of the shorthand:-moz-outline-radius-topleft: a length, percentage or calc();-moz-outline-radius-topright: a length, percentage or calc();-moz-outline-radius-bottomright:...
-webkit-border-before - CSS: Cascading Style Sheets
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. ...
...t, and -webkit-border-end, which define the other borders of the element. This property is on the standard track as border-block-start. ...
...r more of the following, in any order: <'border-width'> See border-width <'border-style'> See border-style <'color'> See color Formal definition Initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: Varies from one browser to anotherApplies toall elementsInheritedyesPercentagesas each of the properties of the shorthand:-webkit-border-before-width: logical-width of containing blockComputed valueas each of the properties of the shorthand:border-width: as each of the properties ...
...If it isn't, it will be the rgb() corresponding one. ...
:visited - CSS: Cascading Style Sheets
Web › CSS › :visited
er, or :active) that has at least equal specificity. To style links appropriately, put the :visited rule after the :link rule but before the :hover and :active rules, as defined by the LVHA-order: :link -- :visited -- :hover -- :active. Styling restrictions For privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used: Allowable CSS properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, outline-color, text-decoration-color, and text-emphasis-color. Allowable SVG attributes are 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...
... is 0, in which case the style set in :visited will be ignored entirely. Although these styles can be change the appearance of colors to the end user, the window.getComputedStyle method will 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 th...
...is 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 :visited state */ background-color: white; border: 1px solid white; } a:visited { background-color: yellow; border-color: hotpink; color: hotpink; } Result Specifications Specification Status Comment HTML Living StandardThe definition of ':visited' in that specification. Living Standard Selectors...
...14Notes Notes Chromium has never matched <link> elements with link pseudo-classes.Safari iOS Full support 12Samsung Internet Android Full support 1.0Notes Full support 1.0Notes Notes Chromium has never matched <link> elements with link pseudo-classes.Restrict CSS properties allowed in a statement using :visited for privacyChrome Full support 6Edge Full support 12Firefox Full support 4IE Full support 8Opera Full support 15Safari F...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
Every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge. The content area, bounded by the content edge, contains the "real" content of the element, such as text, an image, or a video player. ...
... a video player. Its dimensions are the content width (or content-box width) and the content height (or content-box height). It often has a background color or background image. If the box-sizing property is set to content-box (default) and if the element is a block element, the content area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. The padding area, bounded by the padding edge, extends the content area to include the element's padding. Its dimensions are the padding-box width and the padding-box height. The thickness of the padding is determined by the padding-top, padding-right, padding-bottom, padding-left, and shorthand padding properties. The border area, bounded by the border edge, extends the padding area to inclu...
...The thickness of the padding is determined by the padding-top, padding-right, padding-bottom, padding-left, and shorthand padding properties. The border area, bounded by the border edge, extends the padding area to include the element's borders. Its dimensions are the border-box width and the border-box height. The thickness of the borders are determined by the border-width and shorthand border properties. If the box-sizing property is set to border-box, the border area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. When there is a background (background-color or background-image) set on a box, it extends to the outer edge of the border (i.e. extends underneath the border in z-ordering). This default behavior can be altered wit...
... behavior can be altered with the background-clip css property. The margin area, bounded by the margin edge, extends the border area to include an empty area used to separate the element from its neighbors. Its dimensions are the margin-box width and the margin-box height. The size of the margin area is determined by the margin-top, margin-right, margin-bottom, margin-left, and shorthand margin properties. When margin collapsing occurs, the margin area is not clearly defined since margins are shared between boxes. Finally, note that for non-replaced inline elements, the amount of space taken up (the contribution to the height of the line) is determined by the line-height property, even though the borders and padding are still displayed around the content. ...
CSS Basic Box Model - CSS: Cascading Style Sheets
CSS Basic Box Model is a module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. ...
... CSS Basic Box Model is a module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. ...
... CSS Basic Box Model is a module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. ...
... a module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. Reference Properties Properties controlling the flow of content in a box overflow overflow-x overflow-y Properties controlling the size of a box height width max-height max-width min-height min-width Properties controlling the margins of a box margin margin-bottom margin-left margin-right margin-top margin-trim Properties controlling the paddings of a box padding padding-bottom padding-left padding-right padding-top Other properties visibility Guides Introduction to the CSS box model Explains one of the fundamental concept of CSS: the box model. This model defines how...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
ains how the specification works with some common use case examples. Key Concepts and Terminology Multicol is unlike any of the other layout methods we have in CSS in that it fragments the content, including all descendent elements, into columns. This happens in the same way that content is fragmented into pages when we work with CSS Paged Media, for example by creating a print stylesheet. The properties defined by the specification are: column-width column-count columns column-rule-color column-rule-style column-rule-width column-rule column-span column-fill column-gap By adding column-count or column-width to an element, that element becomes a multi-column container, or multicol container for short. The columns are anonymous boxes and described as column boxes in the specification...
...column-rule-style column-rule-width column-rule column-span column-fill column-gap By adding column-count or column-width to an element, that element becomes a multi-column container, or multicol container for short. The columns are anonymous boxes and described as column boxes in the specification. Defining columns To create a multicol container you must use at least one of the column-* properties, these being column-count and column-width. The column-count property The column-count property specifies the number of columns that you would like the content to be displayed as. The browser will then assign the correct amount of space to each column box to create the requested number of columns. In the below example we use the column-count property to create three columns on the .container e...
... 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 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-wid...
...en column-count will act as a maximum number of columns. Therefore the behaviour as described for column-width will happen, until the number of columns in column-count is reached. After this point no more columns will be drawn, and the extra space is distributed evenly between the existing columns, even if there is enough room for more columns of the specified column-width size. When using both properties together you may get fewer 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 se...
Using multi-column layouts - CSS: Cascading Style Sheets
h line they were on. Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. Unfortunately this is impossible to do with CSS and HTML without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting. This limitation is solved by adding new CSS properties to extend the traditional block layout mode. Using columns Column count and width Two CSS properties control whether and how many columns will appear: column-count and column-width. The column-count property sets the number of columns to a particular number. E.g., Example 1 HTML <div id="col"> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor in...
...rum </div> CSS #wid { column-width: 100px; } 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 v...
... the heights of the content in each column are approximately equal. Firefox does this. However, in some situations it is also useful to set the maximum height of the columns explicitly, and then lay out content starting at the first column and creating as many columns as necessary, possibly overflowing to the right. Therefore, if the height is constrained, by setting the CSS height or max-height properties on a multi-column block, each column is allowed to grow to that height and no further before adding new column. This mode is also much more efficient for layout. Column Gaps There is a gap between columns. The recommended default is 1em. This size can be changed by applying the column-gap property to the multi-column block: Example 6 HTML <div id="column_gap"> Lorem ipsum dolor sit amet, ...
...ation 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 in culpa qui officia deserunt mollit anim id est laborum </div> CSS #column_gap { column-count: 5; column-gap: 2em; } Result Graceful Degradation The column properties will just be ignored by non-columns-supporting browsers. Therefore it's relatively easy to create a layout that will display in a single column in those browsers and use multiple columns in supporting browsers. Conclusion CSS3 columns are a layout primitive that will help Web developers make the best use of screen real estate. Imaginative developers may find many uses for them, especially with ...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
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 grid-template-rows properties. These define grid tracks. A grid track is the space between any two lines on the grid. In the below image you can see a track highlighted - this is the first row track in our grid. I can add to our earlier example by adding the grid-template-columns property, then defining the size of the column tracks. I have now created a grid with three 200-pixel-wide column tracks. The child items will b...
...ace something outside of the defined grid--or due to the amount of content, more grid tracks are needed--then the grid creates rows and columns in the implicit grid. These tracks will be auto-sized by default, resulting in their size being based on the content that is inside them. You can also define a set size for tracks created in the implicit grid with the grid-auto-rows and grid-auto-columns properties. In the below example we use grid-auto-rows to ensure that tracks created in the implicit grid are 200 pixels tall. <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 200px; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f...
...ing items against lines We will be exploring line based placement in full detail in a later article. The following example demonstrates doing this in a simple way. When placing an item, we target the line - rather than the track. In the following example I am placing the first two items on our three column track grid, using the grid-column-start, grid-column-end, grid-row-start and grid-row-end properties. Working from left to right, the first item is placed against column line 1, and spans to column line 4, which in our case is the far-right line on the grid. It begins at row line 1 and ends at row line 3, therefore spanning two row tracks. The second item starts on grid column line 1, and spans one track. This is the default so I do not need to specify the end line. It also spans two row tracks...
...have highlighted the first cell of the grid. Grid areas Items can span one or more cells both by row or by column, and this creates a grid area. Grid areas must be rectangular - it isn't possible to create an L-shaped area for example. The highlighted grid area spans two row and two column tracks. Gutters Gutters or alleys between grid cells can be created using the column-gap and row-gap properties, or the shorthand gap. In the below example, I am creating a 10-pixel gap between columns and a 1em gap between rows. .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 10px; row-gap: 1em; } Note: When grid first shipped in browsers the column-gap, row-gap and gap were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively. ...
Grid template areas - CSS: Cascading Style Sheets
.media .text { grid-area: content; padding: 10px; } <div class="media flipped"> <div class="image"></div> <div class="text">This is a media object example. We can use grid-template-areas to switch around the image and text part of the media object. </div> </div> Grid definition shorthands Having looked at various ways of placing items on our grids and many of the properties used to define grid, this is a good time to take a look at a couple of shorthands that are available for defining the grid and many things about it all in one line of CSS. These can quickly become difficult to read for other developers, or even your future self. However they are part of the specification and it is likely you will come across them in examples or in use by other developers, even i...
...hings about it all in one line of CSS. These can quickly become difficult to read for other developers, or even your future self. However they are part of the specification and it is likely you will come across them in examples or in use by other developers, even if you choose not to use them. Before using any shorthand it is worth remembering that shorthands not only enable the setting of many properties in one go, they also act to reset things to their initial values that you do not, or cannot set in the shorthand. Therefore if you use a shorthand, be aware that it may reset things you have applied elsewhere. The two shorthands for the grid container are the Explicit Grid Shorthand grid-template and the Grid Definition Shorthand grid. grid-template The grid-template property sets the followin...
...n one go, they also act to reset things to their initial values that you do not, or cannot set in the shorthand. Therefore if you use a shorthand, be aware that it may reset things you have applied elsewhere. The two shorthands for the grid container are the Explicit Grid Shorthand grid-template and the Grid Definition Shorthand grid. grid-template The grid-template property sets the following properties: grid-template-rows grid-template-columns grid-template-areas The property is referred to as the Explicit Grid Shorthand because it is setting those things that you control when you define an explicit grid, and not those which impact any implicit row or column tracks that might be created. The following code creates a layout using grid-template that is the same as the layout created earli...
..., auto) / 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ; } The first value is our grid-template-areas value but we also declare the size of the row at the end of each row. This is what the minmax(100px, auto) is doing. Then after grid-template-areas we have a forward slash, after that is an explicit track listing of column tracks. grid The grid shorthand goes a step further and also sets properties used by the implicit grid. So you will be setting: grid-template-rows grid-template-columns grid-template-areas grid-auto-rows grid-auto-columns grid-auto-flow The property also resets the grid-gap property to 0, however you cannot specify the gaps in this shorthand. You can use this syntax in the exact same way as the grid-template shorthand, just be aware than when doing so you will ...
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
The syntax for each specified value depends on the data type defined for each specified property. ...
...The syntax for each specified value depends on the data type defined for each specified property. ...
... pseudo-classes, pseudo-elements, data 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 o...
...tiple columns are considered to be a member of all of those columns. Pseudo Pseudo classes : Specifies a special state of the selected element(s). Pseudo elements :: Represents entities that are not included in HTML. See also: Selectors in the Selectors Level 4 specification. ...
animation - CSS: Cascading Style Sheets
Web › CSS › animation
NIMATION.forEach(function (node, index) { node.addEventListener('animationstart', function () { toggleButton(BUTTON[index], 'pause'); }); node.addEventListener('animationend', function () { toggleButton(BUTTON[index], 'restart'); }); }); BUTTON.forEach(function (btn, index) { btn.addEventListener('click', function () { playPause(index); }); }); }) A description of which properties are animatable is available; it's worth noting that this description is also valid for CSS transitions. Constituent properties This property is a shorthand 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 i...
...o, 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 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. Values <singl...
...sed a preference for no animated experiences. Designing Safer Web Animation For Motion Sensitivity . ...
...nderstanding WCAG 2.0 Formal definition Initial valueas each of the properties of the shorthand:animation-name: noneanimation-duration: 0sanimation-timing-function: easeanimation-delay: 0sanimation-iteration-count: 1animation-direction: normalanimation-fill-mode: noneanimation-play-state: runningApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas each of the properties of the shorthand:animation-name: as specifiedanimation-duration: as specifiedanimation-timing-function: as specifiedanimation-delay: as specifiedanimation-direction: as specifiedanimation-iteration-count: as specifiedanimation-fill-mode: as specifiedanimation-play-state: as specifiedAnimation typediscrete Formal syntax <single-animation>#where <single-animation> = <time> | <timing-function> | <...
border-style - CSS: Cascading Style Sheets
The border-style shorthand CSS property sets the line style for all four sides of an element's 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. ...
...rder-style shorthand CSS property sets the line style for all four sides of an element's 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. ...
...et. When applied to a table cell with border-collapse set to collapsed, this value behaves like groove. outset Displays a border that makes the element appear embossed. It is the opposite of inset. When applied to a table cell with border-collapse set to collapsed, this value behaves like ridge. ...
...osite of inset. When applied to a table cell with border-collapse set to collapsed, this value behaves like ridge. Formal definition Initial valueas each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: noneApplies toall elements. It also applies to ::first-letter.InheritednoComputed valueas each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style: as specifiedborder-right-style: as specifiedborder-top-style: as specifiedAnimation typediscrete Formal syntax <line-style>{1,4}where <line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset Examples Table with all property values Here is an example of all the property values. HTML ...
column-rule - CSS: Cascading Style Sheets
CSS property sets the width, style, and 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. 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). Syntax column-rule: dotted; column-rule: solid 8px; column-rule: solid blue; column-rule: thick...
...he column-rule property is specified as one, two, or three of the values listed below, in any order. Values <'column-rule-width'> Is a <length> or one of the three keywords, thin, medium, or thick. See border-width for details. <'column-rule-style'> See border-style for possible values and details. <'column-rule-color'> Is a <color> value. ...
...rds, thin, medium, or thick. See border-width for details. <'column-rule-style'> See border-style for possible values and details. <'column-rule-color'> Is a <color> value. ...
... valueas each of the properties of the shorthand:column-rule-width: mediumcolumn-rule-style: nonecolumn-rule-color: currentcolorApplies tomulticol elementsInheritednoComputed valueas each of the properties of the shorthand:column-rule-color: computed colorcolumn-rule-style: as specifiedcolumn-rule-width: the absolute length; 0 if the column-rule-style is none or hiddenAnimation typeas each of the properties of the shorthand:column-rule-color: a colorcolumn-rule-style: discretecolumn-rule-width: a length Formal syntax <'column-rule-width'> | <'column-rule-style'> | <'column-rule-color'> Examples Example 1 /* Same as "medium dotted currentcolor" */ p.foo { column-rule: dotted; } /* Same as "medium solid blue" */ p.bar { column-rule: solid blue; } /* Same as "8px solid currentcolor" */ p.baz { c...
flex-flow - CSS: Cascading Style Sheets
Web › CSS › flex-flow
The flex-flow CSS shorthand property specifies the direction of a flex container, as well as its wrapping behavior. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...horthand property specifies the direction of a flex container, as well as its wrapping behavior. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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. ...
...w 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 typediscrete Formal syntax <'flex-direction'> | <'flex-wrap'> Examples Setting column-reverse and wrap element { /* Main-axis is the block direction with reversed main-start and main-end. Flex items are laid out in multiple lines */ flex-flow: column-reverse wrap; } Specifications Specification S...
grid-area - CSS: Cascading Style Sheets
Web › CSS › grid-area
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. 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. ...
...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. 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. ...
... a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span. If the <integer> is omitted, it defaults to 1. Negative integers or 0 are invalid. ...
...ounting this span. If the <integer> is omitted, it defaults to 1. Negative integers or 0 are invalid. ...
grid-row - CSS: Cascading Style Sheets
Web › CSS › grid-row
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. 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. ...
...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. 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. ...
...s omitted, it defaults to 1. Negative integers or 0 are invalid. Internet Explorer issues IE11 does not support automatic placement of grid items. All items end up in the first row/col of the grid unless explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. ...
... unless explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. ...
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. Given the...
...ules: 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 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 "empha...
...d 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 the font property to the user agent's default unless a user stylesheet exists, in which case that is used instead. Then it doubles the font size and applies a f...
... ...
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. ...
...riting-mode, direction, and text-orientation. ...
...es */ inset-block: 3px 10px; inset-block: 2.4em 3em; inset-block: 10px; /* value applied to start and end */ /* <percentage>s of the width or height of the containing block */ inset-block: 10% 5%; /* Keyword value */ inset-block: auto; /* Global values */ inset-block: inherit; inset-block: initial; inset-block: unset; Constituent properties This property is a shorthand for the following CSS properties: inset-block-end inset-block-start Syntax Values The inset-block property takes the same values as the left property. Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-height of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentage or calc(); ...
... Editor's Draft Initial definition ...
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. ...
...ode, direction, and text-orientation. ...
...set-inline: 3px 10px; inset-inline: 2.4em 3em; inset-inline: 10px; /* value applied to start and end */ /* <percentage>s of the width or height of the containing block */ inset-inline: 10% 5%; /* Keyword value */ inset-inline: auto; /* Global values */ inset-inline: inherit; inset-inline: initial; inset-inline: unset; Constituent properties This property is a shorthand for the following CSS properties: inset-inline-end inset-inline-start Syntax Values The inset-inline property takes the same values as the left property. Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-width of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentage or calc()...
... Editor's Draft Initial definition ...
outline - CSS: Cascading Style Sheets
Web › CSS › outline
The outline CSS shorthand property set all the outline properties in a single declaration. The source for this interactive example is stored in a GitHub repository. If 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: 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 o...
...> Sets the thickness of the 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 Su...
...signing 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: Focus Visible Formal definition Initial valueas each of the properties of the shorthand:outline-color: invert, for browsers supporting it, currentColor for the otheroutline-style: noneoutline-width: mediumApplies toall elementsInheritednoComputed valueas each of the properties of the shorthand:outline-color: For the keyword invert, the computed value is invert. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one.
...keyword invert, the computed value is invert. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. ...
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. ...
... Description Values for this property correspond to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction,...
... Description Values for this property correspond to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. Formal definition Initial value0Applie...
... Editor's Draft Initial definition ...
padding - CSS: Cascading Style Sheets
Web › CSS › padding
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. An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element. In contrast, margin creates extra space around an element. ...
...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: Padding creates extra space within an element. In contrast, margin creates extra space around an element. ...
... the top, the second to the right and left, the third to the bottom. When four values are specified, the paddings apply to the top, right, bottom, and left in that order (clockwise). Values <length> The size of the padding as a fixed value. <percentage> The size of the padding as a percentage, relative to the width of the containing block. ...
... Initial valueas each of the properties of the shorthand:padding-bottom: 0padding-left: 0padding-right: 0padding-top: 0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
text-decoration - CSS: Cascading Style Sheets
<em>some emphasized words</em> in it.</p>, the style rule p { text-decoration: underline; } would cause the entire paragraph to be underlined. The style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. 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 o...
...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. ...
...n, 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. ...
...ecoration-color: currentcolortext-decoration-style: solidtext-decoration-line: noneApplies toall elements. ...
Cross-browser audio basics - Developer guides
This article provides: a basic guide to creating a cross-browser HTML5 audio player with all the associated attributes, properties, and events explained a guide to custom controls created using the Media API Basic Audio example The code below is an example of a basic audio implementation using HTML5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <p>Your browser does not support HTML5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> Note: You can also use an MP4 file instead of MP3. MP4 files typically contain AAC encoded audio. You can use type="audio/mp4". (Currently, browsers that support mp3 also support mp4 a...
...ode require that the user has the appropriate plugin installed, and that the browser cannot guarantee the security aspects of code running on those plugin platforms. These are also deprecated, and soon won't work in any modern browsers. Manipulating the Audio Element with JavaScript In addition to being able to specify various attributes in HTML, the <audio> element comes complete with several properties and methods that you can manipulate via JavaScript. Given the following HTML: <audio id="my-audio" src="audiofile.mp3"> ... </audio> You can grab the <audio> element like this: var myAudio = document.getElementById('my-audio'); Alternatively, you can create a new element. Here's an example of creating an <audio> element, setting the media to play, playing and pausing, and then playing fr...
... play The play() method is used to tell the audio to play. It takes no parameters. myAudio.play(); pause The pause() method is used to tell the audio to pause. It takes no parameters. myAudio.pause(); Note: There is no stop method -- to implement a stop function, you'd have to pause the media then set the currentTime property value to 0. canPlayType The canPl...
... var clickPosition = (e.pageX - this.offsetLeft) / this.offsetWidth; var clickTime = clickPosition * myAudio.duration; // move the playhead to the correct position myAudio.currentTime = clickTime; }); Buffering Ok, we're getting there, but there is another piece of useful information we can display: the amount of audio has been buffered or downloaded in advance. There are a couple of properties we haven't looked at yet, buffered and seekable. buffered This property lets us know which parts of the audio has been buffered (downloaded in advance). It returns something called a TimeRanges object. myBufferedTimeRanges = myAudio.buffered; seekable The seekable property informs you of whether you can jump directly to that part of the media without further buffering. mySeekableTimeRanges ...
Loops and iteration - JavaScript
function dump_props(obj, ...
...or...in statement The for...in statement iterates a specified variable over all the enumerable properties of an object. For each distinct property, JavaScript executes the specified statements. A for...in statement looks as follows: for (variable in object) statement Example The following function takes as its argument an object and the object's name. It then iterates over all the object's properties and returns a string that lists the property names and their values. ...
...ollowing function takes as its argument an object and the object's name. It then iterates over all the object's properties and returns a string that lists the property names and their values. function dump_props(obj, obj_name) { let result = ''; for (let i in obj) { result += obj_name + '.' + i + ' = ' + obj[i] + '<br>'; } result += '<hr>'; return result; } For an object car with properties make and model, result would be: car.make = Ford car.model = Mustang Arrays Although it may be tempting to use this as a way to iterate over Array elements, the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. Therefore, it is better to use a traditional for loop with a numeric index when iterating over arrays, because the for...in s...
...ar.make = Ford car.model = Mustang Arrays Although it may be tempting to use this as a way to iterate over Array elements, the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. Therefore, it is better to use a traditional for loop with a numeric index when iterating over arrays, because the for...in statement iterates over user-defined properties in addition to the array elements, if you modify the Array object (such as adding custom properties or methods). for...of statement The for...of statement creates a loop Iterating over iterable objects (including Array, Map, Set, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property. for (variable of object) state...
Deprecated and obsolete features - JavaScript
This page lists features of JavaScript that are deprecated (that is, still available but planned for removal) and obsolete (that is, no longer usable). Deprecated features These deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. You should work to remove their use from your code. RegExp properties the following properties are deprecated. This does not affect their use in replacement strings: Property Description $1-$9 Parenthesized substring matches, if any. Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them! $_ See input. $* See multiline. $& See lastMatch. $+ ...
... $' See rightContext. input The string against which a regular expression is matched. lastMatch The last matched characters. lastParen The last parenthesized substring match, if any. leftContext The substring preceding the most recent match. rightContext The substring following the most recent match. The following are now properties of RegExp instances, no longer of the RegExp object: Property Description global Whether or not to test the regular expression against all possible 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 ...
... 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 function* statement and function* expression instead. JS1.7/JS1.8 Array comprehension an...
...roduction states: "... Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. ..." Obsolete features These obsolete features have been entirely removed from JavaScript and can no longer be used as of the indicated version of JavaScript. Object Property Description __count__ Returns the number of enumerable properties directly on a user-defined object. __parent__ Points to an object's context. Object.prototype.eval() Evaluates a string of JavaScript code in the context of the specified object. Object.observe() Asynchronously observing the changes to an object. Object.unobserve() Remove observers. Object.getNotifier() Creates an object that allows to s...
Object.preventExtensions() - JavaScript
The Object.preventExtensions() method prevents new properties from ever being added to an 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. ...
...s://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 properties to a non-extensible object will fail, either silently or by throwing a TypeError (most commonly, but not exclusively, when in strict mode). Object.preventExtensions() only prevents addition of own properties. P...
... There is no way to make an object extensible again once it has been made non-extensible. Examples Using Object.preventExtensions // Object.preventExtensions returns the object // being made non-extensible. ...
... 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' }; Non-object coercion In ES5, if the argument to this method is not an object (a primitive...
Proxy - JavaScript
ou to create a proxy for another object, which can intercept and redefine fundamental operations for that object. Description A Proxy is created with two parameters: target: the original object which you want to proxy handler: an object that defines which operations will be intercepted and how to redefine intercepted operations. ...
...an intercept and redefine fundamental operations for that object. Description A Proxy is created with two parameters: target: the original object which you want to proxy handler: an object that defines which operations will be intercepted and how to redefine intercepted operations. ...
... Handler functions are sometimes called traps, presumably because they trap calls to the target object. The very simple trap in handler2 above redefines all property accessors: console.log(proxy2.message1); // world console.log(proxy2.message2); // world With the help of the Reflect class we can give some accessors the original behavior and redefine others: const target = { me...
...pass a string (by mistake) console.log(products.browsers); // ['Firefox'] <- no problem, the value is an array products.latestBrowser = 'Chrome'; console.log(products.browsers); // ['Firefox', 'Chrome'] console.log(products.latestBrowser); // 'Chrome' Finding an array item object by its property This proxy extends an array with some utility features. As you see, you can flexibly "define" properties without using Object.defineProperties. This example can be adapted to find a table row by its cell. In that case, the target will be table.rows. let products = new Proxy([ { name: 'Firefox', type: 'browser' }, { name: 'SeaMonkey', type: 'browser' }, { name: 'Thunderbird', type: 'mailer' } ], { get: function(obj, prop) { // The default behavior to return the value; prop is usually an ...
Standard built-in objects - JavaScript
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. ...
... 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. ...
...bjects, including their methods and properties. The term "global objects" (or standard built-in objects) here is not to be confused with the global object. Here, "global objects" refer to objects in the global scope. The global object itself can be accessed using the this operator in the global scope. In fact, the global scope consists of the properties of the 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. ...
...l 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() decodeURI() ...
Fills and Strokes - SVG: Scalable Vector Graphics
parately 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-linecap="butt"/> <line x1="40" x2="120" y1="60" y2="60" stroke="black" stroke-width="20" stroke-linecap...
...xt dash of 5 units. You can specify more numbers if you would like a more complicated dash pattern. The first example specifies three numbers, in which case the renderer loops the numbers twice to create an even pattern. So the first path renders 5 filled, 10 empty, 5 filled, and then loops back to create 5 empty, 10 filled, 5 empty. The pattern then repeats. There are additional stroke and fill properties available, including fill-rule, which specifies how to color in shapes that overlap themselves; stroke-miterlimit, which determines if a stroke should draw miters; and stroke-dashoffset, which specifies where to start a dasharray on a line. Using CSS In addition to setting attributes on objects, you can also use CSS to style fills and strokes. Not all attributes can be set via CSS. Attributes t...
...ng and filling are usually available, so fill, stroke, stroke-dasharray, etc... can all be set this way, in addition to the gradient and pattern versions of those shown below. Attributes like width, height, or <path> commands cannot be set through CSS. It's easiest just to test and find out what is available and what isn't. Note: The SVG specification decides strictly between attributes that are properties and other attributes. The former can be modified with CSS, the latter not. CSS can be inserted inline with the element via the style attribute: <rect x="10" height="180" y="10" width="180" style="stroke: black; fill: red;"/> Or it can be moved to a special style section that you include. Instead of shoving such a section into a <head> section like you do in HTML, though, it's included in an ...
...ents. <?xml version="1.0" standalone="no"?> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <style type="text/css"><![CDATA[ #MyRect { stroke: black; fill: red; } ]]></style> </defs> <rect x="10" height="180" y="10" width="180" id="MyRect"/> </svg> Moving styles to an area like this can make it easier to adjust properties on large groups of elements. You can also use things like the :hover pseudo class to create rollover effects: #MyRect:hover { stroke: black; fill: blue; } You can also specify an external stylesheet for your CSS rules through normal XML-stylesheet syntax: <?xml version="1.0" standalone="no"?> <?xml-stylesheet type="text/css" href="style.css"?> <svg width="200" height="150" xmlns="htt...
Content Processes - Archive of obsolete content
ect 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 automatically wrap native objects like the window object, and only exposes their native properties, even if they have been overridden on the wrapped object. Conversely, an...
...f 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 automatically wrap native objects like the window object, and only exposes their native properties, even if they have been overridden on the wrapped object. Conversely, any properties defined on the wrapper are not visible from the wrapped object. This avoids both problems we mentioned earlier. ...
...ontent script. This is where xray wrappers come in. Xray wrappers automatically wrap native objects like the window object, and only exposes their native properties, even if they have been overridden on the wrapped object. Conversely, any properties defined on the wrapper are not visible from the wrapped object. This avoids both problems we mentioned earlier. The fact that you can't override the properties of the window object via a content script is sometimes inconvenient, so it is possible to circumvent this: by defining the property on window.wrappedObject, the property is defined on the underlying object, rather than the wrapper itself. This feature should only be used when you really need it, however. A few Notes on Security As we stated earlier, the SDK was designed with multiprocess suppor...
Modules - Archive of obsolete content
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 script being loaded on its global object are exported to the loading script. The script loader we obtained from Components allows us to do just that: function loadScript(url) { let global = {}; loader.loadSubScript(url, global); return global; } If present, the loadSubScript function evaluates the script to be loaded in the scope of the second argument. Using this new...
...resent, the loadSubScript function evaluates the script to be loaded in the scope of the second argument. ...
...of the second argument. ...
Contributor's Guide - Archive of obsolete content
Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. ...
...Inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. ...
...rcing logical boundaries between them. Unfortunately, JavaScript does not yet have native support for modules: it has to rely on the host application to provide it with functionality such as loading subscripts, and exporting/ importing names. We will show how to do each of these things using the built-in Components object provided by Xulrunner application such as Firefox and Thunderbird. Private Properties People have come up with several ways to emulate private properties using existing language features. This article discusses two common techniques: one using prefixes, the other closures. ...
l10n - Archive of obsolete content
ipts 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. ...
...calized 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 compatibility with tools that expect this syntax, you can assign this function to "_": var _ = require("sdk/l10n").get; Given a .properties file for the current locale containing an entry like: hello_string= Hello! and the following code: var _ = require("sdk/l10n").get; console.log(_("hello_string")); the following output will be logged: info: Hello! If this function can't find the string referenced by the identifier parameter, it returns the identifier itself. This enables you to write functional, localizable code without lo...
... 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 themselves but instead should be ins...
simple-storage - Archive of obsolete content
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 a fresh profile each time it runs, simple storage won't work with add-ons executed using jpm run - that is,...
... icon: "./read.png", onClick: function() { console.log(ss.storage.pages); } }); But this isn't going 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. Here's an add-on that adds three buttons to write, read, and delete a value: var ss = require("sdk/simple-storage"); require("sdk/ui/button/action").ActionButton({ id: "write", label: "Write", icon: "./write.png", onClick: function() { ss.storage.value = 1; console.log("Setting value"); } }); require("sdk/ui/button/action").ActionButton({ id: "rea...
...s.storage.myList.pop(); }); Private browsing If your storage is related to your users' Web history, personal information, or other sensitive data, your add-on should respect private browsing. To read about how to opt into private browsing mode and how to use the SDK to avoid storing user data associated with private windows, refer to the documentation for the private-browsing module. Globals Properties storage A persistent object private to your add-on. Properties with array, boolean, number, object, null, and string values will be persisted. quotaUsage A number in the range [0, Infinity) that indicates the percentage of quota occupied by storage. A value in the range [0, 1] indicates that the storage is within quota. A value greater than 1 indicates that the storage exceeds quota. Events ...
windows - Archive of obsolete content
our add-on does not support private browsing this will have no effect. See the private-browsing documentation for more information. Optional options: Name Type onOpen function A callback function that is called when the window has opened. This does not mean that the URL content has loaded, only that the window itself is fully functional and its properties can be accessed. This is an optional property. onClose function A callback function that is called when the window will be called. This is an optional property. onActivate function A callback function that is called when the window is made active. This is an optional property. onDeactivate function A callback function that is...
...that is called when the window will be called. This is an optional property. onActivate function A callback function that is called when the window is made active. This is an optional property. onDeactivate function A callback function that is called when the window is made inactive. This is an optional property. Returns BrowserWindow : Properties browserWindows browserWindows provides access to all the currently open browser windows as BrowserWindow objects. var windows = require("sdk/windows"); for (let window of windows.browserWindows) { console.log(window.title); } console.log(windows.browserWindows.length); The currently active window is given by BrowserWindows.activeWindow: var windows = require("sdk/windows").browserWindows;...
...e); } // close the active window windows.activeWindow.close(function() { console.log("The active window was closed"); }); Methods activate() Makes window active, which will focus that window and bring it to the foreground. close(callback) Close the window. Parameters callback : function A function to be called when the window finishes its closing process. This is an optional argument. Properties title The current title of the window. Usually the title of the active tab, plus an app identifier. This property is read-only. tabs A live list of tabs in this window. This object has the same interface as the tabs API, except it contains only the tabs in this window, not all tabs in all windows. This property is read-only. ...
/loader - Archive of obsolete content
o modules that eventually may be // replaced with a real ones :) "devtools/gcli": Cu.import("resource:///modules/gcli.jsm", {}), "net/utils": Cu.import("resource:///modules/NetUtil.jsm", {}) } }); Loader Instances The loader produces instances that are nothing more than representations of the environment into which modules are loaded. It is intentionally made immutable and all its properties are just an implementation detail that no one should depend on, they may change at any point without any further notice. Loading Modules The CommonJS specification defines the notion of a main module, which represents an entry point to a program. The loader module exposes a main() function that can be used to load a main module. All other modules will be loaded by this module or its dependenci...
...y-addon/' ], [ '', 'resource:///modules/' ] ]; resolveURI('./main', mapping); // => resource://my-addon/main.js resolveURI('devtools/gcli', mapping); // => resource:///modules/devtools/gcli.js resolveURI('sdk/core/promise', mapping); // => resource://gre/modules/commonjs/sdk/core/promise.js override() This function is used to create a fresh object that contains own properties of two arguments it takes. If arguments have properties with conflicting names the property from the second argument overrides that from the first. This function is helpful for combining default and passed properties: override({ a: 1, b: 1 }, { b: 2, c: 2 }) // => { a: 1, b: 2, c: 2 } descriptor() This utility function takes an object and as an argument and returns property descriptor map for ...
...arguments it takes. If arguments have properties with conflicting names the property from the second argument overrides that from the first. This function is helpful for combining default and passed properties: override({ a: 1, b: 1 }, { b: 2, c: 2 }) // => { a: 1, b: 2, c: 2 } descriptor() This utility function takes an object and as an argument and returns property descriptor map for its own properties. It is useful when working with object functions introduced in ES5 (Object.create, Object.defineProperties, ..): // define properties of `source` on `target`. Object.defineProperties(target, descriptor(source)) ...
lang/type - Archive of obsolete content
escendant of Object.prototype or null. Similar to jQuery's isPlainObject. let { isFlat } = require('sdk/lang/type'); isFlat({}); // true isFlat(new Type()); // false function Type () {} Parameters value : mixed The variable to check. Returns boolean : Boolean indicating if value is a direct descendant of Object.prototype or null. isEmpty(value) Returns true if value is an Object with no properties and false otherwise. let { isEmpty } = require('sdk/lang/type'); isEmpty({}); // true isEmpty({ init: false }); // false Parameters value : object The variable to check. Returns boolean : Boolean indicating if value is an Object with no properties. isJSON(value) Returns true if value is a string, number, boolean, null, array of JSON-serializable values, or an object whose property values...
... instanceOf } = require('sdk/lang/type'); instanceOf(new Class(), Class); // true function Class() {} Parameters value : object The variable to check. Type : object The constructor to compare to value Returns boolean : Boolean indicating if value is an instance of Type. source(value, indent, limit) Returns the textual representation of value, containing property descriptors and types of properties contained within the object. let { source } = require('sdk/lang/type'); var obj = { name: undefined, twitter: '@horse_js', tweets: [ { id: 100, text: 'What happens to you if you break the monad laws?' }, { id: 101, text: 'JAVASCRIPT DUBSTEP GENERATOR' } ] }; console.log(source(obj)); // Prints the below /* { // [object Object] // writable configurable enumerable name: u...
... Returns string : The textual representation of value. ...
places/history - Archive of obsolete content
// results is an array of objects containing visit data, // sorted by visit date, with all entries from more than a week ago // that contain 'ruby', *in addition to* entries from this last week // that contain 'javascript' }); Globals Functions search(queries, options) Queries can be performed on history entries by passing in one or more query options. Each query option can take several properties, which are AND'd together to make one complete query. For additional queries within the query, passing more query options in will OR the total results. An options object may be specified to determine overall settings, like sorting and how many objects should be returned. Parameters queries : object|array An Object representing a query, or an Array of Objects representing queries. Each query ob...
...ther to make one complete query. For additional queries within the query, passing more query options in will OR the total results. An options object may be specified to determine overall settings, like sorting and how many objects should be returned. Parameters queries : object|array An Object representing a query, or an Array of Objects representing queries. Each query object can take several properties, which are queried against the history database. Each property is AND'd together, meaning that bookmarks must match each property within a query object. Multiple query objects are then OR'd together. options : object Optional options: Name Type count number The number of bookmark items to return. If left undefined, no limit is set. sort ...
...e, 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. ...
platform/xpcom - Archive of obsolete content
y property of the instance (for example, any classes added to this object via the implements option defined in heritage). If it finds a match, it returns this, otherwise it throws Components.results.NS_ERROR_NO_INTERFACE. Parameters interface : iid The interface to ask for. This is typically given as a property of the Components.interfaces object. Returns object : The object itself(this). Properties interfaces The set of interfaces supported by this class. Unknown sets this to nsISupports. Factory Use this class to register an XPCOM factory. To register a factory for a component, construct a Factory, giving it: a constructor for the component a contract ID and/or a class ID // Create and register the factory var factory = Factory({ contract: '@me.org/myComponent', Component: My...
...nent: 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) Creates an instance of the component ...
...ar custom = factory.createInstance(null, Ci.nsISupports).wrappedJSObject; // You can now access the interface defined for the 'custom' object Returns object : The component created by the factory. lockFactory() This method is required by the nsIFactory interface, but as in most implementations it does nothing interesting. QueryInterface() See the documentation for Unknown.QueryInterface(). Properties interfaces The set of interfaces supported by this object. Factory sets this to nsIFactory. id This factory's class ID. contract This factory's contract ID. Service Use this class to register an XPCOM service. To register a service for a component, construct a Service, giving it: a constructor for the object implementing the service a contract ID and/or a class ID var service = Serv...
remote/child - Archive of obsolete content
Listener functions that enable you to listen to DOM events dispatched by the frame. Communicating with the parent process To communicate with the parent process, the process, frames, and frame objects in sdk/remote/child have a port object that you can use to receive messages from, and send messages to, code in the parent. See the documentation for sdk/remote/parent for more details. Globals Properties process A Process object. frames A Frames object. Process A link to the main process. Properties port An event emitter that sends and receives events from the main process. isRemote A boolean property indicating whether this process is remote from the main process or not. Frames A list of the content frames in this process. Each element in this list is a Frame. Listen to attach and d...
...every existing frame and any new frames created in the future. This is a shortcut for enumerating existing frames and then listening for attach events. getFrameForWindow Finds the frame for a top level DOM window. addEventListener Adds an event listener for DOM events dispatched to any existing and future frames. removeEventListener Removes an event listener that was previously registered. Properties port An event emitter that sends and receives events from every frame in this process. Events attach Triggered when a new content frame is opened (for example, the user opened a new tab). The event listener gets a Frame object as an argument. At this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/remote/child"); frames.on("att...
...ocess. Methods addEventListener(event, listener, isCapturing) Adds an event listener for DOM events dispatched by this content frame. This can include load and unload events from any content that is loaded in the frame. Listeners are automatically removed when this frame is destroyed. removeEventListener(event, listener, isCapturing) Removes an event listener that was previously registered. Properties port An event emitter that can be used to send and receive frame specific events to and from code in the main process. content The top level DOM window currently displaying in this frame. isTab A boolean property indicating whether this frame displays in one of the application's main browser tabs. Events detach Event emitted when this frame disconnects from the application. ...
Bootstrapped extensions - Archive of obsolete content
The add-on is being upgraded. ADDON_DOWNGRADE 8 The add-on is being downgraded. Bootstrap data Each of the entry points is passed a simple data structure containing some useful information about the add-on being bootstrapped. More information about the add-on can be obtained by calling AddonManager.getAddonByID(). The data is a simple JavaScript object with the following properties: Property Type Description id string The ID of the add-on being bootstrapped. version string The version of the add-on being bootstrapped. installPath nsIFile The installation location of the add-on being bootstrapped. This may be a directory or an XPI file depending on whether the add-on is installed unpacked or not. resourceU...
... bootstrapped add-ons is very much the same since Firefox 7, as that is when chrome.manifest compatibility landed. JS and JSM Files - Using Property Files To localize your .js and .jsm files you have to use property files. The absolute minimum needed here is: File: install.rdf File: chrome.manifest File: bootstrap.js Folder: locale Folder: VALID_LOCALE_HERE File: ANYTHING.properties In the locale folder you must have folders for each of the languages you want to provide; each folder must be named a valid locale (ex: en-US). Inside this folder must be a property file. Inside the chrome.manifest file these locale must be defined. For example if you had a subfolder of en-US in locale folder your chrome.manifest file will have to contain: locale NAME_OF_YOUR_ADDO...
...folders for each of the languages you want to provide; each folder must be named a valid locale (ex: en-US). Inside this folder must be a property file. Inside the chrome.manifest file these locale must be defined. For example if you had a subfolder of en-US in locale folder your chrome.manifest file will have to contain: locale NAME_OF_YOUR_ADDON en-US locale/ Here is an example: GitHub :: l10n-properties - on startup of this add-on it will show a prompt saying USA or Great Britain, which ever it deems closest to your locale. You can test different locale by going to about:config and changing preference of general.useragent.locale to en-US and then to en-GB and disabling then re-enabling the add-on. XUL and HTML Files - Using Entities from DTD Files Many times HTML pages are used, however they c...
Preferences - Archive of obsolete content
lizedString. It is similar to nsISupportsString, except that when there is no user value, getComplexValue() gets the default value from a locale file (thus making the default value localizable). It's easier to explain this by example. Let's say you want to make the default value for the extensions.myext.welcomemessage preference localizable. You should do the following: Add this line to some .properties file (for all of your locales), say to chrome://myext/locale/defaults.properties: extensions.myext.welcomemessage=Localized default value Add the default value for extensions.myext.welcomemessage, pointing to that properties file, by adding the following line to your file with default preferences (see below). pref("extensions.myext.welcomemessage", "chrome://myext/locale/defaults.properti...
... Setting nsIPrefLocalizedString preferences is similar to setting nsISupportsString: var pls = Components.classes["@mozilla.org/pref-localizedstring;1"] .createInstance(Components.interfaces.nsIPrefLocalizedString); pls.data = val; prefs.setComplexValue("prefer...
...e applied immediately in your extension. In this case, you can use the nsIPrefBranch2 interface to "listen" for changes to preferences in a certain branch. Note that it need not be your own extension's preferences; you can set an observer on any preference or branch. When a change is made to the preferences, you can take the appropriate action (such as reinitializing variables or toggling display properties in XUL components). This technique will work no matter how or where the preferences are changed: in another browser window, directly in the about:config interface, or even by another extension. Note: During Gecko 13 development, nsIPrefBranch2 was deprecated, and its methods moved to nsIPrefBranch. Calling .QueryInterface(Components.interfaces.nsIPrefBranch2) is no longer required, although it s...
Enhanced Extension Installation - Archive of obsolete content
tup system that there is an install operation pending that needs to be finalized, e.g. needs-install, needs-upgrade, needs-uninstall, needs-enable, needs-disable, needs-install When the Extension Manager starts, this dataset is read into two data structures: The Startup Cache - a hashtable keyed off Install Location name and then GUID, each entry having persistentDescriptor, mtime and id properties. The Pending Operations List - a set of entries organized into arrays hashed by operation key, each entry having a locationKey and id properties. The Startup Cache data structure is used to reflect the extensions-startup.manifest file over the lifetime of the running application, the extensions-startup.manifest file is written from the current state of the cache. The Pending Operati...
...ister command line flag, so support for that has been removed. Datasource Structure Since there is now only a single RDF/XML datasource for storage of all installed items, the staggered datasource structure used by Firefox 1.0 and the use of an internal composite datasource is no longer required. The Extension System retains an object implementing nsIRDFDataSource (so that it can supply special properties in addition to the set stored simply in the XML datasource) and an internal member that holds the single RDF/XML datasource. Properties are read and are written directly to this, there are no shims. Tracking Install Locations Since there is now only a single datasource, Install Location information is tracked for every item in the single datasource in the form of a string <em:installLocation> p...
...ies when the Install function returns. If the item is a Theme, we perform the installation immediately (thanks to Benjamin Smedberg's Chrome Registry changes this operation is now so simple that it can be performed by a function on the ExtensionManager, rather than creating a separate object). If the item is an Extension, we add it to the Extension container and set the same set of initial setup properties on it that we used to, with the addition of the installLocation key and the type value. At this stage we rewrite the extensions-startup.manifest and extensions.ini manifests and create the .autoreg file in the profile directory. Finalization On the next startup, the Startup system discovers the .autoreg file (as before) and starts the Extension System with the dirty flag, which causes the syst...
Extension Etiquette - Archive of obsolete content
nflicts There are many namespaces which extensions often must share with other consumers, be they other add-ons, web code, or the browser itself. These often include areas such as: Object prototypes, such as String.prototype, which are often extended to add methods to native objects. Global variables, such as top-level declarations on scripts loaded into shared windows or web pages. Expando properties of shared objects, such as document objects, or DOM nodes. IDs and class names in HTML and XUL documents, when extensions add elements to web pages or browser windows. chrome: or resource: packages, which are often defined in chrome.manifest files. about: page URLs. XPCOM contract IDs, which are often registered in chrome.manifest files. While these are among the most common examples of nam...
...n whenever defining a name anywhere that other code might do likewise. Strategies to avoid such conflicts include: Avoid shared namespaces where possible Many naming conflicts are best avoided by simply not sharing namespaces. Scripts can be loaded into their own globals, such as CommonJS modules, JavaScript modules, or Sandboxes, to avoid most global variable and prototype conflicts. ...
... Some namespaces have specific conflict prevention conventions, which should be followed as appropriate. ...
JavaScript Object Management - Archive of obsolete content
w a more practical approach of having just one namespace with the project name. Notice how the <Namespace> namespace is declared using var. We need the namespace to be a global object that it can be used everywhere in the window chrome. You can include functions in any namespace, since namespaces are just regular JS objects. That should come in handy when you have general utility functions or properties that you want to use across all objects within the namespace. For instance, there are frequently used XPCOM services such as the Observer service that can be included as members in the namespace: /** * <Namespace> namespace. */ if (typeof <Namespace> == "undefined") { var <Namespace> = { /** * Initializes this object. */ init : function() { this.obsService = ...
...(Ci.nsIObserverService); } }; <Namespace>.init(); }; JS objects can also 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...
...{ return this._url; } }; In this example we defined a fictitious User class for the Hello World extension. Using the function keyword to define a class is odd, but this is just the JavaScript way: functions are also objects. The definition of the class acts as a constructor as well, and then you can define all other members using the prototype attribute. In this case we defined "getter" properties for the name and url members. This way we have immutable instances of our class. Well, only if consumers of the class play nice and don't change anything they shouldn't. Creating an instance and using it is simple enough: let user = new <ModuleNamespace>.User("Pete", "http://example.com/pete"); window.alert(user.name); This is something you can do with JS in general. You can use it in JS...
The Box Model - Archive of obsolete content
flexible elements using the minwidth, maxwidth, minheight and maxheight attributes, or their CSS counterparts: min-width, max-width, min-height and max-height. The latter are recommended to keep style code in the skin section of the chrome. As their names should make clear, you can control the flexibility boundaries of elements, thus preventing them from growing or shrinking too much. All CSS properties involving lengths should be handled with caution. We recommended that you use proportional units (em, %) instead of absolute units (px) whenever possible. Using the former allows the UI to scale proportionately depending on font size settings, which are often changed by users with accessibility limitations. A common exception to this rule is when your CSS is directly related to images, where you'...
...g the former allows the UI to scale proportionately depending on font size settings, which are often changed by users with accessibility limitations. A common exception to this rule is when your CSS is directly related to images, where you'll usually handle measurements in pixels (px). Also, just like in HTML, you can control the dimensions of inflexible elements using the width and height CSS properties and attributes. These attributes won't have any effect on flexible elements. Margins, paddings and spacers Margins and paddings are frequently used in both HTML and XUL to 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...
...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 attributes, or the -moz-box-align and -moz-box-pack CSS properties. Packing determines the positioning of the child elements in the direction of the container's orientation. Alignment determines the positioning in the other direction. So, in a flexed hbox, having center alignment and end packing results in this: One important thing to notice is that aligment and flexibility can't be mixed in some cases. If you add flexibility to one of the buttons, the packin...
Localizing an extension - Archive of obsolete content
pt 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, lowString, highString, and volumeString) to the corresponding text in English. Create the string bu...
...ring, openString, lowString, highString, and volumeString) to the corresponding text in English. Create the string bundle The 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 ...
...lized versions of those property files in the chrome/locale/es-ES directory as well. Only the strings should be localized; the keys should be the same for each localization. << PreviousNext >> See Also How to localize html pages, xul files, and js/jsm files from bootstrapped add-ons: Bootstrapped Extensions :: Localization (L10n) XUL School Localization Tutorial: DTD/Entities method and Properties method ...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
pruntime sample plugin source code into the dir of the new VS project and add the files to the project using the VS GUI (.cpp files to "Source Files", .h files to "Header Files", .rc file to "Resource Files"). Samples can be obtained from: https://developer.mozilla.org/en/Plugins/Samples_and_Test_Cases Get the NPAPI SDK. ...
...ned from: https://developer.mozilla.org/en/Plugins/Samples_and_Test_Cases Get the NPAPI SDK. Add the NPAPI SDK include path (example : C:\npapi-sdk\headers) to Project Properties|(all configurations)|C++|General|Additional Include Directories. Note: If your project is still empty, the C++ tree might not be visible. So, add some files first. ...
...operties|(all configurations)|C++|General|Additional Include Directories. Note: If your project is still empty, the C++ tree might not be visible. So, add some files first. Add the following preprocessor definitions to Project Properties|(all configurations)|C++|Preprocessor|Preprocessor Definitions: WIN32;_WINDOWS;XP_WIN32;XP_WIN;_X86_;NPSIMPLE_EXPORTS Disable precompiled headers using Project Properties|(all configurations)|C++|Precompiled headers|Create/Use precompiled header. They may be already disabled. Define the function exports by adding the .def filename (e.g. nprt.def) to Project Properties|(all configurations)|Linker|Input|Module Definition File. It could be either the full path or the path relative to the project directory. Optional: Open the above .def file and change "NPRT" to the...
In-Depth - Archive of obsolete content
All of the properties follow the W3C's standards for vendor extensions, which is why they all begin with -moz. This is only a list of properties which may be useful to you; it is in no way all of the Mozilla specific properties available. ...
... System Colours CSS2 defines colours which are the same as your operating systems theme. A list of the different operating system colours can be found on the W3C's web site. Mozilla CSS Properties Mozilla.org created their own CSS properties to allow them to use the technology for the UI of Mozilla. All of the properties follow the W3C's standards for vendor extensions, which is why they all begin with -moz. This is only a list of properties which may be useful to you; it is in no way all of the Mozilla specific properties available. Other sites which list Mozilla specific CSS properties XulPlanet.com [dead link, 26.03.13] Mozilla-prefixed properties on the standard track 26.03.13 -moz-appearance Makes a widget look like it's from your operating system. Possible are (This is probably an incom...
...Adding an image to the right of a toolbar This tutorial is done with Mozilla 1.2 in mind. The layout of files can and probably will change over time, but the basics should remain the same. By default, Mozilla 1.2 doesn't support images on the right hand side of the toolbars, but that can be changed with some XBL hacking. Plac...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
andle the XPCOM interfaces and pass a simpler data structure to functions of the observer object. The observer is an object that you declare yourself. In the above examples, this observer is stored in the buttonObserver and textObserver variables. The observer is declared in a script which you would include in the XUL file using the script tag. The observer is an object which may have a number of properties, each set to a function which handles a particular aspect of drag and drop. Five functions may be defined. You only have to define the ones that you need. onDragStart(event, transferData, action) Define this function to have something happen when a drag starts. It takes three arguments, the event object as was originally passed to the event handler, the data to drag and the type of drag action.
...ion) { var htmlText = "<strong>Cabbage</strong>"; 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...
...d for elements that accept dragged data however. Next, the onDrop function should be created. Its second argument is the transfer data object that holds the data being dragged. By the time 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 t...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
art embedding, we use the methods provided by the Mozilla singleton class. ...
...Range[1]; range[0] = new GREVersionRange("1.8.0", true, "1.9", false); // work with trunk nightly version 1.9a1 ^^ try { File grePath = Mozilla.getGREPathWithProperties(range, null); LocationProvider locProvider = new LocationProvider(grePath); mozilla.initEmbedding(grePath, grePath, locProvider); } catch (FileNotFoundException e) { // this exception is thrown if greGREPathWithProperties cannot find a GRE } catch (XPCOMException e) { // this exception is thrown if initEmbedding failed } LocationProvider is a class provided by the Java application. ...
...PathWithProperties cannot find a GRE } catch (XPCOMException e) { // this exception is thrown if initEmbedding failed } LocationProvider is a class provided by the Java application. It implements the IAppFileLocProvider interface, and tells XPCOM where to find certain files and directories. If your code cannot find the GRE and keeps throwing FileNotFoundExceptions during the getGREPathWithProperties(...) call, check whether you already registered the GRE on your system: GRE Registration The initEmbedding method kicks off the embedding process, allowing the Java application to work with XPCOM and Mozilla. Once the Java application is done using Mozilla, it needs to terminate the embedding process: try { mozilla.termEmbedding(); } catch (XPCOMException e) { // this exception is throw...
Venkman Introduction - Archive of obsolete content
s 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 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 ...
...re 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 view's context menu. You may need to close and re-open any objects you had open to see 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 a...
...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. ...
Binding Attachment and Detachment - Archive of obsolete content
t explicitly extends in its inheritance chain) will be detached. No bindings will be attached to elements that match the style rule, but are inside an element that has style display:none set. See bug 307098. Whenever an element is removed from a document, any bindings attached via CSS loaded by the document will be detached. Attachment using element.style property None of the XBL inheritance properties of element.style.MozBinding described here are implemented (if ever). Bindings can be attached to elements through the scripting by assigning the element.style.MozBinding property. Respectively bindings can be detached by setting element.style.MozBinding to empty string. Note: Some older papers mentioned DOM methods document.addBinding and document.removeBinding; these were subsequently discar...
...e assumed that all bindings are attached to all elements in the page. For elements that are created during or after the load event is fired, no assumptions can be made regarding order of binding attachment. When a binding is attached, the following events occur: If required, anonymous content is cloned from the binding's content template and inserted around the bound element. The methods and properties of the binding are installed on the element and become available to scripts that reference the bound element. Any specified event handlers are installed on their requested targets. If the binding needs to execute any initialization code following its attachment to an element, it can do so using a <constructor> block inside <implementation> section. This block contains script that executes upon...
...oved from the bound document The element is destroyed (e.g., by closing the document) Bindings attached 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 dow...
Elements - Archive of obsolete content
,content?,implementation?,handlers?)"> <!ELEMENT binding %binding-content;> <!ATTLIST binding id ID #REQUIRED extends CDATA #IMPLIED display CDATA #IMPLIED inheritstyle true #IMPLIED > The binding element describes a single XBL binding. A XBL binding can add anonymous content, fields, properties, methods, and event handlers to HTML/XML elements. A single XBL binding can be attached to an element by using style sheets or by scripting. (See bug 83830 for <table> specifics). CSS: div { -moz-binding: url(myBinding.xml#default); } DOM: elementReference.style.MozBinding = "url(myBinding.xml#default)"; In both cases above we are using binding with id="default" contained in file myBindi...
...hoge" doesn't match for the immediate child foobar element. implementation <!ENTITY % implementation-content "(method|property)*"> <!ELEMENT implementation %implementation-content;> <!ATTLIST implementation id ID #IMPLIED name CDATA #IMPLIED implements CDATA #IMPLIED > The implementation element describes the set of methods and properties that are attached to the bound element. Once the binding is attached, these methods and properties can be invoked directly from the bound element. id - The id attribute is a document-unique identifier. name - The name attribute can be used to provide a specific name for an implementation. This name can then be used to reference the implementation. For example, in JavaScript the value of this ...
... Prior to Firefox 3, the constructor could be called at a time when reflow of the document layout was locked down, so that attempting to get layout information from within the constructor could return out of date information. In Firefox 3 and later, the constructor is called when reflow can take place, which results in up-to-date information being returned. See bug 398404 for details. Note: All properties of the binding are "imported" as local variables in a constructor's scope. See bug 407314 for more details. destructor The code inside the destructor is called when a binding is being removed from an element. You can use this to unload resources to free memory. However the destructor is often not called when it should, see bug 230086. The destructor tag must be placed inside the implementation ...
XPInstall API reference - Archive of obsolete content
Parts of this page 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. ...
...onfirm deleteRegisteredFile execute gestalt getComponentFolder getFolder getLastError getWinProfile getWinRegistry initInstall loadResources logComment patch performInstall refreshPlugins registerChrome resetError setPackageFolder InstallTrigger No properties Methods compareVersion enabled getVersion install installChrome startSoftwareUpdate InstallVersion Properties Methods compareTo init toString File No properties Methods copy dirCreate dirGetParent dirRemove dirRename ...
... copy dirCreate dirGetParent dirRemove dirRename diskSpaceAvailable execute exists isDirectory isFile 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 ...
Sorting and filtering a custom tree view - Archive of obsolete content
1 : -1; //if the column is passed and it's already sorted by that column, reverse sort if (column) { column...
...1 : -1; //if the column is passed and it's already sorted by that column, reverse sort if (column) { columnName = column.id; if (tree.getAttribute("sortRe...
...1 : -1; //if the column is passed and it's already sorted by that column, reverse sort if (column) { columnName = column.id; if (tree.getAttribute("sortResource") == columnName) { order *= -1; } } else {...
textbox (Toolkit autocomplete) - Archive of obsolete content
It is used to create a textbox with a popup containing a list of possible completions for what the user has started to type. Toolkit applications (such as Firefox) use a different autocomplete mechanism than the Mozilla suite. The example below will create an autocomplete textbox that will search the user's history. ...
...ndex,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, tabScrolling, t...
...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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. completeDefaultIndex New in Thunderbird 3Requires SeaMonkey 2.0 Type: boolean Gets and sets the value of the completedefaultindex attribute. controller Type: nsIAutoCompleteController Returns the controller for the auto complete element. ...
Textbox (XPFE autocomplete) - Archive of obsolete content
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. ...
...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, selectionEnd, selecti...
...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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessible Type: nsIAccessible Returns the accessibility object for the element. alwaysOpenPopup Obsolete since Gecko 1.9.1 Type: boolean Gets and sets the value of the alwaysopenpopup attribute. autoFill Type: boolean Gets and sets the value of the autofill (or autoFill) attribute. autoFillAfterMatch Obsolete since Gecko 1.9.1 Type: boolean ...
The Joy of XUL - Archive of obsolete content
m environments because the skills required to develop these two parts are often satisfied by different people. XUL provides a clear separation among the client application definition and programmatic logic ("content" consisting of XUL, XBL, and JavaScript), presentation ("skin" consisting of CSS and images), and language-specific text labels ("locale" consisting of DTDs and string bundles in .properties files). The layout and appearance of XUL applications can be altered independently of the application definition and logic. Further, the application can be localized for different languages and regions independently of its logic or presentation. This degree of separation results in applications that are easier to maintain by programmers and readily customized by designers and language transl...
...There are number of other technologies introduced by Mozilla that complement XUL for building cross platform web applications. XBL The eXtensible Bindings Language (XBL) is a markup language that defines special new elements, or "bindings" for XUL widgets. With XBL, developers can define new content for XUL widgets, add additional event handlers to a XUL widget, and add new interface properties and methods. Essentially, XBL empowers developers with the ability to extend XUL by customizing existing tags and creating new tags of their own. By using XBL, developers can easily build custom user interface widgets such as progress meters, fancy pop-up menus, and even toolbars and search forms. These custom components can then be used in XUL applications by specifying the custom tag and as...
...ther simplify their implementation. XPCOM/XPConnect enables integration of native code.A fully-featured open source calendar library, libical, was harvested for the Calendar project. Libical is an Open Source implementation of the IETF's iCalendar Calendaring and Scheduling protocols (RFC 2445, RFC 2446, and RFC 2447). It parses iCal components and provides a C API for manipulating the component properties, parameters, and subcomponents. The library was initially integrated by writing an XPCOM wrapper to adapt its interface. To improve performance a greater proportion of application logic was migrated from JavaScript to the XPCOM component. Separation of presentation from logic makes applications resilient to change.The original UI implementation made extensive use of graphics for rendering the mo...
Complete - Archive of obsolete content
place--it keeps each set of files separate. In the allcustom directory, the file allcustom.dtd contains the translated strings. The file contents.rdf contains registration data used by SeaMonkey. Localizing the description Firefox etc. display a description of the extension in the Extensions window. The description in install.rdf is the default. For each supported locale, a description in install.properties overrides the default. A preference setting in defaults/preferences/allcustom.js makes the connection between the description and the properties file, specifying the URL: chrome://allcustom/locale/install.properties Again, the application's chrome registry converts this URL to the correct file for the locale you are using. For example, if your locale is fr-FR, it gets the description from: locale...
... preference setting in defaults/preferences/allcustom.js makes the connection between the description and the properties file, specifying the URL: chrome://allcustom/locale/install.properties Again, the application's chrome registry converts this URL to the correct file for the locale you are using. For example, if your locale is fr-FR, it gets the description from: locale/fr-FR/allcustom/install.properties Testing a locale To test the alternative locale, install the extension in the normal way. Restart the application using the command line switch: -uiLocale fr-FR (Of course, if your application is already in French, specify en-US here to switch the extension to English.) Notes: If you use a shortcut or launcher icon to start the application, then you can add the command line switch by editing t...
... locale To test the alternative locale, install the extension in the normal way. Restart the application using the command line switch: -uiLocale fr-FR (Of course, if your application is already in French, specify en-US here to switch the extension to English.) Notes: If you use a shortcut or launcher icon to start the application, then you can add the command line switch by editing the icon's properties. The application's user interface only switches language if you have the appropriate language pack installed. But this extension switches between English and French without needing any language pack. Some versions of Firefox etc. have a bug that prevents this from working. To work around the bug, close the application, delete the file XUL.mfl in its profile, then restart it with the command l...
Adding Methods to XBL-defined Elements - Archive of obsolete content
These methods can be called from a script. Methods are the functions of objects, such as Window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">Window.open(). You can define custom methods for your elements using the method element. ...
...elements using the method element. The general syntax of methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-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 met...
... } else { document.getAnonymousNodes(this)[0].setAttribute("style","visibility: collapse"); } </body> </method> </implementation> </binding> The oncommand handlers here first get a reference to their parent bound element. (In this example, it is the box with the labeledbutton class). Then, the 'showTitle' method is called, which functions as it did before. Custom properties and methods are added only to the outer XUL element the XBL is bound to. None of the elements declared inside the content tag have these properties or methods. This is why we have to get the parent first. The children of an element placed in the XUL file can be retrieved in the normal way and don't move even if you use the children tag. For example: XUL: <box id="outer" class="container"> <b...
Stacks and Decks - Archive of obsolete content
<< PreviousNext >> There may be need to display elements as a set of overlapping cards. The stack and deck elements can be used for this purpose. Containers Each XUL box is a container that can contain any other element. There are a number of elements that are specialized types of boxes, such as toolbars and tabbed panels. The box tag creates the simplest box with no special properties. However, the specialized types of boxes work just like regular boxes in the way they orient the elements inside them, but they have additional features. In fact, many components can contain other elements. We've already seen that buttons may contain other things besides the default. A scroll bar is just a special type of box that creates its own elements if you don't provide them. It also handles t...
...all on top of each other. The first child of the stack is drawn underneath, the second child is drawn next, followed by the third and so on. Any number of elements may be stacked up in a stack. The orient property has little meaning on a stack as children are laid out above each other rather than from side to side. The size of the stack is determined by its largest child, but you can use the CSS properties width, height, min-width and other related properties on both the stack and its children. The stack element might be used for cases where a status indicator needs to be added over an existing element. For example, a progress bar might be created using a bar and a label overlaid on top of it. Shadowing with stacks One convenient use of the stack element however is that you could emulate a numbe...
...eight, min-width and other related properties on both the stack and its children. The stack element might be used for cases where a status indicator needs to be added over an existing element. For example, a progress bar might be created using a bar and a label overlaid on top of it. Shadowing with stacks One convenient use of the stack element however is that you could emulate a number of CSS properties with it. For example, you could create an effect similar to the text-shadow property with the following: Example 1 : Source View <stack> <description value="Shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="Shadowed" style="color: red; font-size: 15pt;"/> </stack> Both description elements create text with a size of 15 points. The first, howeve...
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
r instance, a tree might have thousands of rows, yet most of them will be scrolled off the border of the tree, hidden from view. This means that the tree is scalable to any number of rows without any performance problems. Of course, this is independant of the performance of the view object itself. A tree view is an object which implements the nsITreeView interface. This interface contains thirty properties and functions which you may implement. These functions will be called by the tree as necessary to retrieve data and state about the tree. For instance, the getCellText() function will be called to get the label for a particular cell in the tree. An advantage of using a tree view is that it allows the view to store the data in a manner which is more suitable for the data, or to load the data on d...
... For instance, the getCellText() function will be called to get the label for a particular cell in the tree. An advantage of using a tree view is that it allows the view to store the data in a manner which is more suitable for the data, or to load the data on demand as rows are displayed. This allows more flexibility when using trees. Naturally, having to implement a tree view with thirty or so properties and methods for every tree can be very cumbersome, especially for simple trees. Fortunately, XUL provides a couple of built-in view implementations which do most of the hard work for you. For most trees, especially when you first start to use trees, you will use one of these built-in types. However, you can create a view entirely from scratch if necessary. If you do, you might store the data in a...
... 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, only a handful of attributes apply to the treeitem and related elements. For instance, you cannot change the appearance of the tree rows using the style attribute or with other CSS properties and the box related features such as flexibility and orientation cannot be used. In addition, mouse and other user interface events do not fire at these elements. In fact, apart from some tree specific attributes, the only attributes that will have any effect will be the label attribute to set a text label for a cell and the src attribute to set an image. However, there are special ways of styli...
XUL Structure - Archive of obsolete content
orms it into a document tree. The tree is then converted into a set of objects that can be displayed on the screen. Style sheets (CSS), images, and other technologies are used to control the presentation. XUL functions in much the same way. In fact, in Mozilla, all document types, whether they are HTML or XUL, or even SVG, are all handled by the same underlying code. This means that the same CSS properties may be used to style both HTML and XUL, and many of the features can be shared between both. However, there are some features that are specific to HTML, such as forms, and others which are specific to XUL, such as overlays. Since XUL and HTML are handled in the same way, you can load both from either your local file system, from a web page, or from an extension or standalone XULRunner application...
...kin part changes independently. Locales The file en-US.jar describes the language information for each component, in this case for US English. Like the skins, each language file contains files that specify text used by the package for a specific language. The locale structure is similar to the others, so it won't be listed here. The localized text is stored in two types of files: DTD files and properties files. The DTD files have a .dtd extension and contain entity declarations, one for each text string that is used in a window. For example, the file browser.dtd contains entity declarations for each menu command. In addition, keyboard shortcuts for each command are also defined, because they may be different for each language. DTD files are used by XUL files so, in general, you will have one per ...
...ion and contain entity declarations, one for each text string that is used in a window. For example, the file browser.dtd contains entity declarations for each menu command. In addition, keyboard shortcuts for each command are also defined, because they may be different for each language. DTD files are used by XUL files so, in general, you will have one per XUL file. The locale part also contains properties files, which are similar, but are used by script files. The file browser.properties contains a few such localized strings. This structure allows you to translate Mozilla or a component into a different language by just adding a new locale for that language. You don't have to change the XUL code at all. In addition, another person could supply a separate package that applies a skin or locale to y...
XUL element attributes - Archive of obsolete content
boolean If true, then the element is collapsed and does not appear. It is equivalent to setting the CSS visibility property to collapse. container Type: boolean Set to true if the element is to act as a container which can have child elements. This would be used for folders. This will be set by the template builder as needed. containment Type: URI This attribute specifies RDF properties (an RDF predicate) that indicate that a resource is a container. When generating content from a template this is used to determine which resources from the datasource are containers and thus can have child nodes and which ones are not containers. This attribute should be placed on the same element that the datasources and the ref attribute is on. It may be set to a space-separated list of RDF pr...
...equal in size. 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. never All of the children are displayed at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. 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.
...he broadcaster it is also changed in the observer. ordinal Type: string (representing an integer) An integer which specifies the position of the element within its parent. By default, elements appear in the order they appear in the XUL code. The ordinal attribute can be used to change the order. Note the default ordinal for elements is 1. You can retrieve the displayed order by using the properties of the boxObject of the container. orient Type: one of the values below Used to specify whether the children of the element are oriented horizontally or vertically. The default value depends on the element. 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 sou...
binding - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Should be contained within a bindings element. A binding is used to bind a variable to a node. Like the triple element in syntax, it can be used to bind a particular property of a matched node to a particular variable name. That name can then be used within the action of a rule. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Should be contained within a bindings element. A binding is used to bind a variable to a node. Like the triple element in syntax, it can be used to bind a particular property of a matched node to a particular variable name. That name can then be used within the action of a rule. ...
...sources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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, , boxObje...
bindings - Archive of obsolete content
This element should be contained within a rule element and contain one or more binding elements. This element is optional in Firefox 3/Mozilla 1.9 and later; instead binding elements may be placed directly inside the rule element. More information is available in the Template Guide. ...
...ip, 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. ...
..., 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. ...
checkbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An element that can be turned on and off. This is most commonly rendered as a box when the element is off and a box with a check when the element is on. The user can switch the state of the check box by selecting it with the mouse. A label, specified with the label attribute, may be added beside the check box. More information is available in the XUL tutorial. ...
...ly rendered as a box when the element is off and a box with a check when the element is on. The user can switch the state of the check box by selecting it with the mouse. A label, specified with the label attribute, may be added beside the check box. More information is available in the XUL tutorial. Attributes accesskey, checked, command, crop, disabled, src, label, preference, tabindex Properties accessKey, accessibleType, checked, command, crop, disabled, src, label, tabIndex Examples <checkbox label="Enable JavaScript" checked="true"/> <checkbox label="Enable Java" checked="false"/> Attributes accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the ele...
...nects 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. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. checked Type: boolean Gets and sets the value of the checked attribute. command Type: element id Gets and sets the value of the command attri...
command - Archive of obsolete content
For example, a clipboard paste operation can be invoked from the Edit menu, a context menu and by pressing a keyboard shortcut. You attach the code to the command using the oncommand attribute. It will be called no matter how it is invoked by the user. In addition, disabling the command will automatically disable the menu items and keyboard shortcuts. Commands are identified by their id. If you include the script chrome://global/content/globalOverlay.js in your window, you can use the function goDoCommand function to invoke the command. ...
...reserved for Chrome code and is not available for use in the content. This means that, to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed. Currently, the content still receives these key events, even though it can't override them. In future releases, it won't receive them. See bug 1173061 for details. ...
...nd is not available for use in the content. This means that, to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed. Currently, the content still receives these key events, even though it can't override them. In future releases, it won't receive them. See bug 1173061 for details. ...
commandset - Archive of obsolete content
In addition, this element can hold a command updater which is used to update commands when certain events occur. A common use of the command updater is to update cut, copy, and paste menu items. More information is available in the XUL tutorial. ...
...u 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. ...
... 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. ...
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. ...
... 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. </description> This is a long section of text that will not word wrap <description value="This is a long section of text t...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. crop Type: string Gets and sets the value of the crop attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. tabIndex Type: integer Gets and sets the value of the tabindex ...
dialog - Archive of obsolete content
The buttons attribute may be used to set which buttons should appear in the dialog box. These buttons will be placed in the correct locations for the user's platform. More information is available in the XUL tutorial and Dialogs and prompts (code snippets). ...
...ompts (code snippets). ...
...ssed. This should be set to one of the same values as those for the buttons attribute. inactivetitlebarcolor Type: color string Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X. title Type: string The text to appear in the title bar of the window. Properties buttons Type: comma-separated list of the values below A comma-separated list of buttons to appear on 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 th...
dialogheader - Archive of obsolete content
This element should be placed inside a dialog element. The header may have a title and a description. ...
...e maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to the dialog title. title Type: string The text to appear in the title bar of the window. ...
...verride this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to the dialog title. title Type: string The text to appear in the title bar of the window. ...
dropmarker - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A dropmarker is a button with an arrow which will reveal more details when pressed. A dropmarker is not intended to be used as a separate element, but as part of another element. For instance the menulist and the popup type of datepicker use a dropmarker, that when pressed, will reveal a popup menu. ...
...ference home [ Examples | Attributes | Properties | Methods | Related ] A dropmarker is a button with an arrow which will reveal more details when pressed. A dropmarker is not intended to be used as a separate element, but as part of another element. For instance the menulist and the popup type of datepicker use a dropmarker, that when pressed, will reveal a popup menu. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ord...
editor - Archive of obsolete content
Set the value of the editortype attribute to html to create an editor document. 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. To specify the document to load in the editor use the src attribute. ...
...e to about:blank. To access most of the functionality of the editor, your application must be part of an extension or part of the chrome. XUL applications loaded via a URL from a web server will not be able to access most of the features of the editor. See the Rich text editing and Midas pages for more information about Gecko's built-in rich text editor. ...
...ype 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 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 co...
groupbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] The groupbox is used to group related elements together. If a caption element is placed inside the groupbox, it will be used as a caption which appears along the top of the groupbox. Typically, the groupbox will be drawn with a border around it and the caption either above or over the top border, however the actual appearance will be platform specific. On Linux, for instance, only the caption appears with no border around the group. More information is available in the XUL tutorial. ...
...de the groupbox, it will be used as a caption which appears along the top of the groupbox. Typically, the groupbox will be drawn with a border around it and the caption either above or over the top border, however the actual appearance will be platform specific. On Linux, for instance, only the caption appears with no border around the group. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ord...
iframe - Archive of obsolete content
The src attribute can be used to specify the content of the frame. This content is a separate document. The children of the iframe are ignored. Currently, XUL iframes running in remote processes are not supported. If you want to run content in a remote process, use a XUL browser element. Warning: When used in chrome-privileged documents (either HTML or XUL) such as Firefox addons, the contents of the frame may have the same permissions as Firefox itself. This can be a serious security vulnerability, for example if you use src="http://...". ...
...TML or XUL) such as Firefox addons, the contents of the frame may have the same permissions as Firefox itself. This can be a serious security vulnerability, for example if you use src="http://...". When used in this case, please see Displaying web content in an extension without security issues. More information is available in the XUL tutorial. ...
... 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 object docShell Type: nsIDocShell Th...
key - Archive of obsolete content
Archive › Mozilla › XUL › key
When a key matching the attributes on the key element is pressed, the command will be fired on the key element. The key pressed must match the key attribute (or keycode attribute) as well as the modifiers attribute in order for the key element to be activated. For the shortcut defined using the key element to work, you must specify a command attribute (or an oncommand handler) on the key element. To display the shortcut defined with the key element in the UI, you can use <menuitem key="key element's id" command="command id" .../>. ...
...ler 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. ...
...mand 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. ...
keyset - Archive of obsolete content
The keyset and its descendants are not displayed. More information is available in the XUL tutorial. ...
...te is allowed only for form controls. Using it with an anchor tag (an <a> link) will have no effect. The element will, however, still respond to mouse events. To enable the element, leave this attribute out entirely. Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. ...
...m controls. Using it with an anchor tag (an <a> link) will have no effect. The element will, however, still respond to mouse events. To enable the element, leave this attribute out entirely. Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. ...
listbox - Archive of obsolete content
A listbox may contain multiple columns. There are numerous methods which allow the items in the listbox to be retrieved and modified. You may specify the number of rows to display in the list using the rows attribute. Additional rows can be viewed using a scroll bar. A listbox is expected to contain listitem elements. All the rows in the listbox are the same height, which is the height of the tallest item in the list. ...
...item 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. currentIndex Type: integer Set to the index of the currently focused item in the list. If no item is focused, the value will be -1. (or, on some platforms, typeof(listboxcurrentIndex) will be undefined) In a single selection list, the current index will always be the sa...
listitem - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A single row in a listbox. The text of the 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. ...
...m 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessible Type: nsIAccessible Returns the accessibility object for the element. checked Type: boolean Gets and sets the value of the checked attribute. control Type: element id Gets and sets the value of the control attribute. ...
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
<< XUL Reference home [ Examples | Attributes | Properties | Methods | 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. ...
...elated ] 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: menu element Returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. itemCount Type: integer Read only property holding the number of child items. menupopup Type: menupopup element A reference to t...
menulist - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An element that can be used for drop-down choice lists. The user may select one of the elements displayed in the menulist. The currently selected choice is displayed on the menulist element. 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. ...
...te 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. crop Type: string Gets and sets the value of the crop attribute. description Type: string Set to the description of the currently selected menuitem. disableautoselect Type: boolean Gets and sets the value of the disableautoselect attribute. ...
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. ...
... << 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type: character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu that the item is inside, if an...
notification - Archive of obsolete content
If this attribute is empty or left out, no image appears. The position of the image is determined by the dir and orient attributes. ...
...If this attribute is empty or left out, no image appears. The position of the image is determined by the dir and orient attributes. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. 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. persistence Type: integer Gets and sets the value of the persistence attribute. ...
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
It does not have any window decorations. When open, it floats above the window and may extend outside the border of the main window. Typically, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be displayed. A panel may also be opened via a script using the openPopup method. The panel is closed when the user clicks outside the panel, presses Escape or when the panel's hidePopup method is called. ...
... but only on some platforms. For those versions of Firefox, it is best to avoid child frames in a panel, if possible. This limitation was resolved as of Firefox 4.0. Attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, 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"/> ...
.... drag Specify this for a panel that's being used as a drag image for a drag and drop operation. Otherwise leave this attribute out. Note: The arrow will draw as long as the panel doesn't overlap the anchor. If they overlap, the anchor won't be drawn. The panel may not appear on the side of the anchor that you requested in which case the arrow will automatically adjust. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. label Type: string Gets and sets the value of the label attribute. popupBoxObject Type: nsIPopupBoxObject This read-only property holds the nsIPopupBoxObject that implements the popup. You wouldn't normally need to use this pr...
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. ...
...tement 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. ...
... name Type: string The name of a parameter within the SQL statement. This name should appear within the query preceded by a colon. ...
preference - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Declares a preference that may be adjusted in a prefpane. This element must be placed inside a preferences element. Each preference element 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. ...
.... Each preference element 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 thi...
...ool A boolean set to either true or false. Usually a checkbox would be connected to these preferences. int An integer string A string unichar A Unicode string wstring A localized string. In this situation the preference will save the path to a property file which contains the actual value of the preference. file A file. The file path will be stored in the preferences. Properties defaultValue (readonly) Returns the default value of the preference. The type of the property depends on the value of the type property. If the preference has no default value, this property returns null. disabled Type: boolean Gets and sets the value of the disabled attribute. hasUserValue Type: boolean True if the preference has been changed from its defa...
prefpane - Archive of obsolete content
A prefpane is made up of two parts, the preferences descriptions, which specify the set of preferences that will be modified, and the user interface for adjusting those preferences. The former is specified using a preferences element while the latter may be specified using other XUL elements. Both may be specified directly as children of the prefpane element, or the src attribute may be used to put a pane in a separate file. In this latter case, the separate file should use an overlay tag as its root tag since it will be loaded as an overlay to the main preferences window. ...
... children of the prefpane element, or the src attribute may be used to put a pane in a separate file. In this latter case, the separate file should use an overlay tag as its root tag since it will be loaded as an overlay to the main preferences window. More information is available in the Preferences System article. Attributes helpURI, image, label, onpaneload, selected, src Properties image, label, preferenceElements, preferences, selected, src Examples Methods preferenceForElement <prefpane id="paneGeneral" label="General" src="chrome://path/to/paneOverlay.xul"/> or <prefpane id="paneGeneral" label="General" onpaneload="onGeneralPaneLoad(event);"> <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> ... more...
...oaded, 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, 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 ...
prefwindow - Archive of obsolete content
This element should be used in place of the window tag and should contain one or more prefpane elements. A row of buttons appears across the preference dialog, one for each prefpane. Each pane will usually group together a set of related preferences. If there is only one prefpane, the navigation area will be hidden. On platforms where the convention is to apply changes immediately, the preferences are adjusted as soon as the user interface element is changed. On other platforms, the preferences are not applied until the dialog is closed. ...
... the window and in particular the list of prefpanes. Prefer the classical window.openDialog() with the following window features: "chrome,titlebar,toolbar,centerscreen,dialog=yes". ...
...alls this event handler on the prefwindow element. title Type: string The text to appear in the title bar of the window. type Type: string Set this attribute to child for preference dialogs that are child dialogs of a main preferences window. This ensures that the preferences are only saved when the main dialog is closed, if this is the appropriate behaviour for the platform. Properties buttons Type: comma-separated list of the values below A comma-separated list of buttons to appear on 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...
radio - Archive of obsolete content
Archive › Mozilla › XUL › radio
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An element that can be turned on and off. Radio buttons are almost always listed together in groups. Only one radio button within the same radiogroup may be selected 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. ...
...ime. 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: radiogroup element Returns the enclosing radiogroup that the radio element is contained within, which may or may not be its direct parent. cro...
radiogroup - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A group of radio buttons. 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. ...
... 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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. disabled Type: boolean Gets and sets the value of the disabled attribute. focusedItem Type: radio element Holds the currently focused item in the radiogroup, which may or may not be the same as the selected item. You can change the focused ite...
richlistbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used 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. ...
...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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. currentIndex Type: integer Set to the index of the currently focused item in the list. If no item is focused, the value will be -1. (or, on some platforms, typeof(listboxcurrentIndex) will be undefined) In a single selection list, the current index will always be the ...
rule - Archive of obsolete content
Archive › Mozilla › XUL › rule
The children of the rule are used to declare the conditions in which the rule matches and the content that is generated. A rule may contain where, binding and/or action elements. A condition is defined used a where element. For each result that matches all of the conditions, content within the rule's action body is generated. The bindings element is optional and may specify additional variable bindings to be used. When no query element is used in a template, a default query is used and the simple query syntax may be used for RDF datasources. For more information about this, see the Simple Query Syntax. ...
...alse: The rule will only match nodes that contain one or more child elements. parent Type: element tag name If set, the rule will only match the corresponding tag. This may be used to have separate rules for leaf and container nodes with different tags. parsetype Type: string If this attribute is set to Integer, the rule will only match RDF nodes with a parse type of Integer. ...
...atch nodes that contain one or more child elements. parent Type: element tag name If set, the rule will only match the corresponding tag. This may be used to have separate rules for leaf and container nodes with different tags. parsetype Type: string If this attribute is set to Integer, the rule will only match RDF nodes with a parse type of Integer. ...
scale - Archive of obsolete content
Archive › Mozilla › XUL › scale
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. ...
...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 For scales, th...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties disabled Type: boolean Gets and sets the value of the disabled attribute. increment Type: integer Gets and sets the value of the increment attribute. min Type: integer Gets and sets the value of the min attribute. max Type: integer Gets and sets the value of the max attribute. pageIncrement...
scrollbar - Archive of obsolete content
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. ...
...). 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. ...
... 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. ...
splitter - Archive of obsolete content
When the splitter is dragged, the sibling elements of the splitter are resized. If a grippy is placed inside the splitter, one sibling element of the splitter is collapsed when the grippy is clicked. More information is available in the XUL tutorial. Attributes collapse, resizeafter, resizebefore, state, substate Style classes tree-splitter Examples <!-- This bar has some styling associated with it. ...
...Type: one of the values below On splitters which have state="collapsed" and collapse="both", determines which direction the splitter is actually collapsed in. 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. after The element immediately after the splitter is collapsed. ...
...low On splitters which have state="collapsed" and collapse="both", determines which direction the splitter is actually collapsed in. 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. after The element immediately after the splitter is collapsed. ...
statusbar - Archive of obsolete content
I suggest using The add-on bar instead. << XUL Reference home [ 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. ...
... I suggest using The add-on bar instead. << XUL Reference home [ 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. ...
...sources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordi...
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. ...
...d 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 getFormattedString, getString Examples (example needed) Attributes src Type: URI The URI of the property file that contains the localized strings. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, e...
...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...
tabbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A container used to display a set of tabbed pages of elements. A row of tabs is displayed at the top of tabbox which may be used to switch between each page. The tabbox should contain two children, the first a tabs element which contains the tabs and the second a tabpanels element which contains the contents of the pages. More information is available in the XUL tutorial. ...
...d pages of elements. A row of tabs is displayed at the top of tabbox which may be used to switch between each page. The tabbox should contain two children, the first a tabs element which contains the tabs and the second a tabpanels element which contains the contents of the pages. More information is available in the XUL tutorial. ...
...he document level. Tab navigation will occur as long as any element 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 hand...
tabpanels - Archive of obsolete content
The tabpanels element should be placed in a tabbox although it does not have to be a direct child. The children of the tabpanels element become the panels of the tabbox. In most cases you would use a vbox, but they can be any element, although some people like to use tabpanel elements. By clicking the first tab, the first panel will be displayed. By clicking the second tab, the second panel will be displayed and so on. There should be the same number of panels as there are tabs. Panels should never be hidden; hiding the tab suffices to make the panel inaccessible. ...
...like to use tabpanel elements. By clicking the first tab, the first panel will be displayed. By clicking the second tab, the second panel will be displayed and so on. There should be the same number of panels as there are tabs. Panels should never be hidden; hiding the tab suffices to make the panel inaccessible. More information is available in the XUL tutorial. Attributes selectedIndex Properties selectedIndex, selectedPanel Examples (example needed) Attributes selectedIndex Type: integer Gets and sets the index of the currently selected panel. The first item is at index 0. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flag...
... 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: e...
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A row of tabs. A tabs element should 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. ...
... 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. ...
...igation. 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. 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 ...
textbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An input field where the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
...be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
...e min property, whichever is higher. 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 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. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. clickSelectsAll Type: boolean If set to true, the contents of the textbox are selected when focused; otherwise, the cursor is left unchanged. decimalPlaces Type: integer Gets and sets the value of the decimalplaces attribute. ...
titlebar - Archive of obsolete content
This element can't be used to change the platform-native titlebar of normal windows; instead, it's used to create custom titlebars for chromeless windows. If the titlebar is in a panel element, dragging it will move the panel. Elements inside the titlebar usually don't receive any mouse events, so e.g. buttons inside it can't be clicked and textboxes can't be focused with the mouse. If you don't want this behavior, you can override it by setting allowevents="true" on the titlebar element. ...
...rtbefore, left, maxheight, maxwidth, menu, 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 Note: The allowevents attribute did not work for title bars prior to Firefox 3. ...
... maxwidth, menu, 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 Note: The allowevents attribute did not work for title bars prior to Firefox 3. ...
toolbar - Archive of obsolete content
It is a type of box that defaults to horizontal orientation. It can be collapsed with a grippy when the toolbar is placed inside a toolbox. The toolbar should always have an id attribute. Note: Gecko 2.0 adds support for external toolbars. These are toolbars that are not children of a toolbox element. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. ...
...lbar. This means that the palette now only contains items not already in the toolbar. This introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...efines 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. 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 ...
toolbarbutton - Archive of obsolete content
It is equivalent to a regular button except that it may be rendered differently. Typically, it is expected to have an image. More information is available in the XUL tutorial. Relevant accessbility guidelines All toolbar functionality should be duplicated elsewhere in the application Where possible, provide keyboard alternatives. Where possible, duplicate functionality in a menu item or context menu. Where not possible, make all toolbarbuttons focusable by -moz-user-focus: normal. ...
...ard alternatives. Where possible, duplicate functionality in a menu item or context menu. Where not possible, make all toolbarbuttons focusable by -moz-user-focus: normal. ...
...icates 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. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. autoCheck Type: boolean Gets and sets the value of the autoCheck attribute. checkState Type: integer, values 0, 1, or 2 Gets and sets the value of ...
toolbargrippy - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Not in Firefox The notch on the side of a toolbar which can be used to collapse and expand it. This element is used internally by the toolbar and should only be used directly when modifying its theme. More information is available in the XUL tutorial. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Not in Firefox The notch on the side of a toolbar which can be used to collapse and expand it. This element is used internally by the toolbar and should only be used directly when modifying its theme. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties accessible Type: nsIAccessible Returns the accessibility object for the element. 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, , pa...
toolbarseparator - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Creates a separator between groups of toolbar items. It is functionally equivalent to a normal separator but some themes may apply a different appearance. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Creates a separator between groups of toolbar items. It is functionally equivalent to a normal separator but some themes may apply a different appearance. ...
...sources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordin...
toolbarspacer - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox only A space between toolbar items. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox only A space between toolbar items. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ord...
toolbarspring - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox only A flexible space between toolbar items. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox only A flexible space between toolbar items. ...
...sources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordi...
toolbox - Archive of obsolete content
It is a type of box but defaults to vertical orientation. If a toolbar is placed inside a toolbox, a grippy is displayed on its left or upper edge. The user may click the grippy to collapse the toolbar. If multiple toolbars are placed in the same toolbox, they will all collapse into the same row. The Firefox browser does not have grippies so toolbars cannot be collapsed and expanded. Note: Gecko 2.0 adds support for external toolbars. These are toolbars that are not children of a toolbox. ...
... with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's externalToolbars property. More information is available in the XUL tutorial. If you'd like to detect when toolbars in a toolbox are changed, see Toolbar customization events. ...
... customToolbarCount Firefox only Type: integer The number of custom toolbars currently within the toolbox. externalToolbars Type: array of elements An array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbo...
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
The tree may contain any number of rows and any number of columns. Each row of the tree may contain child rows which are displayed indented from the parent. Unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. The view object implements the nsITreeView interface. The view is queried for the data to appear in the tree. There are several ways in which trees are used, as listed below. The second column lists the interfaces available via the tree's view property. ...
...dget Changes. Relevant accessbility guidelines Provide alternative access (for example, via menus) to column picker and for header behaviors like sorting (these have no default keyboard access). ...
...(rdf:local-store). 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. treelines Type: boolean When set to true, lines are drawn connecting the lines in the tree; when false, the lines are not drawn. This is false by default. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. builderView Type: nsIXULTreeBuilder A reference to the tree builder which constructed the tree data. The builder provides access to the RDF resources for each row in the tree, and allows sorting the data by column. In newer versions of Mozilla, the builderView property ...
treecol - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A column of a tree. It displays the column header and holds the size and other information about the column. You can also place splitter elements between the columns to allow column resizing. You should always place an id attribute on a treecol element to ensure that the column positioning is handled properly. More information is available in the XUL tutorial. Attributes crop, cycler, dragging, editable, fixed, hidden, hideheader, ignoreincolumnpicker, label, primary, sort, sortActive, sortDirection, 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="...
.... This is used in Mozilla's download manager window. text The content of the columns is text. 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. ...
...nteger) 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. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. ...
treeitem - Archive of obsolete content
The treeitem can be clicked by the user to select the row of the tree. The treeitem contains a single row and all of what appear to the user as that row's descendants. In a template condition, you should use a treeitem instead of a content element when the dont-build-content flag is specified. Set the uri attribute to the variable name to bind to a content node during matching. More information is available in the XUL tutorial. ...
...ype: 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. ...
...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. ...
treerow - Archive of obsolete content
It should be placed inside a treeitem element. Children of the treerow should be treecell elements. If child rows are necessary, they should be placed in a treechildren element inside the parent treeitem. More information is available in the XUL tutorial. Attributes properties Examples (example needed) Attributes properties Type: space-separated list of property names Sets the properties of the element, which can be used to style the element. For more information, see Styling a Tree. ...
...For more information, see Styling a Tree. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
treeseparator - Archive of obsolete content
Attributes properties Examples (example needed) Attributes properties Type: space-separated list of property names Sets the properties of the element, which can be used to style the element. For more information, see Styling a Tree. ...
...For more information, see Styling a Tree. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
window - Archive of obsolete content
It is the root node of a XUL 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. ...
...or window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together. ...
...'s window handling functions use this attribute to group windows of the same type together. ...
wizard - Archive of obsolete content
It is used for a window with several steps contained on several pages. This element provides the header and buttons along the bottom, and also handles navigation between the pages. Each page should be constructed using a wizardpage. The pages are displayed in the order that they are placed in the wizard, unless you use the next and pageid attributes on the pages to change the sequence. The wizard will rendered in a manner suitable for the user's selected theme and platform. ...
...t and pageid attributes on the pages to change the sequence. The wizard will rendered in a manner suitable for the user's selected theme and platform. In newer versions of Mozilla, a statusbar may be placed directly inside the wizard element which will be shared among all pages. More information is available in the XUL tutorial. ...
... window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together. Values for window type as found on MXR: http://mxr.mozilla.org/mozilla-release/search?string=windowtype navigator:browser - Looks like if window has gBrowser it has this window type devtools:scratchpad - Scratchpad windows navigator:view-source - The view source windows Properties canAdvance Type: boolean This property is set to true if the user can press the Next button to go to the next page. If this property is false, the user cannot navigate to the next page. Set this property to true to indicate that the user can go to the next page. Set to false to disallow moving to the next page. This has the effect of enabling or disabling the Next button, or, on the last ...
Building a Theme - Archive of obsolete content
extension works with Firefox 39 and any subsequent 39.x release. Themes are compatible by default, unless you set strict compatibility mode for your theme. If you get a message that the install.rdf is malformed, it is helpful to load it into firefox using the File->Open File command and it will report XML errors to you. See Install Manifests for a complete listing of the required and optional properties. Save the file. Styling the Browser's UI with CSS Firefox's user interface is written in XUL and JavaScript. XUL is an XML grammar that provides user interface widgets like buttons, menus, toolbars, trees, etc. User actions are bound to functionality using JavaScript. These XUL elements are styled using CSS. If you don't know CSS, it's going to be a steep learning curve, and you may want to ...
...led as a (chrome). Compare (chrome) to (http) which tells Firefox to treat the URI as a web page. Secondly, a package name (in the example above, browser) which identifies the bundle of user interface components. Thirdly, the type of data being requested. There are three types: content (XUL, JavaScript, XBL bindings, etc. that form the structure and behavior of an application UI), locale (DTD, .properties files etc that contain strings for the UI's localization), and skin (CSS and images that form the theme of the UI) Finally, the path of a file to load. So, chrome://foo/skin/bar.png loads the file bar.png from the foo theme's skin section. When you load content using a Chrome URI, Firefox uses the Chrome Registry to translate these URIs into the actual source files on disk (or in JAR packages...
...me://foo/skin/bar.png loads the file bar.png from the foo theme's skin section. When you load content using a Chrome URI, Firefox uses the Chrome Registry to translate these URIs into the actual source files on disk (or in JAR packages). Create a Chrome Manifest The Chrome Manifest is the file that maps these Chrome URIs to your theme's files. For more information on Chrome Manifests and the properties they support, see the Chrome Manifest Reference. Open the file called chrome.manifest that you created alongside the chrome directory at the root of your 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 chr...
-ms-filter - Archive of obsolete content
From'); filterImg.addEventListener('click', doFilter); function doFilter () { filterFrom.filters.item(0).Apply(); // 12 is the dissolve filter. ...
...ddEventListener('click', doFilter); function doFilter () { filterFrom.filters.item(0).Apply(); // 12 is the dissolve filter. filterFrom.filters.item(0).Transition=12; imageFrom.style.visibility = "hidden"; filterTo.style.visibility = ""; filterFrom.filters.item(0).play(14); } </script> </body> Gradient progid:DXImageTransform.Microsoft.Gradient( <properties> ) where <properties> = [ <Enabled> | <EndColor> | <EndColorStr> | <GradientType> | <StartColor> | <StartColorStr> ]# where <Enabled> = 'Enabled=' [ true | false ] <EndColor> = 'StartColor=' <color> <EndColorStr> = 'StartColorStr=' <color> <GradientType> = 'GradientType=' <integer> <StartColor> = 'StartColor=' <color> <StartColorStr> = 'StartColorStr=' <color> Enabled Default: true Set to false to disable. End...
...Not part of any specification. Initial value"" (the empty string)Applies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Remarks The following table lists the most popular DX Filters and their standards-based alternatives: DX Filter Standards-based Alternative Alpha opacity AlphaImageLoader <img> or background-image and related properties Gradient background-image: linear-gradient() DropShadow text-shadow or box-shadow Matrix transform, transform-origin In Windows Internet Explorer 8, the -ms-filter attribute is an extension to CSS, and can be used as a synonym for filter in IE8 Standards mode. When you use -ms-filter, enclose the progid in single quotes (') or double quotes ("). Use comm...
-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. ...
...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. Values -ms-scroll-limit-x-min The value of the -ms-scroll-lim...
Iterator - Archive of obsolete content
Non-standard. The Iterator function is a SpiderMonkey-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 G...
...thy 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. 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()); // ["...
...pe.next Returns next item in the [property_name, property_value] format or property_name only. It throws StopIteration if there are no more items. ...
Debug - Archive of obsolete content
Non-standard. Do not use! ...
... apps. In Windows 8.x Store apps, the write and writeln functions of the Debug object display strings in 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 ...
... 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 may be enabled or disabled whether or not a debugger is attached. Debug.setNonUserCodeExceptions Determines whether any try-catch blocks in this scope are to be treated by the debugger as user-unhandled. Functions Debug.msTraceAsyncCallbackCompleted Indicates that the callback stack associa...
for each...in - Archive of obsolete content
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 each property. To execute ...
...riable 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 each property. To execute multiple statements within the loop, use a block statement ({ ... }) to group those statements. Description Some built-in properties are not iterated over. These include all built-in methods of objects, e.g. String's indexOf method. However, all user-defined properties are iterated over. ...
...up those statements. Description Some built-in properties are not iterated over. These include all built-in methods of objects, e.g. String's indexOf method. However, all user-defined properties are iterated over. Examples Using for each...in Warning: Never use a loop like this on arrays. Only use it on objects. See for...in for more details. The following snippet iterates over an object's properties, calculating their sum: var sum = 0; var obj = {prop1: 5, prop2: 13, prop3: 8}; for each (var item in obj) { sum += item; } console.log(sum); // logs "26", which is 5+13+8 Specifications Not part of any standard. ...
Archived JavaScript Reference - Archive of obsolete content
ting. 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 expression which allowed you to q...
...and removed in browsers.Object.observe()The Object.observe() method was used for asynchronously observing the changes to an object. It provided a stream of changes in the order in which they occur. However, this API has been deprecated and removed from browsers. ...
...for a property to be assigned a value and runs a function when that occurs.Object.unobserve()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.Reflect.enumerate()The static Reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ECMAScript 2016 and is deprecated in browsers.String.prototype.quote()The non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes ("). ...
LiveConnect Overview - Archive of obsolete content
ped in an instance of the class netscape.javascript.JSObject and passed to Java. When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type JSObject; when a JSObject is sent from Java to JavaScript, the runtime engine unwraps it to its original JavaScript object type. The JSObject class provides an interface for invoking JavaScript methods and examining JavaScript properties. JavaScript to Java Communication When you refer to a Java package or class, or work with a Java object or array, you use one of the special LiveConnect objects. All JavaScript access to Java takes place with these objects, which are summarized in the following table. Table 9.1 The LiveConnect Objects Object Description JavaArray A wrapped Java array, accessed from...
...leNotFound } else { throw e; } } See Exception Handling Statements for more information about JavaScript exceptions. Java to JavaScript Communication If you want to use JavaScript objects in Java, you must import the netscape.javascript package into your Java file. This package defines the following classes: netscape.javascript.JSObject allows Java code to access JavaScript methods and properties. netscape.javascript.JSException allows Java code to handle JavaScript errors. See the JavaScript Reference for more information about these classes. Locating the LiveConnect classes In older versions of the Netscape browser, these classes were distributed along with the browser. Starting with JavaScript 1.2, these classes are delivered in a .jar file; in previous versions of JavaScript, these ...
...The previous example uses getMember to assign the value of the JavaScript property jsDog.breed to the Java data member JavaDog.dogBreed. Note: A more realistic example would place the call to getMember inside a try...catch statement to handle errors of type JSException. See Handling JavaScript Exceptions in Java for more information. To get a better sense of how getMembe...
Describing microformats in JavaScript - Archive of obsolete content
ontain the following entries: mfVersion Specifies the version number of the microformat API to which the definition was written. For Firefox 3, this should be set to 0.8. mfObject The JavaScript object that implements the microformat. className A string specifying the name of the microformat's class as referenced in HTML (class="className"). required An array 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. Standard attributes are: plural A boolean value indicating that, if true indicates th...
...f 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. 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 micr...
...mber microformat A microformat microformat_property A specific property within the microformat specified by microformat. custom Custom data A simple example The hCard microformat for defining contact information makes use of the adr microformat to define an address. The adr microformat is defined as follows: var adr_definition = { mfVersion: 0.8, mfObject: adr, className: "adr", properties: { "type" : { plural: true, types: ["work", "home", "pref", "postal", "dom", "intl", "parcel"] }, "post-office-box" : { }, "street-address" : { plural: true }, "extended-address" : { }, "locality" : { }, "region" : { }, "postal-code" : { }, "country-name" : { } } }; The properties are quite simple here. The type...
Efficient animation for web games - Game development
and end of animations that allow you to attach JavaScript callbacks and form a rudimentary form of synchronisation (though there are no guarantees on how promptly these callbacks will happen). Speaking of the assumptions that the browser can make, you should avoid causing it to have to re-layout during animations. In this vein, it is worth trying to stick to animating only transform and opacity properties. Though some browsers make some effort for other properties to be animated quickly, these are pretty much the only ones semi-guaranteed to be fast across all browsers. Something to be careful of is that overflow may end up causing re-layout, or other expensive calculations. If you are setting a transform on something that would overlap its container's bounds, you may want to set overflow: hidden ...
...ing in an arbitrary browsing session, you can never really know how long the browser will take to draw a particular frame. requestAnimationFrame causes the browser to redraw and call your function before that frame gets to the screen. The downside of using this vs. setTimeout is that your animations must be time-based instead of frame-based, i.e. you must keep track of time and set your animation properties based on elapsed time. requestAnimationFrame includes a DOMHighResTimeStamp in its callback function prototype, which you definitely should use (as opposed to using the Date object), as this will be the time the frame began rendering, and ought to make your animations look more fluid. You may have a callback that ends up looking something like this: var startTime = -1; var animationLength = 2000...
...y various parts of Clutter, but with a focus on avoiding scope-creep. It does one thing, and it does it well. Animator.js is a fire-and-forget style animation library, designed to be used with games, or other situations where you need many, synchronised, custom animations. It includes a handful of built-in tweening functions, the facility to add your own, and helper functions for animating object properties. Puzzowl uses it to drive all the drawing updates and transitions, by overriding its requestAnimationFrame function with a custom version that makes the request, and appending the game's drawing function onto the end of the callback like so: animator.requestAnimationFrame = function(callback) { requestAnimationFrame(function(t) { callback(t); redraw(); }); }; The game's re...
Vendor Prefix - MDN Web Docs Glossary: Definitions of Web-related terms
Developers should wait to include the unprefixed property until browser behavior is standardized. Browser vendors are working to stop using vendor prefixes for experimental features. Web developers have been using them on production Web sites, despite their experimental nature. ...
...rsions of Opera) -ms- (Internet Explorer and Microsoft Edge) Sample usage: -webkit-transition: all 4s ease; -moz-transition: all 4s ease; -ms-transition: all 4s ease; -o-transition: all 4s ease; transition: all 4s ease; API prefixes Historically, vendors have also used prefixes for experimental APIs. If an entire interface is experimental, then the interface's name is prefixed (but not the properties or methods within). If an experimental property or method is added to a standardized interface, then the individual method or property is prefixed. Interface prefixes Prefixes for interface names are upper-cased: WebKit (Chrome, Safari, newer versions of Opera, almost all iOS browsers (including Firefox for iOS); basically, any WebKit based browser) Moz (Firefox) O (Older, pre-WebKit, vers...
...ndividual method or property is prefixed. ...
Advanced styling effects - Learn web development
re of the box. Blend modes CSS blend modes allow us to add blend modes to elements that specify a blending effect when two elements overlap -- the final color shown for each pixel will be the result of a combination of the original pixel color, and that of the pixel in the layer underneath it. Blend modes are again very familiar to users of graphics applications like Photoshop. There are two properties that use blend modes in CSS: background-blend-mode, which blends together multiple background images and colors set on a single element. mix-blend-mode, which blends together the element it is set on with elements it is overlapping -- both background and content. You can find a lot more examples than are available here in our blend-modes.html example page (see source code), and on the <blen...
... { background-color: purple; position: absolute; bottom: -10px; right: 0; z-index: -1; } .multiply-mix { mix-blend-mode: multiply; } This gives us the following results: You can see here that the multiply mix blend has blended together not only the two background images, but also the color from the <div> below it too. Note: Don't worry if you don't understand some of the layout properties above, like position, top, bottom, z-index, etc. We will cover these in detail in our CSS Layout module. CSS shapes While it is true that everything in CSS is a rectangular box, and images are a physical rectangular box, we can make it look as if our content flows around non-rectangular things by using CSS Shapes. The CSS Shapes specification enables the wrapping of text around a non-rectangu...
... value for background-clip. When used along with the proprietary -webkit-text-fill-color: transparent; feature, this allows you to clip background images to the shape of the element's text, making for some nice effects. This is not an official standard, but has been implemented across multiple browsers, as it is popular, and used fairly widely by developers. ...
Organizing your CSS - Learn web development
uely remember there was a great tutorial about that thing, but where is it? Create logical sections in your stylesheet It is a good idea to have all of the common styling first in the stylesheet. This means all of the styles which will generally apply unless you do something special with that element. You will typically have rules set up for: body p h1, h2, h3, h4, h5 ul and ol The table properties Links In this section of the stylesheet we are providing default styling for the type on the site, setting up a default style for data tables and lists and so on. /* || GENERAL STYLES */ body { ... } h1, h2, h3, h4 { ... } ul { ... } blockquote { ... } After this section we could define a few utility classes, for example a class that removes the default list style for lists we're going ...
...pular pre-processor is Sass. This is not a Sass tutorial, so I will briefly explain a couple of the things that Sass can do, which are really helpful in terms of organisation, even if you don't use any of the other Sass features. If you want to learn a lot more about Sass, start with the Sass basics article, then move on to their other documentation. Defining variables CSS now has native custom properties, making this feature increasingly less important, however one of the reasons you might use Sass is to be able to define all of the colors and fonts used in a project as settings, then use that variable around the project. This means that if you realise you have used the wrong shade of blue, you only need change it in one place. If we created a variable called $base-color as in the first line bel...
...ple of a post-processor 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 ...
CSS values and units - Learn web development
roperty. 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. 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 C...
...n use any valid color as a value for that property, as listed on the <color> reference page. Note: You'll also see CSS values referred to as data types. The terms are basically interchangeable -- when you see something in CSS referred to as a data type, it is really just a fancy way of saying value. Note: Yes, CSS values tend to be denoted using angle brackets, to differentiate them from CSS properties (e.g. the color property, versus the <color> data type). You might get confused between CSS data types and HTML elements too, as they both use angle brackets, but this is unlikely -- they are used in very different contexts. In the following example we have set the color of our heading using a keyword, and the background using the rgb() function: h1 { color: black; background-color: rgb(19...
...lement's font, or the size of the viewport. The benefit of using relative units is that with some careful planning you can make it so the size of text or other elements scale relative to everything else on the page. Some of the most useful units for web development are listed in the table below. Unit Relative to em Font size of the parent, in the case of typographical properties like font-size, and font size of the element itself, in the case of other properties like width. ex x-height of the element's font. ch The advance measure (width) of the glyph "0" of the element's font. rem Font size of the root element. lh Line height of the element. vw 1% of the viewport's width. vh 1% of the viewport's hei...
Supporting older browsers - Learn web development
ey display in a row. Any browser that does not support CSS Grid Layout will see the row of boxes as a floated layout. A floated item that becomes a grid item loses the float behaviour, which means that by turning the wrapper into a Grid Container, the floated items become Grid Items. If the browser supports Grid Layout it will display the grid view, if not it ignores the display: grid and related properties and the floated layout is used. * {box-sizing: border-box;} .wrapper { background-color: rgb(79,185,227); padding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } <div class="wrapper"> <div class="item">Item One</div> <div class="item">Item Two</div...
...ct once the cleared item becomes a grid item, so you could have a layout with a cleared footer, which is then turned into a Grid Layout. Fallback Methods There are a number of layout methods which can be used in a similar way to this float example. You can choose the one that makes the most sense for the layout pattern you need to create. Float and clear As shown above, the float and clear properties cease to affect the layout if floated or cleared items become flex or grid items. display: inline-block This method can be used to create column layouts, if an item has display: inline-block set but then becomes a flex or grid item, the inline-block behaviour is ignored. display: table The method of creating CSS Tables described in the introduction to these lessons can be used as a fallback. ...
...ables described in the introduction to these lessons can be used as a fallback. Items that have CSS table layouts set on them will lose this behaviour if they become flex or grid items. Importantly, the anonymous boxes created to fix up the table structure are not created. Multiple-column Layout For certain layouts you could use multi-col as a fallback, if your container has any of the column-* properties defined on it and then becomes a grid container, the multicol behaviour will not happen. Flexbox as a Fallback for Grid Flexbox has greater browser support than Grid due to being supported by IE10 and 11, although do check out the information later in this lesson explaining the rather patchy and confusing support for Flexbox in older browsers. If you make a flex container into a grid container,...
Using your new knowledge - Learn web development
this CSS to a separate file when you create the example on your local computer. Alternatively use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Working with CSS The following live example shows a biography, which has been styled using CSS. The CSS properties 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 ...
...sed 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 links green on hove...
...ive 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 links green on hover. You should end up with something like this image. Afterwards try looking up some properties not mentioned on this page in the MDN CSS reference and get adventurous! Remember that there is no wrong answer here -- at this stage in your learning you can afford to have a bit of fun. Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post ...
Styling links - Learn web development
ll, just that you should not stray too far from the expected behaviour. You should at least: Use underlining for links, but not for other things. If you don't want to underline links, at least highlight them in some other way. Make them react in some way when hovered/focused, and in a slightly different way when activated. The default styles can be turned off/changed using the following CSS properties: color for the text color. cursor for the mouse pointer style -- you shouldn't turn this off unless you've got a very good reason. outline for the text outline (an outline is similar to a border, the only difference being that border takes up space in the box and an outline doesn't; it just sits over the top of the background). The outline is a useful accessibility aid, so think carefully be...
...ne (an outline is similar to a border, the only difference being that border takes up space in the box and an outline doesn't; it just sits over the top of the background). The outline is a useful accessibility aid, so think carefully before turning it off; you should at least double up the styles given to the link hover state on the focus state too. Note: You are not just limited to the above properties to style your links -- you are free to use any properties you like. Just try not to go too crazy! Styling some links Now we've looked at the default states in some detail, let's look at a typical set of link styles. To start off with, we'll write out our empty rulesets: a { } a:link { } a:visited { } a:focus { } a:hover { } a:active { } This order is important because the link s...
...px; } So what's going on here? We'll skip over most of the CSS, as it's just the same information you've looked at before. The last rule however is interesting -- here we are inserting a custom background image on external links in a similar manner to how we handled custom bullets on list items in the last article -- this time however we are using background shorthand instead of the individual properties. We set the path to the image we want to insert, specify no-repeat so we only get one copy inserted, and then specify the position as 100% of the way over to the right of the text content, and 0 pixels from the top. We also use background-size to specify the size we want the background image to be shown at -- it is useful to have a larger icon and then resize it like this as needed for responsiv...
CSS property compatibility table for form controls - Learn web development
h 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 reliable. n.a. The property has no meaning for this type of widget. Rendering For each property there are two possible renderings: N (Normal) Indicates that the property is applied as it is T (Tweaked) Indicates that the property is applied with the extra rule below: ...
...Be careful when you use them. line-height This property is supported inconsistently across browsers and you should avoid it. text-decoration This property is not supported by Opera on form widgets. text-overflow Opera, Safari, and IE9 do not support this property on form widgets. text-shadow Opera does not...
...ransform No No Border and background background No[1] No[1] Supported, but there is too much inconsistency between browsers to be reliable. border-radius No No box-shadow No Partial[1] IE9 does not support this property. Date pickers See the date and time input types. Many properties are supported, but there is too much inconstency between browsers to be reliable. Property N T Note CSS box model width No No height No No border No No margin Yes Yes padding No No Text and font color No No font No No ...
Manipulating documents - Learn web development
at goes along with it. Add a <script></script> element just above the closing </body> tag. To manipulate an element inside the DOM, you first need to select it and store a reference to it inside a variable. Inside your script element, add the following line: const link = document.querySelector('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 Devel...
...s as wished. However, we're not going to expand on those features because they are a somewhat archaic and difficult way to manipulate style. There are much easier ways. The first way is to add inline styles directly onto elements you want to dynamically style. This is done with the HTMLElement.style property, which contains inline styling information for each element in the document. You can set properties of this object to directly update element styles. As an example, try adding these lines to our ongoing example: para.style.color = 'white'; para.style.backgroundColor = 'black'; para.style.padding = '10px'; para.style.width = '250px'; para.style.textAlign = 'center'; Reload the page and you'll see that the styles have been applied to the paragraph. If you look at that paragraph in your br...
...ering a small part of the screen, which has got a background tile applied to it. We'll use that to represent our app UI area. First of all, let's grab a reference to the div, and then grab the width and height of the viewport (the inner window, where your document is displayed) and store them in variables -- these two values are handily contained in the Window.innerWidth and Window.innerHeight properties. Add the following lines inside the existing <script> element: const div = document.querySelector('div'); let winWidth = window.innerWidth; let winHeight = window.innerHeight; Next, we'll dynamically alter the width and height of the div to equal that of the viewport. Add the following two lines below your first ones: div.style.width = winWidth + 'px'; div.style.height = winHeight + 'px'; ...
A first splash into JavaScript - Learn web development
This is necessary, because if we didn't, the user could submit more guesses after the game is over, which would mess things up. The next three lines generate a new <button> element, set its text label to "Start new game", and add it to the bottom of our existing HTML. The final line sets an event listener on our new button so that when it is clicked, a function called resetGame() is ru...
...ur declarations near the top of the code: const guessField = document.querySelector('.guessField'); To get this reference, we used the querySelector() method of the document object. querySelector() takes one piece of information -- a CSS selector that selects the element you want a reference to. Because guessField now contains a reference to an <input> element, it now has access to a number of properties (basically variables stored inside objects, some of which can't have their values changed) and methods (basically functions stored inside objects). One method available to input elements is focus(), so we can now use this line to focus the text input: guessField.focus(); Variables that don't contain references to form elements won't have focus() available to them. For example, the guesses const...
...extContent property instead. Try this: guesses.textContent = 'Where is my paragraph?'; Now for some fun stuff. Try entering the below lines, one by one: guesses.style.backgroundColor = 'yellow'; guesses.style.fontSize = '200%'; guesses.style.padding = '10px'; guesses.style.boxShadow = '3px 3px 6px black'; Every element on a page has a style property, which itself contains an object whose properties contain all the inline CSS styles applied to that element. This allows us to dynamically set new CSS styles on elements using JavaScript. Finished for now... So that's it for building the example. You got to the end -- well done! Try your final code out, or play with our finished version here. If you can't get the example to work, check it against the source code. Previous Overview: Firs...
Adding features to our bouncing balls demo - Learn web development
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. ...
...e code!) Steps to complete The following sections describe what you need to do. Creating our new objects First of all, change your existing Ball() constructor so that it becomes a Shape() constructor and add a new Ball() constructor: The Shape() constructor should define the x, y, velX, and velY properties in the same way as the Ball() constructor did originally, but not the color and size properties. It should also define a new property called exists, which is used to track whether the balls exist in the program (have not been eaten by the evil circle). This should be a boolean (true/false). The Ball() constructor should inherit the x, y, velX, velY, and exists properties from the Shape() constructor. It should also define a color and a size property, like the original Ball() constructor ...
..., or have several computer-controlled evil circles. You're probably not going to take over the world with a single evil circle, but it will do for this assessment. The EvilCircle() constructor should inherit x, y, velX, velY, and exists from Shape(), but velX and velY should always equal 20. You should do this something like Shape.call(this, x, y, 20, 20, exists); It should also define its own properties, as follows: color -- 'white' size -- 10 Again, remember to define your inherited properties as parameters in the constructor, and set the prototype and constructor properties correctly. Defining EvilCircle()'s methods EvilCircle() should have four methods, as described below. draw() This method has the same purpose as Ball()'s draw() method: It draws the object instance on the canvas. ...
Working with JSON - Learn web development
ppercut", "age": 39, "secretIdentity": "Jane Wilson", "powers": [ "Million tonne punch", "Damage resistance", "Superhuman reflexes" ] } ] The above is perfectly valid JSON. You'd just have to access array items (in its parsed version) by starting with an array index, for example [0]["powers"][0]. Other notes JSON is purely a data format -- it contains only properties, no methods. JSON requires double quotes to be used around strings and property names. Single quotes are not valid. Even a single misplaced comma or colon can cause a JSON file to go wrong, and not work. You should be careful to validate any data you are attempting to use (although computer-generated JSON is less likely to include errors, as long as the generator program is working correctly). ...
...er-generated JSON is less likely to include errors, as long as the generator program is working correctly). You can validate JSON using an application like JSONLint. JSON can actually take the form of any data type that is valid for inclusion inside JSON, not just arrays or objects. So for example, a single string or number would be a valid JSON object. Unlike in JavaScript code in which object properties may be unquoted, in JSON only quoted strings may be used as properties. Active learning: Working through a JSON example So, let's work through an example to show how we could make use of some JSON data on a website. Getting started To begin with, make local copies of our heroes.html and style.css files. The latter contains some simple CSS to style our page, while the former contains some ver...
...Here we first create an <h1> element with createElement(), set its textContent to equal the squadName property of the object, then append it to the header using appendChild(). We then do a very similar operation with a paragraph: create it, set its text content and append it to the header. The only difference is that its text is set to a concatenated string containing both the homeTown and formed properties of the object. Creating the hero information cards Next, add the following function at the bottom of the code, which creates and displays the superhero cards: function showHeroes(jsonObj) { const heroes = jsonObj['members']; for (let i = 0; i < heroes.length; i++) { const myArticle = document.createElement('article'); const myH2 = document.createElement('h2'); const myPara1 = ...
Ember interactivity: Events, classes and state - Learn web development
rest of the file is vanilla JavaScript, and would work in any application. The @action decorator declares that the function is an "action", meaning it's a type of function that will be invoked from an event that occurred 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 whate...
...s whether the todo has been completed or not. When instantiated, a Todo object will have an initial text value equal to the text given to it when created (see below), and an isCompleted value of false. The only Ember-specific part of this class is the @tracked decorator -- this hooks in to the reactivity system and allows Ember to update what you're seeing in your app automatically if the tracked properties change. More information on tracked can be found here. Now it's time to add to the body of the service. First add another import statement below the previous one, to make actions available inside the service: import { action } from '@ember/object'; Update the existing export default class TodoDataService extends Service { ... } block as follows: export default class TodoDataService extends S...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Introduction to client-side frameworks - Learn web development
The tenth line of this snippet references another build function: buildDeleteButtonEl(). It follows a similar pattern to the one we used to build a list item element: function buildDeleteButtonEl(id) { const button = document.createElement('button'); const textContent = document.createTextNode('Delete'); button.setAttribute('type', 'button'); button.appendChild(t...
...None of this code actually handles user interactions, or addresses adding or deleting a task. If we add those features, we have to remember to update our UI in the right time and in the right way. JavaScript frameworks were created to make this kind of work a little easier -- they exist to provide a better developer experien...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
your existing checkAllTodos() function to the following: const checkAllTodos = (completed) => { todos.forEach(t => t.completed = completed) console.log('todos', todos) } Go back to your browser, open your DevTools console, and click Check All/Uncheck All a few times. You'll notice that the array is successfully updated every time you press the button (the todo objects' completed properties are toggled between true and false), but Svelte is not aware of that. This also means that in this case, a reactive statement like $: console.log('todos', todos) won't be very useful. To find out why this is happening, we need to understand how reactivity works in Svelte when updating arrays and objects. Many web frameworks use the virtual DOM technique to update the page. Basically, the virtua...
...nally Svelte will flag todos as changed and remove the apparently redundant self-assignment. Apart from the fact that 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) => { tod...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Creating our first Vue component - Learn web development
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 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 labe...
...tion. This is to keep the data values unique for each instance of a component at runtime -- the function is invoked separately for each component instance. If you declared data as just an object, all instances of that component would share the same values. This is a side-effect of the way Vue registers components and something you do not want. You use this to access a component's props and other properties from inside data, as you may expect. We'll see an example of this shortly. Note: Because of the way that this works in arrow functions (binding to the parent's context), you wouldn't be able to access any of the necessary attributes from inside data if you used an arrow function. So don't use an arrow function for the data property. So let's add a data property to our ToDoItem component. This...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Accessibility API cross-reference
hird of the states and roles in Sun's accessibility API's are the same as in MSAA. To do Fill out Mac API column.(Mac OS X - Carbon Accessibility API and Accessibility Constants) Finish ARIA column - add explanation of the term 'Abstract role' Fill out HTML column Create AOM column Fill out XUL column. ...
...most common content type in most documents. A paragraph generally encloses distinct portions of content that are not otherwise specified with other block level structure element types such as heading, table or list elements. <p> <P> Shows percentage completion for task PROGRESSBAR PROGRESS_BAR n/a progressbar Page showing properties of something PROPERTYPAGE n/a n/a n/a Your average, run-of-the-mill button PUSHBUTTON 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 co...
... COLOR_CHOOSER n/a <input type=color> A dialog for picking a file n/a FILE_CHOOSER FILE_CHOOSER n/a Invoked with <input type=file> No explanation given n/a n/a INVALID n/a Contains accessible info, but its role is not known n/a n/a UNKNOWN Accessible States and Properties Description & Notes MSAA State (STATE_SYSTEM_*) Java Accessibility State Gnome Accessibility State (ATK_STATE_*) Mac OS X Accessibility State ARIA State or property HTML attribute Tagged PDF Relevant XUL Used in ARIA to denote non-conformant user input n/a n/a INVALID aria-invalid This window is currently the acti...
The Firefox codebase: CSS Guidelines
ilable, use the pseudo :-moz-locale-dir(ltr|rtl) (for XUL files) or :dir(ltr|rtl) (for HTML files). Remember that while a tab content's scrollbar still shows on the right in RTL, an overflow scrollbar will show on the left. Write padding: 0 3px 4px; instead of padding: 0 3px 4px 3px;. This makes it more obvious that the padding is symmetrical (so RTL won't be an issue). Note: See CSS Logical Properties and Values for more information. Testing To test for RTL layouts, you can go to about:config and set intl.uidirection to -1. Writing cross-platform CSS Firefox supports many different platforms and each of those platforms can contain many different configurations: Windows 7, 8 and 10 Default theme Aero basic (Windows 7, 8) Windows classic (Windows 7) High contrast (All ve...
... especially for large blocks of CSS. Content CSS vs. Theme CSS The following directories also contain CSS: browser/base/content/ toolkit/content/ These directories contain content CSS, that applies on all platforms, which is styling deemed to be essential for the browser to behave correctly. To determine whether some CSS is theme-side or content-side, it is useful to know that certain CSS properties are going to lean one way or the other: color - 99% of the time it will be theme CSS, overflow - 99% content. 99% theme 70% theme 70% content 99% content font-*, color, *-color, border-*, -moz-appearance [1] line-height, padding, margin cursor, width, max-width, top, bottom [2], etc overflow, direction, display, *-align, align-*, *-box-*, flex-*, order ...
...the correct values for different platform configurations, so using those CSS variables can definitively save some testing time, as you can assume they already work correctly. Using the currentcolor keyword or inheriting is also good practice, because sometimes the needed value is already in the color or on the parent element. This is especially useful in conjunction with icons using -moz-context-properties: fill; where the icon can adjust to the right platform color automatically from the text color. It is also possible to use currentcolor with other properties like opacity or fill-opacity to have different opacities of the platform color. High contrast mode Content area On Windows high contrast mode, in the content area, Gecko does some automatic color adjustments regarding page colors. Part...
Communicating with frame scripts
If you're using the message manager in an add-on, a good way to do that is to prefix messages with your add-on's ID. After the name, you can pass detailed data as a string or a JSON-serializable object, and after that you can pass any objects it wants to pass to content as CPOWs. ...
...ent) { sendAsyncMessage("my-addon@me.org:my-e10s-extension-message", { details : "they clicked", tag : event.target.tagName }, { target : event.target }); }, false); To receive messages from content, a chrome script needs to add a message listener using the message manager's addMessageListener() API. ...
... an object containing the following properties: name String containing the message name. sync Boolean declaring whether the message was send synchronously or aynchronously. data The JSON object passed as the second parameter to sendAsyncMessage(). target The XUL <browser> element from which this message was sent. ...
mozbrowsercaretstatechanged
mplementations and the behavior may change in the future. The mozbrowsercaretstatechanged event is fired when the user selects content in a page loaded in a browser <iframe>. This is used by the embedder to show a context menu for clipboard actions. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: rect An object that defines information about the bounding rectangle of the current selection. Its properties are width: The width of the bounding rectangle, in CSS pixels. height: The height of the bounding rectangle, in CSS pixels. top: The top position of the bounding rectangle, in CSS pixels. bottom: The bottom position of the bounding rectangle, in CSS pixels. left: The left...
..., in CSS pixels. top: The top position of the bounding rectangle, in CSS pixels. bottom: The bottom position of the bounding rectangle, in CSS pixels. left: The left position of the bounding rectangle, in CSS pixels. right: The right position of the bounding rectangle, in CSS pixels. commands An object that defines what commands can currently be executed in the browser <iframe>. ...
mozbrowserselectionstatechanged
ay change in the future. The mozbrowserselectionstatechanged event is fired when the text selected inside the browser <iframe> content changes. Note that this is deprecated, and current implementations should use mozbrowsercaretstatechanged instead. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: rect An object that represents the bounding rectangle of the selection. Its properties are: width: The width of the selection, in CSS pixels. height: The height of the selection, in CSS pixels. top: The Y coordinate of the top of the bounding box, in CSS pixels. bottom: The Y coordinate of the bottom of the bounding box, in CSS pixels. left: The X coordinate of the left of the bo...
...Y coordinate of the top of the bounding box, in CSS pixels. bottom: The Y coordinate of the bottom of the bounding box, in CSS pixels. left: The X coordinate of the left of the bounding box, in CSS pixels. right: The X coordinate of the right of the bounding box, in CSS pixels. commands An object that stores information about what commands can be executed on the current selection. Its properties are: canSelectAll: A Boolean Indicating whether the select all command can be issued (true) or not (false). canCut: A Boolean Indicating whether the cut command can be issued (true) or not (false). canCopy: A Boolean Indicating whether the copy command can be issued (true) or not (false). canPaste: A Boolean Indicating whether the paste command can be issued (true) or not (false). ...
mozbrowsershowmodalprompt
be large incompatibilities between implementations and the behavior may change in the future. The mozbrowsershowmodalprompt event is fired when the content of a browser <iframe> calls the window.alert(), window.confirm(), or window.prompt() methods. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property 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() meth...
... 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 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)...
::-moz-tree-row
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. ...
... 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. ...
...ge in the future. The ::-moz-tree-row CSS pseudo-element is used to select rows and apply styles to tree rows. ...
SourceMap.jsm
relative. mappings: A string of base64 VLQs which contain the actual mappings. file: The generated filename this source map is associated with. SourceMapConsumer.prototype.originalPositionFor(generatedPosition) Returns the original source, line, and column information for the generated source's line and column positions provided. The only argument is an object with the following properties: line: The line number in the generated source. column: The column number in the generated source. and an object is returned with the following properties: source: The original source file, or null if this information is not available. line: The line number in the original source, or null if this information is not available. column: The column number in the orig...
...The column number in the original source, or null if this information is not available. name: The original identifier, or null if this information is not available. SourceMapGenerator An instance of the SourceMapGenerator represents a source map which is being built incrementally. new SourceMapGenerator(startOfSourceMap) To create a new one, you must pass an object with the following properties: file: The filename of the generated source that this source map is associated with. sourceRoot: An optional root for all relative URLs in this source map. SourceMapGenerator.prototype.addMapping(mapping) Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the followi...
... file: The filename of the generated source that this source map is associated with. sourceRoot: An optional root for all relative URLs in this source map. SourceMapGenerator.prototype.addMapping(mapping) Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties: generated: An object with the generated line and column positions. original: An object with the original line and column positions. source: The original source file (relative to the sourceRoot). name: An optional original token name for this mapping. SourceMapGenerator.prototype.toString() Renders the source map being generated to a string. SourceNode SourceNodes p...
Bootstrapping a new locale
]/ path and can start localizing. ...
...browser To see what is contained in "browser" type $ ls And, you should see the following output from your terminal: aboutCertError.dtd pageInfo.dtd aboutDialog.dtd pageInfo.properties aboutPrivateBrowsing.dtd pageReportFirstTime.dtd aboutRobots.dtd places aboutSessionRestore.dtd preferences aboutSupport.dtd quitDialog.properties baseMenuOverlay.dtd safeMode.dtd browser.dtd safebrowsing browser.properties sanitize.dtd credits.dtd search.properties engineManager.dtd searchbar.dtd engineManager.properties setDesktopBackground.dtd feeds shellservice.properties history sidebar migration ...
... safebrowsing browser.properties sanitize.dtd credits.dtd search.properties engineManager.dtd searchbar.dtd engineManager.properties setDesktopBackground.dtd feeds shellservice.properties history sidebar migration tabbrowser.dtd openLocation.dtd tabbrowser.properties openLocation.properties As a localizer, you are responsible for localizing each of the ".dtd" and ".properties" in *all* of the sub-directories found in your ab-CD directory. Directories to localize If you're starting from scratch, you should have just downloaded: mozilla-1.9.x/browser/locales/ mozilla-1.9.x/dom/locales/ mozilla-1.9.x/netwerk/locales/ mozilla-1.9.x/other-licenses/branding/fir...
Mozilla Quirks Mode Behavior
behavior. Miscellaneous & Style All of the style rules in layout/style/res/quirk.css apply only in quirks mode: Orphaned LI has an inside bullet (bug 1049). Add padding if the very first node in an LI is another UL or OL (bug 98636). Obsolete since Gecko 50 List bullets do not inherit the font size of the list (bug 97351). Removed in Firefox 50 (bug 648331). Don't inherit font properties into tables except for font-family. Make TABLE borders gray rather than using the foreground color. Collapse top margin of BODY and TD and bottom margin of TD. Collapse the bottom or top margins of empty elements (bug 97361). Support <PRE wrap>, <PRE cols>, <PRE width>. Orphaned DD has generated content :before instead of margin (bug 5119). Indent nested DL elements (bug 8749). ...
... case sensitive. (This also applies to getElementsByClassName.) Stylesheets linked in the document with an advisory MIME type of text/css will still be treated as CSS even if the server gives a Content-Type header other than text/css. The CSS parser accepts colors not beginning with #, except in shorthands. The CSS parser interprets unitless numbers as px (except for line-height and any other properties where they have distinct meaning, and except in shorthands). In quirks mode, the CSS parser allows {} around the contents of style attributes (bug 99554). This behavior is being removed in Firefox 27, for interoperability. (bug 915053) An empty string for the background attribute sets the background URL to empty only in quirks mode. The topmargin, bottommargin, leftmargin, and rightmargin attr...
...ute sets the background URL to empty only in quirks mode. The topmargin, bottommargin, leftmargin, and rightmargin attributes on BODY are supported only in quirks mode (bug 9258). Obsolete since Gecko 35 (Firefox 35.0 / Thunderbird 35.0 / SeaMonkey 2.32) (bug 95530) This quirk is now HTML5 conform and has been adopted in standards mode. The scrollLeft, scrollTop, scrollWidth, and scrollHeight properties are relative to BODY in quirks mode (instead of HTML) (bug 211030). HTML (1-7) and CSS (xx-small - xx-large) font sizes are calculated slightly differently (see bug 18136). The :hover and :active pseudo-classes will only be applied to links, and only if there is no other pseudo-class in the selector. To match other elements, the selector must include a tag name, id, class or attribute. Prior...
Profile Manager
of Firefox 3.6.10, while ProfileB might be linked with a copy of Firefox 3.5.3. When launched, Profile Manager will look in some default locations for installed versions of Firefox (or other application you're using Profile Manager with). Additionally, you can manually add Firefox versions by clicking the "Manage Firefox versions..." button: Each Firefox version in the list has the following properties: path, version, and default. The default property indicates that this version of Firefox will be used with profiles that don't have a specific application version associated with them. Creating a profile To create a new profile, just click the New button from Profile Manager's toolbar. A dialog will appear that allows you to specify the profile's name, and optionally the profile's path, an...
...be prompted for the location of the archive, and then for the name of the profile you'd like to create from the archive. Other Operations Context-clicking any profile in the profile list will cause a popup menu to appear with the following commands: Copy - makes a copy of the profile using a name and location of your choice. Delete - deletes the profile, and all files associated with it. Properties - shows a dialog that displays the profile's path and last-modified date. Rename - allows you to specify a new name for the profile. Version - allows you change the default application version to be used with the profile. Future Enhancements Ability to install/uninstall/enable/disable extensions in profiles. Ability to copy certain assets (e.g., bookmarks) between profiles. Add 'Profil...
...og that displays the profile's path and last-modified date. Rename - allows you to specify a new name for the profile. Version - allows you change the default application version to be used with the profile. Future Enhancements Ability to install/uninstall/enable/disable extensions in profiles. Ability to copy certain assets (e.g., bookmarks) between profiles. Add 'Profile Size' to the Properties dialog. Ability to reset a profile (return it to a default state excluding bookmarks and passwords). Add option to specify the location of profiles.ini. ...
An overview of NSS Internals
use lookup functions, and NSS will provide an access handle that will be subsequently used by the application's code. Those handles are reference counted. NSS will usually create an in-memory (RAM) presentation of certificates, once a certificate has been received from the network, read from disk, or looked up from the database, and prepare in-memory data structures that contain the certificate's properties, as well as providing a handle for the programmer to use. Once the application is done with a handle, it should be released, allowing NSS to free the associated resources. When working with handles to private keys it's usually difficult (and undesired) that an application gets access to the raw key data; therefore it may be difficult to extract such data from NSS. The usual minimum requirement is...
... requirement is that private keys must be wrapped using a protective layer (such as password-based encryption). The intention is to make it easier to review code for security. The less code that has access to raw secret keys, the less code that must be reviewed. NSS has only limited functionality to look up raw keys. The preferred approach is to use certificates, and to look up certificates by properties such as the contained subject name (information that describes the owner of the certificate). For example, while NSS supports random calculation (creation) of a new public/private key pair, it's difficult to work with such a raw key pair. The usual approach is to create a certificate signing request (CSR) as soon as an application is done with the creation step, which will have created a handle t...
...though it still makes sense to use that principle today for good performance). In order to process data available in the ASN.1 format, the usual approach is to parse it and transfer it to a presentation that requires more space but is easier to work with, such as (nested) C data structures. Over the time NSS has received three different ASN.1 parser implementations, each having their own specific properties, advantages and disadvantages, which is why all of them are still being used (nobody has yet dared to replace the older with the newer ones because of risks for side effects). When using the ASN.1 parser(s), a template definition is passed to the parser, which will analyze the ASN.1 data stream accordingly. The templates are usually closely aligned to definitions found in RFC documents. A data...
Index
use lookup functions, and NSS will provide an access handle that will be subsequently used by the application's code. Those handles are reference counted. NSS will usually create an in-memory (RAM) presentation of certificates, once a certificate has been received from the network, read from disk, or looked up from the database, and prepare in-memory data structures that contain the certificate's properties, as well as providing a handle for the programmer to use. Once the application is done with a handle, it should be released, allowing NSS to free the associated resources. When working with handles to private keys it's usually difficult (and undesired) that an application gets access to the raw key data; therefore it may be difficult to extract such data from NSS. The usual minimum requirement is...
... requirement is that private keys must be wrapped using a protective layer (such as password-based encryption). The intention is to make it easier to review code for security. The less code that has access to raw secret keys, the less code that must be reviewed. NSS has only limited functionality to look up raw keys. The preferred approach is to use certificates, and to look up certificates by properties such as the contained subject name (information that describes the owner of the certificate). For example, while NSS supports random calculation (creation) of a new public/private key pair, it's difficult to work with such a raw key pair. The usual approach is to create a certificate signing request (CSR) as soon as an application is done with the creation step, which will have created a handle t...
...though it still makes sense to use that principle today for good performance). In order to process data available in the ASN.1 format, the usual approach is to parse it and transfer it to a presentation that requires more space but is easier to work with, such as (nested) C data structures. Over the time NSS has received three different ASN.1 parser implementations, each having their own specific properties, advantages and disadvantages, which is why all of them are still being used (nobody has yet dared to replace the older with the newer ones because of risks for side effects). When using the ASN.1 parser(s), a template definition is passed to the parser, which will analyze the ASN.1 data stream accordingly. The templates are usually closely aligned to definitions found in RFC documents. A data...
Tutorial: Embedding Rhino
All it does it read a script from the command line, execute it, and print a result. Here's an example use of RunScript from a shell command line: $ java RunScript "Math.cos(Math.PI)" -1 $ java RunScript "funct...
...ndefined or not a function."); } else { Object functionArgs[] = { "my arg" }; Function f = (Function)fObj; Object result = f.call(cx, scope, scope, functionArgs); String report = "f('my args') = " + Context.toString(result); System.out.println(report); } JavaScript host objects Defining Host Objects Custom host objects can implement special JavaScript features like dynamic properties. Counter example The Counter example is a simple host object. We'll go through it method by method below. It's easy to try out new host object classes in the shell using its built-in defineClass function. We'll see how to add it to RunScript later. (Note that because the java -jar option preempts the rest of the classpath, we can't use that and access the Counter class.) $ java -cp "js.jar;ex...
... public Counter () { } The method jsConstructor defines the JavaScript constructor that was called with the expression new Counter(7) in the JavaScript code above. public void jsConstructor(int a) { count = a; } Class name The class name is defined by the getClassName method. This is used to determine the name of the constructor. public String getClassName() { return "Counter"; } Dynamic properties Dynamic properties are defined by methods beginning with jsGet_ or jsSet_. The method jsGet_count defines thecount property. public int jsGet_count() { return count++; } The expression c.count in the JavaScript code above results in a call to this method. Defining JavaScript "methods" Methods can be defined using the jsFunction_ prefix. Here we define resetCount for JavaScript. public void...
Rhino overview
es introduced in JavaScript 1.2 are now deprecated. These features allow "computational reflection": that is, the ability for a script to determine and influence aspects of the way it is evaluated. These features are generally not broadly useful, yet they impose significant constraints on implementations that hamper or prevent optimization. ...
... JavaScript Language Versions Some behavior in the JavaScript engine is dependent on the language version. ...
... 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". ...
Rhino shell
to force interpretation mode. Starting with Rhino 1.7 this options is no longer available. Note If the shell is invoked with the system property rhino.use_java_policy_security set to true and with a security manager installed, the shell restricts scripts permissions based on their URLs according to Java policy settings. This is available only if JVM implements Java2 security model. Predefined Properties Scripts executing in the shell have access to some additional properties of the top-level object. arguments The arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. environment Returns the current environment object. history Displays the shell command history. help() Executing the help function will print usage and...
...mmand(command) runCommand(command, arg1, ..., argN) runCommand(command, arg1, ..., argN, options) All except the last arguments to runCommand are converted to strings and denote command name and its arguments. If the last argument is a JavaScript object, it is an option object. Otherwise it is converted to string denoting the last argument and options objects assumed to be empty. The following properties of the option object are processed: args - provides an array of additional command arguments env - explicit environment object. All its enumeratable properties define the corresponding environment 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. ...
...ut 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 add, delete or modify its properties would throw an exception. serialize(object, filename) Serialize the given object to the specified file. spawn(functionOrScript) Run the given function or script in a different thread. sync(function) creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchronizes on the this object of its invocation. quit() Quit shell. T...
Invariants
There may be other reasons that cover more cases, but nobody can remember one.) All JSObjects and heap-allocated JSStrings must be 8-byte-aligned. (The jsval encoding depends on this.) The JSStackFrame::down chain never forms a cycle. (It's a stack. ...
...racejit must not trace into a function whose scope chain ends in a different global object. (If it is a script function, global names accessed 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 proper...
... that object. Property locks Each thread may have a lock on at most one property at a time. (Nesting them would risk deadlock. JS_SetWatchPoint violates this rule.) Whether a property is locked, and which one, is static information for almost every line of code. The locking scheme is described under JSObjectOps.dropProperty. (Note that the locking scheme applies to all objects and talks about properties being locked. As implemented for native objects, the locking is not really that fine-grained, but that is a transparent optimization as long as we follow the rules.) A thread holding a property lock never leaves or suspends the current request. With a few exceptions (known to brendan and probably jst and mrbkap), we never call a JSAPI callback with a property locked. (That would risk deadlock ...
JIT Optimization Outcomes
y and occurs if the target object is obtained in some roundabout way. NoAnalysisInfo TODO NoShapeInfo The baseline compiler recorded no usable shape information for this operation. UnknownObject The type of the object is not known. This can happen if the operation sees many different types of objects, and so the type of the input to the operation cannot be resolved to a single type. UnknownProperties Optimization failed because the object containing the property was marked as having unknown properties. This can happen if too many properties are defined on the object, or if delete is used to remove one of the object's properties. Singleton One of the types present in the typeset was a singleton type, preventing the optimization from being enabled. NotSingleton Optimization failed because ...
...e property did not have a 'singleton' type. Singleton types are assigned to objects that are "one of a kind", such as global objects, literal objects declared in the global scope, and top-level function objects. NotFixedSlot The property being accessed is not stored at a known location in the object. This can occur if one of the expected types of objects to be used in this operation has unknown properties, or if different instances of the object store the property at different locations (for example, some instances have the property assigned in a 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 pro...
...ionary objects and their types marked as such. NoProtoFound A prototype object was not found for all the object used by this operation. MultiProtoPaths Objects used in this operation had differing prototypes. NonWritableProperty The property being assigned to is not writable for some types of objects which are used in this operation. ProtoIndexedProps The object being accessed has indexed properties that are exotic (for example, defined as a property on a prototype object and left as a hole in the underlying object). ArrayBadFlags The array being accessed may have flags that the optimization strategy cannot handle. For example, if the array has sparse indexes, or has indexes that overflow the array's length, the optimization strategy may fail. ArrayDoubleConversion The type-system indica...
JSClass
A JSClass describes a class of JavaScript objects. A C/C++ program can use a JSClass with the JS_InitClass and JS_NewObject APIs to create objects that have custom methods and properties implemented in C/C++. Syntax struct JSClass { const char *name; uint32_t flags; /* Optional since SpiderMonkey 37 */ JSPropertyOp addProperty; JSDeletePropertyOp delProperty; JSPropertyOp getProperty; JSStrictPropertyOp setProperty; JSEnumerateOp enumerate; JSResolveOp resolve; JSConvertOp convert; /* Obsolete since SpiderMonkey 44 */ /* Optional since SpiderMonkey 25 */ JSFinalizeOp finalize; /* Optional */ JSClassInternal reserved0; /* Obsolete since SpiderMonkey 13 */ J...
...er) for default behavior. setProperty JSStrictPropertyOp A hook called when setting a property. This is the default setter for the class. When a script creates a new property, this is called after addProperty. Use NULL or JS_StrictPropertyStub (SpiderMonkey 31 or older) for default behavior. enumerate JSEnumerateOp Method for enumerating object properties. Use NULL or JS_EnumerateStub (SpiderMonkey 31 or older) for default behavior. Obsolete since JSAPI 37 The JSCLASS_NEW_ENUMERATE flag instructs SpiderMonkey to call this as a JSNewEnumerateOp. resolve JSResolveOp Hook for implementing lazy properties. See JSClass.resolve for details. Use NULL or JS_ResolveStub (SpiderMonkey 31 or older) for default...
... Private data Custom classes very often need to store private C/C++ data that should not be visible to scripts. To do this, use the JSCLASS_HAS_PRIVATE (JSCLASS_CONSTRUCT_PROTOTYPE wad removed) flags. Implement a JSNative constructor function that allocates this private data and stores it in the new object using JS_SetPrivate. Implement a JSClass.finalize callback that f...
JSResolveOp
JS::HandleId id, bool *resolvedp); // Added in JSAPI 36 typedef bool (* JSResolveOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id); // Obsolete since JSAPI 36 Name Type Description cx JSContext * Pointer to the JS context in which the property access is taking place. ...
... The callback must set *resolvedp to true and return true if the property is resolved, or set *resolvedp to false and return true if the object has no lazy property with the given id; or return false to indicate any other error. ...
...ty is resolved, or set *resolvedp to false and return true if the object has no lazy property with the given id; or return false to indicate any other error. Obsolete since JSAPI 36 The callback must return true if the property is resolved, or if the object has no lazy property with the given id; or false to indicate any other error. Note: JSNewResolveOp provides a cheaper way to resolve lazy properties. JSClass hooks JSClass offers the following hook: JSClass.resolve callback is called when a property is not found on an object. It can be used to implement lazy properties. JS looks for a property in an object, and if not found, tries to resolve the given id. After calling resolve, the engine looks again to see if resolve defined obj[id]. If so, the property lookup succeeds. If not, th...
JS_ClearNonGlobalObject
Obsolete since JSAPI 34This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. This article covers features introduced in SpiderMonkey 24 Remove all properties associated with an object. Syntax void JS_ClearNonGlobalObject(JSContext *cx, JSObject *obj); Name Type Description cx JSContext * The context in which to clear the object. Requires request. ...
...Properties belonging to objects on obj's prototype chain are not affected. To remove a single property from an object, use JS_DeleteProperty. To remove a single array object element, use JS_DeleteElement. ...
...S_ClearNonGlobalObject(JSContext *cx, JSObject *obj); Name Type Description cx JSContext * The context in which to clear the object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object from which to delete all properties. Description JS_ClearNonGlobalObject removes all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation. Properties belonging to objects on obj's prototype chain are not affected. To remove a single property from an object, use JS_DeleteProperty. To remove a single array object element, use JS_DeleteElement. See Also JS_DeleteProperty JS_DeleteElement bug 1043281 ...
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 element mus...
...o 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 properties for a specified object, obj, where each property consists of a int32_t value. 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...
...ntegerSpec 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_DefineConstDoubles MXR ID Search for JS_DefineConstIntegers JSConstDoubleSpec JSConstIntegerSpec JS_DefineElement JS_DefineProperties JS_DefineProperty JS_DefinePropertyWithTinyId bug 1066020 - added JS_DefineConstIntegers ...
JS_Enumerate
Get an array of the enumerable properties of a given object. Syntax JSIdArray * JS_Enumerate(JSContext *cx, JS::HandleObject obj); Name Type Description cx JSContext * The context in which to enumerate object properties. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The object whose properties are to be enumerated. Description JS_Enumerate gets the ids of all own properties of the specified object, obj, that have the JSPROP_ENUMERATE attribute. (The term own property refers to a property that is not inherited from the object's prototype.) This is not quite the same behavior as a JavaScript for...in loop, which converts all property ids to strings and also enumerates inherited ...
...This calls obj's JSClass.enumerate hook. On success, JS_Enumerate returns a pointer to the first element of an array of property IDs. The application must free this array using JS_DestroyIdArray. On error or exception, JS_Enumerate returns NULL. ...
...ation must free this array using JS_DestroyIdArray. On error or exception, JS_Enumerate returns NULL. The property ids in the returned JSIdArray are subject to garbage collection. As long as obj is reachable, its current property ids are reachable. But, for example, if an application calls back into JavaScript while it is looping over the property ids in the JSIdArray, the script could delete properties from obj. The property ids would then become unreachable and could be collected. Therefore a program that loops over the property ids must either root them all, ensure that the properties are not deleted (in a multithreaded program this requires even greater care), or ensure that garbage collection does not occur. See Also MXR ID Search for JS_Enumerate ...
JS_InitStandardClasses
ntext for which to initialize JS function and object classes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::Handle&lt;JSObject*&gt; The global object to initialize. This object must be of a JSClass that has the JSCLASS_GLOBAL_FLAGS bits set. Description JS_InitStandardClasses initializes the built-in JavaScript global properties. ...
... Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::Handle&lt;JSObject*&gt; The global object to initialize. This object must be of a JSClass that has the JSCLASS_GLOBAL_FLAGS bits set. Description JS_InitStandardClasses initializes the built-in JavaScript global properties. ...
...RangeError, ReferenceError, RegExp, String, SyntaxError, TypeError, undefined, and URIError as well as a few SpiderMonkey-specific globals, depending on compile-time options: escape, unescape, uneval, InternalError, Script, XML, Namespace, QName, File, Generator, Iterator, and StopIteration, as of SpiderMonkey 1.7. These global objects, functions, constructors, and constants are created as properties of obj. As a side effect, JS_InitStandardClasses establishes obj as the global object for cx, if one is not already established. This means that scripts executed in cx will see the properties of obj as global variables. See JS_SetGlobalObject for details. obj must be of a JSClass that has the JSCLASS_GLOBAL_FLAGS flag. JS_InitStandardClasses returns JS_TRUE on success, and JS_FALSE if an error ...
TPS History Lists
An integer value from one of the transition types listed at https://developer.mozilla.org/en/nsINavHistoryService#Constants. date: required. ...
...An integer value from one of the transition types listed at https://developer.mozilla.org/en/nsINavHistoryService#Constants. date: required. ...
... looks different. It's an array of objects, each of which represents a type of history to delete. ...
Components.interfaces
Each object represents one of the XPCOM interfaces -- that some component or another might or might not implement. It reflects only those interfaces which have been designated in their .idl description as scriptable, that is the interfaces which XPConnect is capable of reflecting into JavaScript. Properties of the Components.interfaces object are used where XPCOM methods expect a parameter of type nsID. ...
...tion Components.interfaces is a read-only object whose properties implement the nsIJSIID interface. Each object represents one of the XPCOM interfaces -- that some component or another might or might not implement. It reflects only those interfaces which have been designated in their .idl description as scriptable, that is the interfaces which XPConnect is capable of reflecting into JavaScript. Properties of the Components.interfaces object are used where XPCOM methods expect a parameter of type nsID. This includes nsISupports.QueryInterface(), the optional parameter accepted by nsIJSCID.getService(), nsIJSCID.createInstance() when called from JavaScript, and nsIClassInfo.getInterfaces(). The properties of the Components.interfaces object can be enumerated using a for...in loop. Usage Accessing...
...erfaces object are used where XPCOM methods expect a parameter of type nsID. This includes nsISupports.QueryInterface(), the optional parameter accepted by nsIJSCID.getService(), nsIJSCID.createInstance() when called from JavaScript, and nsIClassInfo.getInterfaces(). The properties of the Components.interfaces object can be enumerated using a for...in loop. Usage Accessing an interface object Properties of the Components.interfaces object are indexed by interface name. You can retrieve an interface object using: var iface = Components.interfaces.nsISupportsArray; This will return you the interface object for the nsISupportsArray interface. Accessing constants defined in an interface Interface descriptions (cf. XPIDL) may not only contain method declarations, but also constants. For example,...
Components.utils.createObjectIn
To create an object with a specified name, use defineAs: var foo = Components.utils.createObjectIn(myWindow, {defineAs: "foo"}...
... To create an object with a specified name, use defineAs: var foo = Components.utils.createObjectIn(myWindow, {defineAs: "foo"}); Now the target compartment's window has a new global object named foo. ...
...ls.createObjectIn(myWindow); var propList = { name: genPropDesc("name"), date: genPropDesc("date"), id: genPropDesc("id"), func: genPropDesc(function() { alert("Called func!"); }) }; Object.defineProperties(myObject, propList); Components.utils.makeObjectPropsNormal(myObject); This sets up the new object in the scope of the object myWindow, then adds properties by calling Object.defineProperties(), then normalizes them by calling Components.utils.makeObjectPropsNormal(). To create an object with a specified name, use defineAs: var foo = Components.utils.createObjectIn(myWindow, {defineAs: "foo"}); Now the target compartment's window has a new global object named foo. ...
Components.utils.waiveXrays
rivileged JavaScript in Gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "Xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways. For example, privileged code using an Xray to a DOM object sees only the original, native version of the DOM object. Any expando properties are not visible, and if any native properties have been redefined, this has no effect. Xray vision is designed to make most simple operations safe. However, in some cases it can be too restrictive: for example, if you need to see an expando property on a DOM object. In these cases you can use waiveXrays to remove Xray vision for the object. Waiving Xrays is transitive, so waiving it for an object...
...To undo waiveXrays and get Xray vision back, call Components.utils.unwaiveXrays on the object. ...
...is has no effect. Xray vision is designed to make most simple operations safe. However, in some cases it can be too restrictive: for example, if you need to see an expando property on a DOM object. In these cases you can use waiveXrays to remove Xray vision for the object. Waiving Xrays is transitive, so waiving it for an object automatically waives it for any properties of that object (and their properties, and so on). If you waive Xray vision, you can no longer trust that any of the object's properties are what you expect: any of them, including prototypes and accessors, could have been redefined by the less-privileged code. To undo waiveXrays and get Xray vision back, call Components.utils.unwaiveXrays on the object. The result of waiveXrays is just like the wrappedJSObject property for Xrayed ob...
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. For example, say you create a statement like so: var statement = dbConn.createStatement("SELECT * FROM table_name WHERE id = :item_id"); This object would have 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. ...
...for (let param in statement.params) statement.params[param] = valuesToBind[param]; ...
...for (let param in statement.params) statement.params[param] = valuesToBind[param]; ...
nsIAbCard
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. ...
...See //github.com/RealityRipple/UXP/blob/master//mailnews/addrbook/public/nsIAbCard.idl for more details. ...
...ing the firstName, lastName and the displayName. We allow the caller to cache the pref value, so we don't have to go to prefs every time. AString generateName(in long aGenerateFormat,[optional] in nsIStringBundle aBundle) Parameters aGenerateFormat The format to present the name in: 0 Generated name is displayName 1 lastFirst, formatted following lastFirstFormat property in addressBook.properties. 2 firstLast, formatted following firstLastFormat property in addressBook.properties. aBundle An optional parameter that is a pointer to a string bundle that holds: addressBook.properties. If this bundle is not supplied, then the function will obtain the bundle itself. If cached by the caller and supplied to this function, then performance will be improved over many calls. Return value A...
nsIAccessibleText
nds(in long selectionNum, out long startOffset, out long endOffset); AString getText(in long startOffset, in long endOffset); AString getTextAfterOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); AString getTextAtOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); nsIPersistentProperties getTextAttributes(in boolean includeDefAttrs, in long offset, out long rangeStartOffset, out long rangeEndOffset); AString getTextBeforeOffset(in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); void removeSelection(in long selectionNum); void scrollSubstringTo(in long startIndex, in long endIndex, in unsigned long scrollType); void scrol...
...tIndex, in long endIndex, in unsigned long coordinateType, in long x, in long y); void setSelectionBounds(in long selectionNum, in long startOffset, in long endOffset); 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 B...
...ould return "string" values which are UTF-8. AString getTextAtOffset( in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset ); Parameters offset boundaryType startOffset endOffset Return value getTextAttributes() Get the accessible start/end offsets around the given offset, return the text attributes for this range of text. nsIPersistentProperties getTextAttributes( in boolean includeDefAttrs, in long offset, out long rangeStartOffset, out long rangeEndOffset ); Parameters includeDefAttrs Points whether text attributes applied to the entire accessible should be included or not. offset Text offset. rangeStartOffset Start offset of the range of text. rangeEndOffset End offset of the range of text. Return value Exceptions thrown ...
nsIDocShell
the channel for the currently loaded document, if any. For a new document load, this will be the channel of the previous document until after OnLocationChange fires. Read only. documentCharsetInfo nsIDocumentCharsetInfo The document character set info. This is used by a load to determine priorities for charset detection and so on. Obsolete since Gecko 12.0 Note: The properties of the old nsIDocumentCharsetInfo interface were merged into nsIDocShell in Gecko 12.0. eldestPresShell nsIPresShell Presentation shell for the oldest document, if this docshell is currently transitioning between documents. Read only. Native code only! forcedCharset nsIAtom A character set to override the page's default character set while processing; t...
...pe The type (MIME) of data being loaded (empty if unknown). aContentCharset The charset of the data being loaded (empty if unknown). aLoadInfo This is the extended load info for this load. This most often will be null, but if you need to do additional setup for this load you can get a loadInfo object by calling createLoadInfo(). Once you have this object you can set the needed properties on it and then pass it to loadStream. Native code only!loadURI Loads a given URI. This will give priority to loading the requested URI in the object implementing this interface. If it can not be loaded here however, the URL dispatcher will go through its normal process of content loading. void loadURI( in nsIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags, in boolea...
...sIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags, in boolean firstParty ); Parameters uri The URI to load. loadInfo This is the extended load info for this load. This most often will be null, but if you need to do additional setup for this load you can get a loadInfo object by calling createLoadInfo(). Once you have this object you can set the needed properties on it and then pass it to loadURI. aLoadFlags Flags to modify load behaviour. Flags are defined in nsIWebNavigation. Note that using flags outside LOAD_FLAGS_MASK is only allowed if passing in a non-null loadInfo. And even some of those might not be allowed. Use at your own risk. firstParty true if this is the master top-level document. prepareForNewContentModel() Reset state to ...
nsILoginManager
oveAllLogins(); 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 for a user field autocomplete menu. ...
... in AString aHost ); Parameters aHost The hostname to check. This argument should be in the origin URL format, with no pathname. For example: "https://www.site.com". Return value true if login saving is enabled for the host, otherwise false. modifyLogin() Modifies an existing login by replacing it with a new one. If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo properties are changed to the values from newLoginData (but the old login's nsILoginMetaInfo properties are unmodified). If newLoginData is a nsIPropertyBag, only the specified properties will be changed. The nsILoginMetaInfo properties of oldLogin can be changed in this manner. If the propertybag contains an item named "timesUsedIncrement", the login's timesUsed property will be incremented by the item's...
...ed as either an nsILoginInfo or an nsIPropertyBag2 object. removeAllLogins() Removes all logins known by the Login Manager. This works without a need for the master password, if one is set. void removeAllLogins(); Parameters None. removeLogin() Removes a login from the Login Manager. Note: The specified login must exactly match a stored login. However, the values of any nsILoginMetaInfo properties are ignored. void removeLogin( in nsILoginInfo aLogin ); Parameters aLogin The login to remove from the Login Manager. Only a login that is an exact match is deleted. searchLogins() Searches for logins in the login manager's data store, returning an array of matching logins. If there are no matching logins, an empty array is returned. void searchLogins( out unsigned long count, i...
nsILoginManagerStorage
g 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 the criteria without having to ask the ...
...e( in nsIFile aInputFile, in nsIFile aOutputFile ); Parameters aInputFile The file from which to read stored logins. aOutputFile The file to which to write stored logins, if not null. If this is null, use the default output file. modifyLogin() Implement this method to modify an existing login in the login store. If newLoginData is specified as an nsILoginInfo object, all of the old login's properties are changed to the values from the newLoginData parameter. If newLoginData is a nsIPropertyBag, only the properties specified in the nsIPropertyBag are changed in oldLogin and its corresponding nsILoginMetaInfo. void modifyLogin( in nsILoginInfo oldLogin, in nsISupports newLoginData ); Parameters oldLogin The login to be modified. newLoginData The login information to replace the oldLogin w...
...ar all stored passwords. The user interface allows this to be done without getting each login first (which might require knowing the master password). No password should be required in order to remove all logins. void removeAllLogins(); Parameters None. removeLogin() Implement this method to remove the specified login from the login store. Gecko 1.9.1 note The values of any nsILoginMetaInfo properties are ignored. void removeLogin( in nsILoginInfo aLogin ); Parameters aLogin The login to remove from the login store. A login must match completely (except for its nsILoginMetaInfo data) to be removed. searchLogins() Implement this to search for logins in the login manager's data store, returning an array of matching logins. If there are no matching logins, return an empty array. void search...
nsIMsgCustomColumnHandler
this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsITreeView This interface is meant to be implemented by extensions, as shown in the tutorial. The interface inherits from nsITreeView, however when you're implementing a custom handler in Javascript its not necessary to implement all of nsITreeView's methods. You must implement: nsITreeView.isEditable() nsITreeView.GetCellProperties() nsITreeView.GetImageSrc() nsITreeView.GetCellText() nsITreeView.cycleCell() nsIMsgCustomColumnHandler.getSortStringForRow() nsIMsgCustomColumnHandler.getSortLongForRow() nsIMsgCustomColumnHandler.isString() and optionally: nsITreeView.GetRowProperties() From C++ you must implement all of nsITreeView and nsIMsgCustomColumnHandler. Example Implementation An example Javascript implementation that...
...l of nsITreeView and nsIMsgCustomColumnHandler. ...
...mplementation An example Javascript implementation that does nothing: var columnHandler = { isEditable: function(aRow, aCol) {return false;}, cycleCell: function(aRow, aCol) { }, getCellText: function(aRow, aCol) { }, getSortStringForRow: function(aHdr) { return ""; }, isString: function() {return true;}, getCellProperties: function(aRow, aCol, aProps) { }, getRowProperties: function(aRow, aProps) { }, getImageSrc: function(aRow, aCol) {return null;}, getSortLongForRow: function(aHdr) {return 0;} } to attach it use the nsIMsgDBView.addColumnHandler() method (recall gDBView is the global nsIMsgDBView in Thunderbird): gDBView.addColumnHandler("newColumn", columnHandler); after which it can be retrieved using the nsIMsgDBView.getColumnHandler() met...
Using IndexedDB in chrome
The indexedDB API is typically used to store data in the user's browser from content JavaScript. (See Using IndexedDB for an overview.) However, the APIs can also be accessed from system-privileged JavaScript using the Components.utils.importGlobalProperties() function: Components.utils.importGlobalProperties(["indexedDB"]); // From here on, it's like using IndexedDB from content var req = indexedDB.open("my-database"); // ... ...
...verview.) However, the APIs can also be accessed from system-privileged JavaScript using the Components.utils.importGlobalProperties() function: Components.utils.importGlobalProperties(["indexedDB"]); // From here on, it's like using IndexedDB from content var req = indexedDB.open("my-database"); // ... ...
...aScript using the Components.utils.importGlobalProperties() function: Components.utils.importGlobalProperties(["indexedDB"]); // From here on, it's like using IndexedDB from content var req = indexedDB.open("my-database"); // ... ...
Mail and RDF
ages --> "2" | +-- http://home.netscape.com/NC-rdf#IsServer --> "false" | +-- http://home.netscape.com/NC-rdf#MessageChild --> | | mailbox_message://alecf@pop.mywork.com/INBOX#1 | +-- http://home.netscape.com/NC-rdf#MessageChild --> | mailbox_message://alecf@pop.mywork.com/INBOX#2 | etc... There are of course many more properties that are exposed via RDF, but this should give you a feel for it. Datasources We have a few primary datasources used in mail: nsMsgAccountDataSource - answers queries about arcs coming out of msgaccounts:/. If you ask it for #child nodes out of msgaccounts:/, it returns the root URIs of all servers in the account manager. Note that it does not actually know anything about the servers who's U...
...nything about the servers who's URIs it returns. nsMsgFolderDataSource - answer queries about any mail folders, including toplevel server folders. If asked about a folder along the #child arc, it will return resources for all subfolders in that folder. If asked about a folder along the #MessageChild arc, it will return resources for all messages in a folder. It also answers queries about various properties of folders such as the total number of messages, whether or not this folder is actually a root server, and so forth. nsMsgMessageDataSource - answers queries about messages in folders. All RDF properties of a message currently come from the database that backs the containing folder. Datasources and the UI Mail does not link the UI to datasources in a "traditional" manner. Instead of having a...
...mail object's data changes and the data is reflected in RDF by notifying all of the observers that RDF has registered with the datasource. In the example of mail folders, each folder datasource first registers itself with the mail session as a nsIFolderListener because it wants information about when a folder changes. Each template registers itself as an RDF observer. When a folder's contents or properties change, it tells the mail session to notify the folder listeners that the data has changed. The folder datasource then translates these property changes into OnAssert() or OnUnassert() calls to the observers. The calling chain essentially looks like this: Registration: Folder datasource registers itself with the mail session as a folder listener RDF Template registers itself with the dataso...
Adding items to the Folder Pane
Each item in this array satisfies the following interface: id (attribute) a unique string for this object. Must persist over sessions text (attribute) the text to display in the tree level (attribute) the level in the tree to display the item at open (rw, attribute) whether or not this container is open children (attribute) an array of child items also conforming to this spec getProperties (function) a call from getRowProperties or getCellProperties for this item will be passed into this function command (function) this function will be called when the item is double-clicked For our example extension, two different types of folder-tree-items will be defined. First, our "Numbers" container looks like this: let containerRow = { _NUMBERS: 3, id: "numbers-main-c...
...containerRow = { _NUMBERS: 3, id: "numbers-main-container", text: "Numbers", level: 0, open: false, _children: null, get children() { if (!this._children) { this._children = []; for (var i = 1; i <= this._NUMBERS; i++) this._children.push(new numberRow(i)); } return this._children; }, getProperties: function gne_getProps() { // Put your css attributes here }, command: function gne_command() { // Just going to alert, to do something here Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService) .alert(window, null, this.text); } }; Second, our child items...
...indow, null, this.text); } }; Second, our child items (the numbers 1, 2, and 3) are copies of the following prototype: function numberRow(aNumber) { this._number = aNumber; } numberRow.prototype = { get id() { return "numbers-child-row-" + this._number; }, get text() { return this._number; }, level: 1, open: false, children: [], getProperties: function gne_kid_getProps() {}, // no-op command: function gne_kid_command() { // Just going to alert, to do something here Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService) .alert(window, null, this.text); } }; Putting it all together All that is left at this poi...
Creating a Custom Column
-in column, but more about that later. nsIMsgCustomColumnHandler extends (inherits from) nsITreeView and as such needs to implement functions from both. The following is a list of functions that must be implemented to ensure that your extension works well with Thunderbird. Rest assured that these functions will be called - so implement them, even with empty function. ...
...nds (inherits from) nsITreeView and as such needs to implement functions from both. The following is a list of functions that must be implemented to ensure that your extension works well with Thunderbird. Rest assured that these functions will be called - so implement them, even with empty function. ...
...rface looks like: var columnHandler = { getCellText: function(row, col) { //get the message's header so that we can extract the reply to field var hdr = gDBView.getMsgHdrAt(row); return hdr.getStringProperty("replyTo"); }, getSortStringForRow: function(hdr) {return hdr.getStringProperty("replyTo");}, isString: function() {return true;}, getCellProperties: function(row, col, props){}, getRowProperties: function(row, props){}, getImageSrc: function(row, col) {return null;}, getSortLongForRow: function(hdr) {return 0;} } Basically, all we are doing here is making sure that both the text that is displayed to the user (getCellText()) and the string we sort according to (when the user decided to sort the view by our custom col...
Using the Multiple Accounts API
Warning: The content of this article may be out of date. It was imported from mozilla.org and last updated in 2003. By Alec Flett alecf@flett.org Structure Servers Identities Storage Creating new accounts SMTP Servers Appendix A: Listing of all preferences and properties Structure The account system consists of: The Account Manager (nsIMsgAccountManager): There is a single account manager in the the client, which maintains the list of accounts, servers, etc. It is also responsible for the creation of any new account-related objects. The account manager maintains the main list of Accounts. Accounts (nsIMsgAccount): An account consists of a single incoming server, and one or more identities. An account is merely a container to bind incoming servers and ide...
...esponsible 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 account with the incomingServer attribute...
...to something else by setting the defaultServer property on the smtpService, but that will not be saved to disk. Eventually there will be the concept of a session default server, and a permenant default server. Relevant API calls: nsISmtpService.smtpServers: list of SMTP servers nsISmtpService.createSmtpServer(): Create a new SMTP server nsISmtpServer.hostname, nsISmtpServer.username: Useful properties of the SMTP server. Appendix A: Listing of all properties (When brendan's idldoc comes along, I'll just link to that) All preferences are strings, unless otherwise noted. Account Manager Pref: mail.accountmanager.accounts Account Preference: mail.account.account.server IDL: nsIMsgAccount.incomingServer The incoming server associated with this account. The preference is the prefere...
PointerType
the type to which the pointer type points. This can be any CType object to declare the new type as a pointer to that type. Return value A CType object describing the newly created data type. Exceptions thrown TypeError Thrown if the parameter isn't a CType. Examples Creating a type "pointer to 32-bit integer" looks like this: var intPtrType = new ctypes.PointerType(ctypes.int32_t); Properties Property Type Description targetType CType The type of object the pointer points to. Read only. Properties inherited from CType These properties are available on all CType objects. Property Type Description name String The type's name. Read only. For primitive types, this is just the name of the corresponding C type. ...
... 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. ...
...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. ...
Edit fonts - Firefox Developer Tools
s like when rendered. The default text for the sample is "Abc" but the preview text can be edited by clicking on the input field at the top of the section and entering a new value. Once entered, all of the sample text will be set to the same custom value. Variable font support in Firefox Developer Tools Firefox 62 added support for variable fonts and Firefox 63 features support for editing the properties of variable fonts in the Font Editor. What are variable fonts? Variable Fonts, or OpenType Font Variations, define a new font file format that allows the font designer to include multiple variations of a typeface inside a single font file. That means you no longer have to apply several different web fonts to a single page to represent a complete typeface for which a variable font is available, ...
...nt-variation-settings, you could do something like this: font-variation-settings: "wght" 350; However, you should only use font-variation-settings as a last resort if there is no basic font property available for setting those characteristic values (e.g. custom axes). ...
...settings as a last resort if there is no basic font property available for setting those characteristic values (e.g. custom axes). Note: font characteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. Here are the registered axes along with their corresponding CSS properties: Axis Tag CSS Property "wght" font-weight "wdth" font-stretch "slnt" (slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing Any axis that is not on the list of registered axes is considered a custom axis. Custom axes do not have corresponding CSS font properties. Font des...
Examine and edit HTML - Firefox Developer Tools
nu 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 ... ...
... -- 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 ... ...
...rms this action. (Copy) Unique Selector/CSS Selector Copy a CSS selector that uniquely selects the element. (Copy) CSS Path Copy a CSS selector that represents the full path to the element. (Copy) Image Data-URL Copy image as a data:// URL, if the selected element is an image. (Copy) Attribute Copy the attribute of the element. Show DOM Properties Open the split console and enter the console command "inspect($0)" to inspect the currently selected element. Use in Console Assigns the currently selected node to a variable named temp0 (or temp1 if temp0 is already taken, and so on), then opens the split console, enabling you to interact with that node using the console's command line. Expand All In the tree view, exp...
Web Audio Editor - Firefox Developer Tools
ls. With the Web Audio API, developers create an audio context. Within that context they then construct a number of audio nodes, including: nodes providing the audio source, such as an oscillator or a data buffer source nodes performing transformations such as delay and gain nodes representing the destination of the audio stream, such as the speakers Each node has zero or more AudioParam properties that configure its operation. For example, the GainNode has a single gain property, while the OscillatorNode has frequency and detune properties. The developer connects the nodes in a graph, and the complete graph defines the behavior of the audio stream. The Web Audio Editor examines an audio context constructed in the page and provides a visualization of its graph. This gives you a high-level...
... developer connects the nodes in a graph, and the complete graph defines the behavior of the audio stream. The Web Audio Editor examines an audio context constructed in the page and provides a visualization of its graph. This gives you a high-level view of its operation, and enables you to ensure that all the nodes are connected in the way you expect. You can then examine and edit the AudioParam properties for each node in the graph. Some non-AudioParam properties, like an OscillatorNode's type property, are displayed, and you can edit these as well. This tool is still experimental. If you find bugs, we'd love it if you filed them in Bugzilla. If you have feedback or suggestions for new features, dev-developer-tools or Twitter are great places to register them. Opening the Web Audio Editor The W...
... 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. This list the values of that node's AudioParam properties. For example, here's what the OscillatorNode looks like: With the Violent Theremin demo, the frequency parameter is modified as the user moves the mouse left and right, and you can see this reflected in the node inspector. However, the value isn't updated in real time: you have to click the node again to see the updated value. If you click on a value in the node inspector you can modify it: pre...
AddressErrors - Web APIs
ccurred for the member of the same name in an address described using PaymentAddress. AddressErrors is the type of the object returned by shippingAddressErrors in the PaymentDetailsUpdate passed into PaymentRequestUpdateEvent.updateWith() by the shippingaddresschange event handler if a change to the address resulted in a validation error occurring. See the examples below to see how this works. Properties addressLine A DOMString which, if present, indicates that the addressLine property of the PaymentAddress could not be validated. The contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. city A DOMString which, if present, indicates that the city property of the PaymentAddress could not be validated. The conten...
...string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. sortingCode A DOMString which, if present, indicates that the sortingCode property of the PaymentAddress could not be validated. The contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. Obsolete properties These properties have been removed from the specification and should no longer be used. languageCode A DOMString which, if present, indicates that the languageCode property of the PaymentAddress could not be validated. The contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. Usage notes Keep in mind that s...
...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 trying to edit the address. Setting up the Donate Now button This code creates a handler for the load event on the window which in turn adds ...
AudioNode - Web APIs
Web › API › AudioNode
e free to use either constructors or factory methods, or mix both, however there are advantages to using the constructors: All parameters can be set during construction time and don't need to be set individually. You can sub-class an audio node. While the actual processing is done internally by the browser and cannot be altered, you could write a wrapper around an audio node to provide custom properties and methods. Slightly better performance: In both Chrome and Firefox, the factory methods call the constructors internally. Keep in mind that Microsoft Edge does not yet appear to support the constructors; it will throw a "Function expected" error when you use the constructors. Brief history: The first version of the Web Audio spec only defined the factory methods. After a design review in Oc...
... when you use the constructors. Brief history: The first version of the Web Audio spec only defined the factory methods. After a design review in October 2013, it was decided to add constructors because they have numerous benefits over factory methods. The constructors were added to the spec from August to October 2016. Factory methods continue to be included in the spec and are not deprecated. Properties AudioNode.context Read only Returns the associated BaseAudioContext, that is the object representing the processing graph the node is participating in. AudioNode.numberOfInputs Read only Returns the number of inputs feeding the node. Source nodes are defined as nodes having a numberOfInputs property with a value of 0. AudioNode.numberOfOutputs Read only Returns the number of outp...
... 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. AudioNode.disconnect() Allows us to disconnect the current node from another one it is already connected to. Example This simple snippet of code shows the creation of some audio nodes, and how the AudioNode properties and methods can be used. You can find examples of such usage on any of the examples linked to on the Web Audio API landing page (for example Violent Theremin.) const audioCtx = new AudioContext(); const oscillator = new OscillatorNode(audioCtx); const gainNode = new GainNode(audioCtx); oscillator.connect(gainNode).connect(audioCtx.destination); oscillator.context; oscillator.numberOfInputs; ...
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 an ima...
...round 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, then include the image we created using the CSS paint() function. ...
... Specifications Specification Status Comment CSS Painting API Level 1 Working Draft Initial definition. ...
CanvasRenderingContext2D - Web APIs
The Canvas tutorial has more explanation, examples, and resources, as well. ...
...t. CanvasRenderingContext2D.fillRect() Draws a filled rectangle at (x, y) position whose size is determined by width and height. CanvasRenderingContext2D.strokeRect() Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style. Drawing text The following methods draw text. See also the TextMetrics object for text properties. CanvasRenderingContext2D.fillText() Draws (fills) a given text at the given (x, y) position. 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 li...
...anvasRenderingContext2D.miterLimit Miter limit ratio. Default 10. CanvasRenderingContext2D.getLineDash() Returns the current line dash pattern array containing an even number of non-negative numbers. CanvasRenderingContext2D.setLineDash() Sets the current line dash pattern. CanvasRenderingContext2D.lineDashOffset Specifies where to start a dash array on a line. Text styles The following properties control how text is laid out. CanvasRenderingContext2D.font Font setting. Default value 10px sans-serif. CanvasRenderingContext2D.textAlign Text alignment setting. Possible values: start (default), end, left, right, center. CanvasRenderingContext2D.textBaseline Baseline alignment setting. Possible values: top, hanging, middle, alphabetic (default), ideographic, bottom. CanvasRenderingCon...
CustomEvent - Web APIs
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(). ...
... The CustomEvent interface represents events initialized by an application for any purpose. Note: This feature is available in Web 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 be...
...ut 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.initEvent). Obsolete properties Event.scoped Read only Obsolete; use composed instead. (A Boolean indicating whether the given event will bubble across through the shadow root into the standard DOM.) Methods CustomEvent.initCustomEvent() Initializes a CustomEvent object. If the event has already being dispatched, this method does nothing. This interface inherits methods from its parent, Event: Event.crea...
DOMPoint.fromPoint() - Web APIs
The static DOMPoint method fromPoint() creates and returns a new mutable DOMPoint object given a source point. The source point is specified as a DOMPointInit-compatible object, which includes both DOMPoint and DOMPointReadOnly. You can also create a new DOMPoint object using the new DOMPoint() constructor. ...
...t given a source point. The source point is specified as a DOMPointInit-compatible object, which includes both DOMPoint and DOMPointReadOnly. 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-o...
... 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. ...
DataTransfer.effectAllowed - Web APIs
ation. 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. ...
...en 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. ...
...hild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed); ev.preventDefault(); // Set the dropEffect to move ev.dataTransfer.dropEffect = "move" } </script> <body> <h1>Examples <code>DataTransfer</code>.{<code>dropEffect</code>, <code>effectAllowed</code>} properties</h1> <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.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">Drop Zone</div> </body> </html> Specifications Specification Status Comment HTML Li...
DataTransfer.items - Web APIs
ration and if the operation had no items, the list is empty. Syntax itemList = dataTransfer.items; Return value A DataTransferItemList object containing DataTransferItem objects representing the items being dragged in a drag operation, one list item for each object being dragged. If the drag operation had no data, the list is empty. Example This example shows the use of the items and types properties. ...
...fer.items; Return value A DataTransferItemList object containing DataTransferItem objects representing the items being dragged in a drag operation, one list item for each object being dragged. If the drag operation had no data, the list is empty. Example This example shows the use of the items and types properties. ...
...h; i++) { console.log("... ...
DataTransfer.types - Web APIs
ial-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. ...
...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. ...
...h; i++) { console.log("... ...
DataTransfer - Web APIs
he DataTransfer object is used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data 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 ...
...aTransfer.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. DataTransfer.items Read only Gives a DataTransferItemList object which is a list of all of the drag data. DataTransfer.types Read only An array of strings giving the formats 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 ...
...on. 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 DataTransfer.mozItemCount Read only Gives the number of items in the drag operation. Removed in Firefox 71. Methods Standard methods DataTransfer.clearData() Remove the data associated with a given type. The type argument is optional. If the type is empty or not specified, the data associated with all types is removed. If data for the specified type does not exist, or the data trans...
DedicatedWorkerGlobalScope - Web APIs
The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. ...
... The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. Properties This interface inherits properties from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements properties from WindowTimers, WindowBase64, and WindowEventHandlers. DedicatedWorkerGlobalScope.name Read only The name that the Worker was (optionally) given when it was created using the Worker() constructor. This is mainly useful for debugging purposes. Properties inherited from WorkerGlobalScope WorkerGlobalScope.self R...
...workers. WorkerGlobalScope.navigator Read only Returns the WorkerNavigator associated with the worker. WorkerNavigator is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers. WorkerGlobalScope.performance Read only Returns the Performance object associated with the worker, which is a regular performance object, but with a subset of its properties and methods available. Event handlers This interface inherits event handlers from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements event handlers from WindowTimers, WindowBase64, and WindowEventHandlers. DedicatedWorkerGlobalScope.onmessage Is an EventHandler representing the code to be called when the message event is raised. These events are of type M...
Element.computedStyleMap() - Web APIs
eturn back a definition list of all the CSS property values using computedStyleMap(). ...
...I...
...Styles) { // 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 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. Workin...
Event - Web APIs
Web › API › Event
ated by APIs to represent the progress of an asynchronous task. It can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. Many DOM elements can be set up to accept (or "listen" for) these events, and execute code in response to process (or "handle") them. Event-handlers are usually connected (or "attached") to various HTML elements (such as <button>, <div>, <span>, etc.) using EventTarget.addEventListener(), and this generally replaces using the old HTML event handler att...
...teEvent PointerEvent PopStateEvent ProgressEvent RelatedEvent RTCDataChannelEvent RTCIdentityErrorEvent RTCIdentityEvent RTCPeerConnectionIceEvent SensorEvent StorageEvent SVGEvent SVGZoomEvent 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 indica...
... 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.initEvent). Deprecated properties Event.scoped Read only A Boolean indicating whether the given event will bubble across through the shadow root into the standard DOM. Use composed instead. Methods Event.composedPath() Returns the event's path (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. Event.preventDefau...
EventTarget.addEventListener() - Web APIs
ort In older versions of the DOM specification, the third parameter of addEventListener() was a Boolean value indicating whether or not to use capture. Over time, it became clear that more options were needed. Rather than adding more parameters to the function (complicating things enormously when dealing with optional values), the third parameter was changed to an object that can contain various properties defining the values of options to configure the process of removing the event listener. Because older browsers (as well as some not-too-old browsers) still assume the third parameter is a Boolean, you need to build your code to handle this scenario intelligently. You can do this by using feature detection for each of the options you're interested in. For example, if you want to check for the pa...
..., within the same outer scope. Why? Simply because by the time the event listener would execute, the scope in which it was defined would have already finished executing. Getting data into and out of an event listener using objects Unlike most functions in JavaScript, objects are retained in memory as long as a variable referencing them exists in memory. ...
...sing objects Unlike most functions in JavaScript, objects are retained in memory as long as a variable referencing them exists in memory. This, and the fact that objects can have properties, and that they can be passed around by reference, makes them likely candidates for sharing data among scopes. Let's explore this. Note: Functions in JavaScript are actually objects. (Hence they too can have properties, and will be retained in memory even after they finish executing if assigned to a variable that persists in memory.) Because object properties can be used to store data in memory as long as a variable referencing the object exists in memory, you can actually use them to get data into an event listener, and any changes to the data back out after an event handler executes. Consider this example. ...
FileSystemDirectoryEntry - Web APIs
Methods This interface inherits methods from its parent interface, FileSystemEntry. createReader() Creates a FileSystemDirectoryReader object which can be used to read the entries in this directory. getDirectory() Returns a FileSystemDirectoryEntry object representing a direct...
... Methods This interface inherits methods from its parent interface, FileSystemEntry. createReader() Creates a FileSystemDirectoryReader object which can be used to read the entries in this directory. getDirectory() Returns a FileSystemDirectoryEntry object representing a directory located at a given path, relat...
... Methods This interface inherits methods from its parent interface, FileSystemEntry. createReader() Creates a FileSystemDirectoryReader object which can be used to read the entries in this directory. getDirectory() Returns a FileSystemDirectoryEntry object representing a directory located at a given path, relative to the directory on which the me...
Using the Gamepad API - Web APIs
) This can then be used to get the same information. For example, the first code example above you be rewritten as shown below: window.addEventListener("gamepadconnected", function(e) { var gp = navigator.getGamepads()[e.gamepad.index]; console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", gp.index, gp.id, gp.buttons.length, gp.axes.length); }); The Gamepad object's properties are as follows: id: A string containing some information about the controller. This is not strictly specified, but in Firefox it will contain three pieces of information separated by dashes (-): two 4-digit hexadecimal strings containing the USB vendor and product id of the controller, and the name of the controller as provided by the driver. This information is intended to allow you to find a...
...ly 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 that this property is not currently supported in Firefox. Note: The Gamepad object is available on the gamepadconnected event rather than the Window object itself, for security reasons. Once we have a reference to it, we can query its properties for information about the current state of the gamepad. Behind the scenes, this object will be updated every time the gamepad's state changes. Using button information Let's look at a simple example that displays connection information for one gamepad (it ignores subsequent gamepad connections) and allows you to move a ball around the screen using the four gamepad buttons on the right hand sid...
...ndex " + gp.index + ": " + gp.id + ". It has " + gp.buttons.length + " buttons and " + gp.axes.length + " axes."; gameLoop(); clearInterval(interval); } } } Now on to the main game loop. In each execution of the loop we check if one of four buttons is being pressed; if so, we update the values of the a and b movement variables appropriately, then update the left and top properties, changing their values to the current values of a and b respectively. This has the effect of moving the ball around the screen. In current versions of Chrome (version 34 as of this writing) the button values are stored as an array of double values, instead of GamepadButton objects. This is fixed in development versions. After all this is done, we use our requestAnimationFrame() to request the n...
HTMLAudioElement - Web APIs
The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It's based on, and inherits properties and methods from, the HTMLMediaElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">E...
...t-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLAudioElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor Audio() Creates and returns a new HTMLAudioElement object, optionally starting the process of loading an audio file into it if the file URL is given. Properties No specific properties; inherits properties from its parent, HTMLMediaElement, and from HTMLElement. Methods Inherits methods from its parent, HTMLMediaElement, and from HTMLElement. It offers no methods of its own. Obsolete Mozilla-only methods The following methods are non-standard and should not be used. mozCurrentSampleOffset() Returns the number of samples form the beginning of...
... the Audio() constructor: var audioElement = new Audio('car_horn.wav'); then you can invoke the play() method on the element audioElement.play(); A common gotcha is trying to play an audio element immediately on page load. Modern browser's default autoplay policy will block that from happening. Refer to firefox and chrome for best practices and work arounds. Some of the more commonly used properties of the audio element include src, currentTime, duration, paused, muted, and volume. This snippet copies the audio file's duration to a variable: var audioElement = new Audio('car_horn.wav'); audioElement.addEventListener('loadeddata', () => { let duration = audioElement.duration; // The duration variable now holds the duration (in seconds) of the audio clip }) Events Inherits methods fr...
HTMLBaseElement - Web APIs
The HTMLBaseElement interface contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 1...
... HTMLBaseElement.href Is a DOMString that reflects the href HTML attribute, containing a base URL for relative URLs in the document. HTMLBaseElement.target Is a DOMString that reflects the target HTML attribute, containing a default target browsing context or frame for elements that do not have a target reference specified. Methods No spe...
... HTMLBaseElement.href Is a DOMString that reflects the href HTML attribute, containing a base URL for relative URLs in the document. HTMLBaseElement.target Is a DOMString that reflects the target HTML attribute, containing a default target browsing context or frame for elements that do not have a target reference specified. Methods No specific method; inherit...
HTMLButtonElement - Web APIs
The HTMLButtonElement interface provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyli...
... HTMLButtonElement.accessKey Is a DOMString indicating the single-character keyboard key to give access to the button. HTMLButtonElement.autofocus Is a Boolean indicating whether or not the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated...
... HTMLButtonElement.accessKey Is a DOMString indicating the single-character keyboard key to give access to the button. HTMLButtonElement.autofocus Is a Boolean indicating whether or not the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a documen...
HTMLCanvasElement - Web APIs
The HTMLCanvasElement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface. <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="#4D4E53" text-anchor="middle...
... 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 ...
... 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 <c...
HTMLCollection - Web APIs
Note: This interface is called HTMLCollection for historical reasons (before the modern DOM, collections implementing this interface could only have HTML elements as their items). An HTMLCollection in the HTML DOM is live; it is automatically updated when the underlying document is changed. Properties HTMLCollection.length Read only Returns the number of items in the collection. ...
...rguments) of elements (in document order) and offers methods and properties for selecting from the list. Note: This interface is called HTMLCollection for historical reasons (before the modern DOM, collections implementing this interface could only have HTML elements as their items). An HTMLCollection in the HTML DOM is live; it is automatically updated when the underlying document is changed. Properties HTMLCollection.length Read only Returns the number of items in the collection. Methods HTMLCollection.item() Returns the specific node at the given zero-based index into the list. Returns null if the index is out of range. An alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations. ...
... only done as a last resort, only in HTML, and only if the referenced element supports the name attribute. Returns null if no node exists by the given name. An alternative to accessing collection[name] (which instead returns undefined when name does not exist). This is mostly useful for non-JavaScript DOM implementations. Usage in JavaScript HTMLCollection also exposes its members directly as properties by both name and index. HTML IDs may contain : and . as valid characters, which would necessitate using bracket notation for property access. Currently HTMLCollections does not recognize purely numeric IDs, which would cause conflict with the array-style access, though HTML5 does permit these. For example, assuming there is one <form> element in the document and its id is myForm: var elem1, ele...
HTMLDListElement - Web APIs
The HTMLDListElement interface provides special properties (beyond those of the regular HTMLElement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget...
... HTMLDListElement.compact Is a Boolean indicating that spacing between list items should be reduced. Methods No specific methods; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLDListElement' in that specification. Living Sta...
... HTMLDListElement.compact Is a Boolean indicating that spacing between list items should be reduced. Methods No specific methods; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLDListElement' in that specification. Living Standard H...
HTMLDataElement - Web APIs
The HTMLDataElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <data> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline point...
... 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...
... 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. Li...
HTMLDataListElement - Web APIs
The HTMLDataListElement interface provides special properties (beyond the HTMLElement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</te...
... Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLDataListElement' in that specifica...
... Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLDataListElement' in that specification. Living Stand...
HTMLDetailsElement - Web APIs
The HTMLDetailsElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <details> elements. <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/HTMLDetailsElement" 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">HTMLDetailsElement</t...
... HTMLDetailsElement.open Is a boolean reflecting the open HTML attribute, indicating whether or not the element's contents (not counting the <summary>) is to be shown to the user. Methods No specific method; inherits methods from its parent, HTMLElement. Events Listen to this event using addEventListener() or by assigning an event listene...
... HTMLDetailsElement.open Is a boolean reflecting the open HTML attribute, indicating whether or not the element's contents (not counting the <summary>) is to be shown to the user. Methods No specific method; inherits methods from its parent, HTMLElement. Events Listen to this event using addEventListener() or by assigning an event listener to the oneventname ...
HTMLDialogElement - Web APIs
The HTMLDialogElement interface provides methods to manipulate <dialog> elements. It inherits properties and methods from the HTMLElement interface. <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/HTMLDialogElement" target="_top"><rect x="1" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="86" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLDialogElement</text></a></svg></div> a:...
... 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 optiona...
... 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 pa...
HTMLDivElement - Web APIs
The HTMLDivElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <div> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points=...
... 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 Specificatio...
... 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 Commen...
HTMLHeadElement - Web APIs
The HTMLHeadElement interface contains the descriptive information, or metadata, for a document. This object inherits all of the properties and methods described in the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><...
... HTMLHeadElement.profile Is a DOMString representing the URIs of one or more metadata profiles (white space separated). Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHeadElement' in that specificati...
... HTMLHeadElement.profile Is a DOMString representing the URIs of one or more metadata profiles (white space separated). Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLHeadElement' in that specification. Living Standar...
HTMLHeadingElement - Web APIs
The HTMLHeadingElement interface represents the different heading elements, <h1> through <h6>. It inherits methods and properties from the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="11...
... 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 S...
... 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 ...
HTMLHtmlElement - Web APIs
You can retrieve the HTMLHtmlElement object for a given document by reading the value of the document.documentElement property. ...
... HTMLHtmlElement.version Is a DOMString representing the version of the HTML Document Type Definition (DTD) that governs this document. This property should not be used any more as it is non-conforming. Simply omit it. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Sta...
... HTMLHtmlElement.version Is a DOMString representing the version of the HTML Document Type Definition (DTD) that governs this document. This property should not be used any more as it is non-conforming. Simply omit it. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment ...
HTMLImageElement.border - Web APIs
The obsolete HTMLImageElement property border specifies the number of pixels thick the border surrounding the image should be. A value of 0, the default, indicates that no border should be drawn. You should not use this property! Instead, you should use CSS to style the border. The border property or its longhand properties to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. ...
...his 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. 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 ...
...ess; 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 example, if you have the following HTML: <img src="image.png" border="2"> The following will provide the same appearance using CSS instead of this obsolete property: <img src="image.png" style="border: 2px;"> You can further provide additional information to change the color and other features of the border: <img src="image.png" style="border: dashed ...
HTMLImageElement.x - Web APIs
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>. ...
... 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 showing information about users of a web site, including their user ID, their full name, and their avatar image. <table id="userinfo"> <colgroup> <col span="2" class="group1"> <col> </colgroup> <tr> <th>UserID</th> <th>Name</th> <th>Avatar</th> </tr> <tr> <td>12345678</td> <td>Johnny Rocket</td> <td><img sr...
...at <tr> (table row) element's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. CSS The CSS defining the appearance of the table: .group1 { background-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } Result The resulting table looks like this: Specifications Specification ...
HTMLImageElement.y - Web APIs
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>. ...
... 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 showing information about users of a web site, including their user ID, their full name, and their avatar image. <table id="userinfo"> <colgroup> <col span="2" class="group1"> <col> </colgroup> <tr> <th>UserID</th> <th>Name</th> <th>Avatar</th> </tr> <tr> <td>12345678</td> <td>Johnny Rocket</td> <td><img sr...
...at <tr> (table row) element's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. CSS The CSS defining the appearance of the table: .group1 { background-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } Result The resulting table looks like this: Specifications Specification ...
HTMLLabelElement - Web APIs
The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 ...
... HTMLLabelElement.control Read only Is a HTMLElement representing the control with which the label is associated. HTMLLabelElement.form Read only Is a HTMLFormElement object representing the form with which the labeled control is associated, or null if there is no associated control, or if that control isn't associated with a form. In othe...
... HTMLLabelElement.control Read only Is a HTMLElement representing the control with which the label is associated. HTMLLabelElement.form Read only Is a HTMLFormElement object representing the form with which the labeled control is associated, or null if there is no associated control, or if that control isn't associated with a form. In other words, this is just...
HTMLLegendElement - Web APIs
The HTMLLegendElement is an interface allowing to access properties of the <legend> elements. It inherits properties and methods from the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20...
... 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...
... 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 acc...
HTMLMapElement - Web APIs
The HTMLMapElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. <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="#4D4E53" text-anchor="middle"...
... 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; inhe...
... 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...
HTMLMarqueeElement - Web APIs
The HTMLMarqueeElement interface provides methods to manipulate <marquee> elements. It inherits properties and methods from the HTMLElement interface. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/HTMLMarqueeElement" 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">HTMLMarqueeElement</text></a></svg><...
... 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...
... 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. ...
HTMLMetaElement - Web APIs
The HTMLMetaElement interface contains descriptive metadata about a document. It inherits all of the properties and methods described in the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121...
... 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...
... 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 Ge...
HTMLMeterElement - Web APIs
The HTML <meter> elements expose the HTMLMeterElement interface, which provides special properties and methods (beyond the HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. <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="#4D4E5...
... 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 r...
... 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 va...
HTMLModElement - Web APIs
The HTMLModElement interface provides special properties (beyond the regular methods and properties available through the HTMLElement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. <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="#4D4E53" text-a...
... HTMLModElement.cite Is a DOMString reflecting the cite HTML attribute, containing a URI of a resource explaining the change. HTMLModElement.dateTime Is a DOMString reflecting the datetime HTML attribute, containing a date-and-time string representing a timestamp for the change. Specifications Specification Status Comment ...
... HTMLModElement.cite Is a DOMString reflecting the cite HTML attribute, containing a URI of a resource explaining the change. HTMLModElement.dateTime Is a DOMString reflecting the datetime HTML attribute, containing a date-and-time string representing a timestamp for the change. Specifications Specification Status Comment HTML Living S...
HTMLOListElement - Web APIs
The HTMLOListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating ordered list elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">Ev...
... 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 val...
... 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 typ...
HTMLOptGroupElement - Web APIs
The HTMLOptGroupElement interface provides special properties and methods (beyond the regular HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. <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="#4D4E53" text-anchor="middle" al...
... HTMLOptGroupElement.disabled Is a boolean representing whether or not the whole list of children <option> is disabled (true) or not (false). HTMLOptGroupElement.label Is a DOMString representing the label for the group. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification S...
... HTMLOptGroupElement.disabled Is a boolean representing whether or not the whole list of children <option> is disabled (true) or not (false). HTMLOptGroupElement.label Is a DOMString representing the label for the group. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment ...
HTMLOutputElement - Web APIs
The HTMLOutputElement interface provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of <output> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="11...
... 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 DOMTokenLi...
... 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, con...
HTMLParagraphElement - Web APIs
The HTMLParagraphElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <p> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points=...
... 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 Specific...
... 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 Co...
HTMLPictureElement - Web APIs
The HTMLPictureElement interface represents a <picture> HTML element. It doesn't implement specific properties or methods. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D...
... Methods No specific method, but inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLPictureElement' in that specification. Living Standard Initial definition ...
... Methods No specific method, but inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLPictureElement' in that specification. Living Standard Initial definition ...
HTMLSourceElement - Web APIs
The HTMLSourceElement interface provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating <source> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><pol...
... HTMLSourceElement.media Is a DOMString reflecting the media HTML attribute, containing the intended type of the media resource. HTMLSourceElement.sizes Is a DOMString representing image sizes between breakpoints HTMLSourceElement.src Is a DOMString reflecting the src HTML attribute, containing the URL for the media resource. The HTMLSou...
... HTMLSourceElement.media Is a DOMString reflecting the media HTML attribute, containing the intended type of the media resource. HTMLSourceElement.sizes Is a DOMString representing image sizes between breakpoints HTMLSourceElement.src Is a DOMString reflecting the src HTML attribute, containing the URL for the media resource. The HTMLSourceElement.src proper...
HTMLTableColElement - Web APIs
The HTMLTableColElement interface provides special properties (beyond the HTMLElement interface it also has available to it inheritance) for manipulating single or grouped table column elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></...
... HTMLTableColElement.align Is a DOMString that indicates the horizontal alignment of the cell data in the column. HTMLTableColElement.ch Is a DOMString representing the alignment character for cell data. HTMLTableColElement.chOff Is a DOMString representing the offset for the alignment character. HTMLTableColElement.span Is an u...
... HTMLTableColElement.align Is a DOMString that indicates the horizontal alignment of the cell data in the column. HTMLTableColElement.ch Is a DOMString representing the alignment character for cell data. HTMLTableColElement.chOff Is a DOMString representing the offset for the alignment character. HTMLTableColElement.span Is an unsigned long that ref...
HTMLTableSectionElement - Web APIs
The HTMLTableSectionElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an HTML table. <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="#4D4...
... 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 th...
... 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...
HTMLTextAreaElement - Web APIs
The HTMLTextAreaElement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" ...
... autocapitalize string: Returns / Sets the element's capitalization behavior for user input. Valid values are: none, off, characters, words, sentences. autocomplete autofocus boolean: Returns / Sets the element's autofocus attribute, indicating that the control should have inpu...
...is a candidate for constraint validation. false if any conditions bar it from constraint validation, including its readOnly or disabled property is true. wrap string: Returns / Sets the wrap HTML attribute, indicating how the control wraps text. HTMLTextAreaElement.labelsRead only NodeList: Returns a list of label elements associated with this element. The two properties tabIndex and accessKey are inherited from HTMLElement from HTML5 on, but were defined on HTMLTextAreaElement in DOM Level 2 HTML and earlier specifications. Methods blur() Removes focus from the control; keystrokes will subsequently go nowhere. focus() Gives focus to the control; keystrokes will subsequently go to this element. select() Selects the contents o...
HTMLTimeElement - Web APIs
The HTMLTimeElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <time> elements. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline point...
... 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 'H...
... 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 th...
HTMLTitleElement - Web APIs
The HTMLTitleElement interface contains the title for a document. This element inherits all of the properties and methods of the HTMLElement interface. <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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 ...
... HTMLTitleElement.text Is a DOMString representing the text of the document's title. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTitleElement' in that specification. Living Standard ...
... HTMLTitleElement.text Is a DOMString representing the text of the document's title. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTitleElement' in that specification. Living Standard HTML 5.1The definiti...
IDBRequest - Web APIs
to results of asynchronous requests to databases and database objects using event handler attributes. Each reading and writing operation on a database is done using a request. The request object does not initially contain any information about the result of the operation, but once information becomes available, an event is fired on the request, and the information becomes available through the properties of the IDBRequest instance. All asynchronous operations immediately return an IDBRequest instance. Each request has a readyState that is set to the 'pending' state; this changes to 'done' when the request is completed or fails. When the state is set to done, every request returns a result and an error, and an event is fired on the request. When the state is still pending, any attempt to access t...
... IDBRequest.error Read only Returns a DOMException in the event of an unsuccessful request, indicating what went wrong. IDBRequest.result Read only Returns the result of the request. If the the request failed and the result is not available, an InvalidStateError exception is thrown. IDBRequest.source Read only The source of the request, su...
... IDBRequest.error Read only Returns a DOMException in the event of an unsuccessful request, indicating what went wrong. IDBRequest.result Read only Returns the result of the request. If the the request failed and the result is not available, an InvalidStateError exception is thrown. IDBRequest.source Read only The source of the request, such as an IDBIndex or an ID...
IDBVersionChangeEvent - Web APIs
IDBVersionChangeEvent.oldVersion Read only Returns the old version of the database. IDBVersionChangeEvent.newVersion Read only Returns the new version of the database. ...
... The IDBVersionChangeEvent interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. Note: This feature is available in Web Workers. Properties Also inherits properties from its parent, Method. IDBVersionChangeEvent.oldVersion Read only Returns the old version of the database. IDBVersionChangeEvent.newVersion Read only Returns the new version of the database. Deprecated properties IDBVersionChangeEvent.version Read only 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 w...
... Example In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. Upon a version change (after an upgradedneeded event), the success event will implement the IDBVersionChangeEvent interface. ...
Basic concepts - Web APIs
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 provides lots of objects that represent indexes, tables, cursors, and so on, but eac...
...nd the type of event you get lets you know if the operation succeeded or failed. This sounds a little complicated at first, but there are sanity measures baked in. It's not that different from the way that XMLHttpRequest works. IndexedDB uses a lot of requests. Requests are objects that receive the success or failure DOM events that were mentioned previously. 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).
... following: an empty string, a JavaScript identifier, or multiple JavaScript identifiers separated by periods or an array containing any of those. It cannot include spaces. value Each record has a value, which could include anything that can be expressed in JavaScript, including boolean, number, string, date, object, array, regexp, undefined, and null. When an object or array is stored, the properties and values in that object or array can also be anything that is a valid value. Blobs and files can be stored, cf. specification . Range and scope scope The set of object stores and indexes to which a transaction applies. The scopes of read-only transactions can overlap and execute at the same time. On the other hand, the scopes of writing transactions cannot overlap. You can still start...
Using IndexedDB - Web APIs
eneeded is the only place where you can alter the structure of the database. In it, you can create and delete object stores and build and remove indices. Object stores are created with a single call to createObjectStore(). The method takes a name of the store, and a parameter object. Even though the parameter object is optional, it is very important, because it lets you define important optional properties and refine the type of object store you want to create. In our case, we've asked for an object store named "customers" and defined a keyPath, which is the property that makes an individual object in the store unique. That property in this example is "ssn" since a social security number is guaranteed to be unique. "ssn" must be present on every object that is stored in the objectStore. We've a...
...e'll get to in a minute. Second, you can specify the direction that you want to iterate. In the above example, we're iterating over all objects in ascending order. The success callback for cursors is a little special. The cursor object itself is the result of the request (above we're using the shorthand, so it's event.target.result). Then the actual key and value can be found on the key and value properties of the cursor object. If you want to keep going, then you have to call continue() on the cursor. When you've reached the end of the data (or if there were no entries that matched your openCursor() request) you still get a success callback, but the result property is undefined. One common pattern with cursors is to retrieve all objects in an object store and add them to an array, like this: var ...
... client-side JavaScript, which is not very efficient. This new functionality enables developers to specify a locale when creating an index using IDBObjectStore.createIndex() (check out its parameters.) In such cases, when a cursor is then used to iterate through the dataset, and you want to specify locale-aware sorting, you can use a specialized IDBLocaleAwareKeyRange. ...
Timing element visibility with the Intersection Observer API - Web APIs
ld(adBox); } adObserver.observe(adBox); } First is the array ads. This array contains the data needed to create each ad. We have four here to choose from at random. In a real-world scenario, of course, the ads would come from a database or, more likely, an advertising service from which you fetch ads using an API. However, our needs are simple: each ad is represented by an object with three properties: a background color (bgcolor), a title (title), and a body text string (body). Then we define several variables: adBox This will be set to the element that represents the ad. For new ads being appended to the page, this is created using Document.createElement(). When replacing an existing ad, this is set to the specified ad element (replaceBox). title Will hold the <h2> element representin...
... we begin by ending observation of the element by calling IntersectionObserver.unobserve(). Then the local variables for each of the elements that comprise an ad: the ad box itself, the title, the body, and the timer box, are all set to the corresponding elements in the existing ad. If no value is specified for replaceBox, we create a new ad element. The ad's new <div> element is created and its properties established by setting its class name to "ad". Next, the ad title element is created, along with the body and the visibility timer; these are an <h2>, a <p>, and a <div> element, respectively. These elements are appended to the adBox element. After that, the code paths converge once again. The ad's background color is set to the value specified in the new ad's record, and elements' classes and c...
...ted, along with the body and the visibility timer; these are an <h2>, a <p>, and a <div> element, respectively. These elements are appended to the adBox element. After that, the code paths converge once again. The ad's background color is set to the value specified in the new ad's record, and elements' classes and contents are set appropriately as well. Next, it's time to set up the custom data properties to track the ad's visibility data by setting adBox.dataset.totalViewTime and adBox.dataset.lastViewStarted to 0. Finally, we set the ID of the <div> which will show the timer we'll present in the ad to show how long it's been visible, giving it the class "timer". The initial text is set to "0:00", to represent the starting time of 0 minutes and 0 seconds, and it's appended to the ad. If we're n...
KeyboardEvent - Web APIs
e key is located on the numeric keypad, or is a virtual key associated with the numeric keypad if there's more than one place the key could originate from. The NumLock key does not fall into this group and is always encoded with the location DOM_KEY_LOCATION_STANDARD. Examples include the digits on 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 t...
...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 Dvorak keyboard 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 R...
...s created. Obsolete methods KeyboardEvent.initKeyEvent() Initializes a KeyboardEvent object. This was implemented only by Firefox, and is no longer supported even there; instead, you should use the KeyboardEvent() constructor. KeyboardEvent.initKeyboardEvent() Initializes a KeyboardEvent object. This is now deprecated. You should instead use the KeyboardEvent() constructor. Obsolete properties KeyboardEvent.char Read only Returns a DOMString representing the character value of the key. If the key corresponds to a printable character, this value is a non-empty Unicode string containing that character. If the key doesn't have a printable representation, this is an empty string. Note: If the key is used as a macro that inserts multiple characters, this attribute's value is the ent...
Lock - Web APIs
Web › API › Lock
The mode is either "exclusive" (the default) or "shared". Lock.name Read only Returns the name passed to LockManager.request() when the lock was requested. Examples The following examples show how the mode and name properties are passed in the call to LockManager.request(). LockManager is the object returned by navigator.locks. ...
...ch is received in the callback to LockManager.request(). Properties Lock.mode Read only Returns the access mode passed to LockManager.request() when the lock was requested. The mode is either "exclusive" (the default) or "shared". Lock.name Read only Returns the name passed to LockManager.request() when the lock was requested. ...
...as requested. The mode is either "exclusive" (the default) or "shared". Lock.name Read only Returns the name passed to LockManager.request() when the lock was requested. Examples The following examples show how the mode and name properties are passed in the call to LockManager.request(). LockManager is the object returned by navigator.locks. navigator.locks.request("net_db_sync", show_lock_properties); navigator.locks.request("another_lock", {mode: "shared"}, 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 Specification Status Comment Web Locks APIThe definition of 'Lock' in that specification. Draft Initial definition. ...
MathMLElement - Web APIs
The MathMLElement interface represents any MathML element. ...
... The MathMLElement interface represents any MathML element. ...
... The MathMLElement interface represents any MathML element. ...
MediaStreamTrack.getConstraints() - Web APIs
The getConstraints() method of the MediaStreamTrack interface returns a MediaTrackConstraints object containing the set of constraints most recently established for the track using a prior call to applyConstraints(). These constraints indicate values and ranges of values that the Web site or application has specified are required or acceptable for the included constrainable properties. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high definition video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or ranges of sizes. See Capabilities, constraints, and settings for details on how to work with constrainable pro...
...me 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. Even if any of the constraints couldn't be met, they are still included in ...
... Example This example obtains the current constraints for a track, sets the facingMode, and applies the updated constraints. ...
MediaTrackSupportedConstraints - Web APIs
An object conforming to MediaTrackSupportedConstraints is returned by MediaDevices.getSupportedConstraints(). Because of the way interface definitions in WebIDL work, if a constraint is requested but not supported, no error will occur. ...
...use getSupportedConstraints() to retrieve this information before attempting to establish constraints if you need to know the difference between silently 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. 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 constrai...
...raint is supported in the current environment. channelCount A Boolean value whose value is true if the channelCount constraint is supported in the current environment. deviceId A Boolean value whose value is true if the deviceId constraint is supported in the current environment. groupId A Boolean value whose value is true if the groupId constraint is supported in the current environment. Properties specific to shared screen tracks For tracks containing video sources from the user's screen contents, the following additional properties are may be included in addition to those available for video tracks. cursor A Boolean value which is true if the cursor constraint is supported in the current environment. displaySurface A Boolean value which is true if the cursor constraint is sup...
Using the Media Capabilities API - Web APIs
es, frame rates, and other such details. With the Media Capabilities API, you can determine not just if the browser can support a given format, but whether or not it can do so efficiently and smoothly. In short, this API replaces--and improves upon--the MediaSource method isTypeSupported() or the HTMLMediaElement method canPlayType(). More and more finely-detailed information about the display's properties, so that informed decisions can be made when choosing the best format to play on the user's device. For example, you can use the API to ensure that you don't try to play High Dynamic Range (HDR) content on a Standard Dynamic Range (SDR) screen. Support for getting real-time feedback about the playback of media, so your code can make informed decisions about adapting the stream's quality or other...
...yed per second of time when playing the video. ...
...determine if a video matching this configuration would be decodable and if the playback would be smooth and 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. Handling the response Instead of the assigning the promise to a variable, we can output the values returned by the promise to the console: navigator.mediaCapabilities.decodingInfo(videoConfiguration).then(result => { console.log('This configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerEfficient ? ...
NodeList - Web APIs
Web › API › NodeList
Although NodeList is not an Array, it is possible to iterate over it with forEach(). It can also be converted to a real Array using Array.from(). However, some older browsers have not implemented NodeList.forEach() nor Array.from(). This can be circumvented by using Array.prototype.forEach() -- see this document's Example. Live vs. Static NodeLists Although they are both considered NodeLists, there are 2 varieties of NodeList: live and static. Live NodeLists In some cases, the NodeList is live, which means that changes in the DOM automatically update the collection. ...
..._nodes.length); // outputs "3" Static NodeLists In other cases, the NodeList is static, where any changes in the DOM does not affect the content of the collection. The ubiquitous document.querySelectorAll() method returns a static NodeList. It's good to keep this distinction in mind when you choose how to iterate over the items in the NodeList, and whether you should cache the list's length. Properties NodeList.length The number of nodes in the NodeList. Methods NodeList.item() Returns an item in the list by its index, or null if the index is out-of-bounds. An alternative to accessing nodeList[i] (which instead returns undefined when i is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations. NodeList.entries() Returns an iterator, allowing code to go throug...
...List.values() Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection. Example It's possible to loop over the items in a NodeList using a for loop: for (let i = 0; i < myNodeList.length; i++) { let item = myNodeList[i]; } Don't use for...in to enumerate the items in NodeLists, since they will also enumerate its length and item properties and cause errors if your script assumes it only has to deal with element objects. Also, for..in is not guaranteed to visit the properties in any particular order. for...of loops will loop over NodeList objects correctly: const list = document.querySelectorAll('input[type=checkbox]'); for (let checkbox of list) { checkbox.checked = true; } Recent browsers also support iterator methods (forEac...
Notification - Web APIs
s available in Web Workers. The Notification interface of the Notifications API is used to configure and display desktop notifications to the user. These notifications' appearance and specific functionality vary across 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 therefo...
...ion.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.actions Read only The actions array of the notification as specified in the constructor's options parameter. Notification.badge Read only The URL of the image used to represent the notification when there is not enough space to display the notification itself. Notification.body Read only The body...
... error event. It is triggered each time the notification encounters an error. Notification.onshow A handler for the show event. It is triggered when the notification is displayed. Methods Static methods These methods are available only on the Notification object itself. Notification.requestPermission() Requests permission from the user to display notifications. Instance methods These properties are available only on an instance of the Notification object or through its prototype. The Notification object also inherits from the EventTarget interface. Notification.close() Programmatically closes a notification instance. Examples Assume this basic HTML: <button onclick="notifyMe()">Notify me!</button> It's possible to send a notification as follows -- here we present a fairly verbo...
ParentNode - Web APIs
It's implemented by Element, Document, and DocumentFragment objects. See Locating DOM elements using selectors to learn how to use CSS selectors to find nodes or elements of interest. Properties ParentNode.childElementCount Read only Returns the number of children of this ParentNode which are elements. ParentNode.children Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ...
...dren() Replaces the existing children of a node with a specified new set of children. Specification Specification Status Comment DOMThe definition of 'ParentNode' in that specification. Living Standard Split the ElementTraversal interface into ChildNode and ParentNode. ...
...ementChild, and ParentNode.childElementCount properties are now defined on the latter. Added the ParentNode.children property, and the ParentNode.querySelector(), ParentNode.querySelectorAll(), ParentNode.append(), and ParentNode.prepend() methods. Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Added the initial definition of its properties to the ElementTraversal pure interface and used it on Element. ...
PaymentAddress - Web APIs
The PaymentAddress interface of the Payment Request API is used to store shipping or payment address information. It may be useful to refer to the Universal Postal Union web site's Addressing S42 standard materials, which provide information about international standards for postal addresses. Properties PaymentAddress.addressLine Read only An array of DOMString objects providing each line of the address not included among the other properties. The exact size and content varies by country or location and can include, for example, a street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box number. PaymentAddress.country Read only A DOMString specifying the country in which the address is located, using the ISO-3166-1 alpha-2 s...
...ple a state, province, 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 localizati...
...till 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 display of the address. Methods PaymentAddress.toJSON() A standard serializer that returns a JSON representation of the PaymentAddress object's properties. Examples In the following example, the PaymentRequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. The first of these thre...
PaymentResponse.retry() - Web APIs
The PaymentResponse interface's retry() method makes it possible to ask the user to retry a payment after an error occurs during processing. This lets your app gracefully deal with situations such as invalid shipping addresses or declined credit cards. ...
... payer Optional A PayerErrors compliant object which provides appropriate error messages for any of the fields describing the payer which failed validation. ...
... 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. ...
PerformanceEntry - Web APIs
licit point in an application. Performance entries 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 ...
...ry.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 var p = performance.getEntries(); for (var i=0; i < p.length; i++) { console.log("PerformanceEntry[" + i + "]"); print_PerformanceEntry(p[i]); } } function print_PerformanceEntry(perfEntry) { var pro...
...es() to get a list of all performance entries var p = performance.getEntries(); for (var i=0; i < p.length; i++) { console.log("PerformanceEntry[" + i + "]"); print_PerformanceEntry(p[i]); } } function print_PerformanceEntry(perfEntry) { var properties = ["name", "entryType", "startTime", "duration"]; 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] + " is NOT supported"); } } } Specifications Specification Status Comment Resource Timing Level 3 ...
PerformanceResourceTiming - Web APIs
The PerformanceResourceTiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc.. Additionally, the interface extends PerformanceEntry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. <div id="interfaceDiagram" style="display: in...
..." y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="326" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceResourceTiming</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Note: This feature is available in Web 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 ...
... 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. PerformanceResourceTiming.initiatorTypeRead only A string representing the type of resource that initiated the performance entry, as specified in PerformanceResourceTiming.initiator...
PointerEvent - Web APIs
dinate (or set of coordinates) on the contact surface such as a screen. A pointer's hit test is the process a browser uses to determine the target element for a pointer event. Typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. Constructors PointerEvent() Creates a synthetic--and untrusted--PointerEvent. Properties This interface inherits properties from MouseEvent and Event. PointerEvent.pointerId Read only A unique identifier for the pointer causing the event. PointerEvent.width Read only The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. PointerEvent.height Read only The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the po...
... For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer. pointermove This event is fired when a pointer changes coordinates. pointerrawupdate This event is fired when any of a pointer's properties change. pointerup This event is fired when a pointer is no longer active. pointercancel A browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactived). pointerout This event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event f...
... Pointer EventsThe definition of 'PointerEvent' in that specification. Obsolete Initial definition. ...
Pointer Lock API - Web APIs
it stops when the mouse button is released. Pointer lock is different from mouse capture in the following ways: It is persistent: Pointer lock does not release the mouse until an explicit API call is made or the user uses a specific release gesture. It is not limited by browser or screen boundaries. It continues to send events regardless of mouse button state. It hides the cursor. Method/properties overview This section provides a brief description of each property and method related to the pointer lock specification. requestPointerLock() The Pointer lock API, similar to the Fullscreen API, extends DOM elements by adding a new method, requestPointerLock(). As it has recently unprefixed, you would currently declare it something like this, for example if you wanted to request pointer lock ...
...ck 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. ...
...tY--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 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 ...
RTCIceCandidatePairStats - Web APIs
The WebRTC RTCIceCandidatePairStats dictionary reports statistics which provide insight into the quality and performance of an RTCPeerConnection 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. In addition, it adds the following new properties: availableIncomingBitrate Optional Provides an informative value representing the available inbound capacity of the network by reporting the total number of bits per second available for all of the candidate pair's incoming RTP streams. This does not take into account the size of the IP overhead, nor any other transport layers such as TCP...
...this candidate pair. This includes botyh connectivity check and consent check requests. You can compute the average round trip time (RTT) by dividing this value by responsesReceived. transportId Optional A DOMString that uniquely identifies the RTCIceTransport that was inspected to obtain the transport-related statistics (as found in RTCTransportStats) used in generating this object. Obsolete properties The following properties have been removed from the specification and should no longer be used. You should update any existing code to avoid using them as soon as is practical. Check the compatibility table for details on which browsers support them and in which versions. priority Optional An integer value indicating the candidate pair's priority. readable Optional A Boolean value indi...
...ort them and in which versions. priority Optional An integer value indicating the candidate pair's priority. readable Optional A Boolean value indicating whether or not data can be sent over the connection described by the candidate pair. writable Optional A Boolean value indicating whether or not data can be received on the connection described by the candidate pair. Non-standard properties selected Optional A Firefox-specific Boolean value which is true if the candidate pair described by this object is the one currently in use. The spec-compliant way to determine the selected candidate pair is to look for a stats object of type transport, which is an RTCTransportStats object. That object's selectedCandidatePairId property indicates whether or not the specified transport is th...
RTCIceTransport - Web APIs
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". ...
...The value is one of the strings from the RTCIceTransport enumerated type: "RTP" or "RTSP". ...
...The value is one of the strings from the RTCIceTransport enumerated type: "RTP" or "RTSP". ...
RTCPeerConnection - Web APIs
t-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">RTCPeerConnection</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} ConstructorRTCPeerConnection() The RTCPeerConnection() constructor returns a newly-created RTCPeerConnection, which represents a connection between the local device and a remote peer.PropertiesAlso inherits properties from: EventTargetcanTrickleIceCandidatesThe read-only RTCPeerConnection property canTrickleIceCandidates returns a Boolean which indicates whether or not the remote peer can accept trickled ICE candidates.connectionState The read-only connectionState property of the RTCPeerConnection interface indicates the current state of the peer connection by returning one of the stri...
...dentityProvider() 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.setLocalDescription()The RTCPeerConnection method setLocalDescription() changes the local description associated with the connection. This description specifies the properties of the local end of the connection, including the media format.setRemoteDescription()The RTCPeerConnection method setRemoteDescription() sets the specified session description as the remote peer's current offer or answer. The description specifies the properties of the remote end of the connection, including the media format. Obsolete method The following method was obsoleted long ago and was n...
...through the ondatachannel event handler property. icecandidate Sent to the peer connection to request that the specified candidate be transmitted to the remote peer. Also available through the onicecandidate event handler property. icecandidateerror An error of type RTCPeerConnectionIceErrorEvent which is sent to the connection if an error occurred during ICE candidate gathering. The event's properties describe the error. Also available through the onicecandidateerror event handler property. iceconnectionstatechange Sent to the RTCPeerConnection when the state of the ICE connection changes, such as when it disconnects. Also available using the oniceconnectionstatechange event handler property. icegatheringstatechange Sent to the RTCPeerConnection when the ICE layer's gathering state, refl...
RTCRtpReceiveParameters - Web APIs
It inherits all of the properties of its parent, RTCRtpParameters. Examples This example obtains the canonical name (CNAME) being used for RTCP on an RTCRtpReceiver. ...
... Examples This example obtains the canonical name (CNAME) being used for RTCP on an RTCRtpReceiver. ...
... Examples This example obtains the canonical name (CNAME) being used for RTCP on an RTCRtpReceiver. ...
SVGAnimateColorElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGAnimateColorElement' in that specification. Recommendation...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGAnimateColorElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGAnimateColorElement' in that specification. Recommendation Initial definition ...
SVGAnimateElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateElement' in that specification. Editor's Draft Removed the inheritance from S...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateElement' in that specification. Editor's Draft Removed the inheritance from SVGStylable. Scalable Vect...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateElement' in that specification. Editor's Draft Removed the inheritance from SVGStylable. Scalable Vector Graphics (SVG) 1.1 (S...
SVGAnimateMotionElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateMotionElement' in that specification. Editor's Draft No change Scala...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateMotionElement' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Sec...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateMotionElement' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definiti...
SVGAnimateTransformElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateTransformElement' in that specification. Editor's Draft No change Sc...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateTransformElement' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGAnimateTransformElement' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defin...
SVGClipPathElement - Web APIs
The SVGClipPathElement interface provides access to the properties of <clipPath> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,2...
... SVGClipPathElement.clipPathUnits Read only An SVGAnimatedEnumeration corresponding to the clipPathUnits attribute of the given <clipPath> element. Takes one of the constants defined in SVGUnitTypes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGElement. Specific...
... SVGClipPathElement.clipPathUnits Read only An SVGAnimatedEnumeration corresponding to the clipPathUnits attribute of the given <clipPath> element. Takes one of the constants defined in SVGUnitTypes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGElement. Specifications Specification Status ...
SVGEllipseElement - Web APIs
The SVGEllipseElement interface provides access to the properties of <ellipse> elements. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1...
... SVGEllipseElement.cx Read only This property returns a SVGAnimatedLength reflecting the cx attribute of the given <ellipse> element. SVGEllipseElement.cy Read only This property returns a SVGAnimatedLength reflecting the cy attribute of the given <ellipse> element. SVGEllipseElement.rx Read only Thi...
... SVGEllipseElement.cx Read only This property returns a SVGAnimatedLength reflecting the cx attribute of the given <ellipse> element. SVGEllipseElement.cy Read only This property returns a SVGAnimatedLength reflecting the cy attribute of the given <ellipse> element. SVGEllipseElement.rx Read only This property returns a SVGAnimatedLength re...
SVGFEComponentTransferElement - Web APIs
SVGFEComponentTransferElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implement...
... SVGFEComponentTransferElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implements methods of SVGFilterPrimitiveStandardAt...
...4" stroke-width="2px" /><text x="336" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEComponentTransferElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and implements properties of SVGFilterPrimitiveStandardAttributes. SVGFEComponentTransferElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Co...
SVGFEDiffuseLightingElement - Web APIs
SVGFEDiffuseLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDiffuseLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of t...
... SVGFEDiffuseLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDiffuseLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of the given element. SVGFEDiffuseLightingEl...
...stroke-width="2px" /><text x="346" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEDiffuseLightingElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFEDiffuseLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDiffuseLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of the given element. SVGFEDiffuseLightingElement.diffuseConstant Read only An SVGAnimatedNumber corresponding t...
SVGFEDropShadowElement - Web APIs
SVGFEDropShadowElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDropShadowElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEDropSh...
... SVGFEDropShadowElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDropShadowElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEDropShadowElement.dy Read only An SVGAnimated...
...DE4" stroke-width="2px" /><text x="371" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEDropShadowElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFEDropShadowElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDropShadowElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEDropShadowElement.dy Read only An SVGAnimatedNumber corresponding to the dy attribute of the given element. SVGFED...
SVGFEFuncAElement - Web APIs
Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVG...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncAElement' in that specification. Working Dr...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncAElement' in that specification. Working Draft No change ...
SVGFEFuncBElement - Web APIs
Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVG...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncBElement' in that specification. Working Dr...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncBElement' in that specification. Working Draft No change ...
SVGFEFuncGElement - Web APIs
Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVG...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncGElement' in that specification. Working Dr...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncGElement' in that specification. Working Draft No change ...
SVGFEFuncRElement - Web APIs
Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVG...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncRElement' in that specification. Working Dr...
... Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEFuncRElement' in that specification. Working Draft No change ...
SVGFEImageElement - Web APIs
SVGFEImageElement.preserveAspectRatio Read only An SVGAnimatedPreserveAspectRatio corresponding to the preserveAspectRatio attribute of the given element. SVGFEImageElement.crossOrigin Read only An SVGAnimatedString reflects...
... 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 e...
...roke="#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">SVGFEImageElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, 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 d...
SVGFEOffsetElement - Web APIs
SVGFEOffsetElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEOffsetElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEOffsetElement.
... SVGFEOffsetElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEOffsetElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEOffsetElement.dy Read only An SVGAnimatedNumber corre...
...#D4DDE4" stroke-width="2px" /><text x="391" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFEOffsetElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFEOffsetElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEOffsetElement.dx Read only An SVGAnimatedNumber corresponding to the dx attribute of the given element. SVGFEOffsetElement.dy Read only An SVGAnimatedNumber corresponding to the dy attribute of the given element. Methods This int...
SVGFESpecularLightingElement - Web APIs
SVGFESpecularLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFESpecularLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of...
... SVGFESpecularLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFESpecularLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of the given element. SVGFESpecularLightin...
...troke-width="2px" /><text x="341" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFESpecularLightingElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFESpecularLightingElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFESpecularLightingElement.surfaceScale Read only An SVGAnimatedNumber corresponding to the surfaceScale attribute of the given element. SVGFESpecularLightingElement.specularConstant Read only An SVGAnimatedNumber correspondi...
SVGFETileElement - Web APIs
SVGFETileElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements m...
... SVGFETileElement.in1 Read only An SVGAnimatedString corresponding to the in 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 SVGFilterPrimitiveStandardAttri...
...="#D4DDE4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGFETileElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFETileElement.in1 Read only An SVGAnimatedString corresponding to the in 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 ...
SVGFontFaceElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceElement' in that specification. Recommendation Initial definition...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceElement' in that specification. Recommendation Initial definition ...
SVGFontFaceFormatElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceFormatElement' in that specification. Recommendation Initial defi...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceFormatElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceFormatElement' in that specification. Recommendation Initial definition ...
SVGFontFaceNameElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceNameElement' in that specification. Recommendation Initial defini...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceNameElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceNameElement' in that specification. Recommendation Initial definition ...
SVGFontFaceSrcElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceSrcElement' in that specification. Recommendation Initial definit...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceSrcElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceSrcElement' in that specification. Recommendation Initial definition ...
SVGFontFaceUriElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceUriElement' in that specification. Recommendation Initial definit...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceUriElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFontFaceUriElement' in that specification. Recommendation Initial definition ...
SVGGElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGGElement' in...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGGElement' in that specification. Candidate Recommendation Change...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGGElement' in that specification. Candidate Recommendation Changed the inheritance from SV...
SVGGlyphRefElement - Web APIs
SVGGlyphRefElement.glyphRef A DOMString corresponding to the glyphRef attribute of the given element. SVGGlyphRefElement.format A DOMString corresponding to the format attribute of the given element. SVGGlyphRefElement.x A float corresponding to the x attrib...
... SVGGlyphRefElement.glyphRef A DOMString corresponding to the glyphRef attribute of the given element. SVGGlyphRefElement.format A DOMString corresponding to the format attribute of the given element. SVGGlyphRefElement.x A float corresponding to the x attribute of the given element. SVGGlyphRefEle...
...#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">SVGGlyphRefElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface also inherits properties from its parent, SVGElement and implements properties from SVGURIReference and SVGStylable. SVGGlyphRefElement.glyphRef A DOMString corresponding to the glyphRef attribute of the given element. SVGGlyphRefElement.format A DOMString corresponding to the format attribute of the given element. SVGGlyphRefElement.x A float corresponding to the x attribute of the given element. SVGGlyphRefElement.y A float corresponding to the y attribute of th...
SVGHKernElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGHKernElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGHKernElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGHKernElement' in that specification. Recommendation Initial definition ...
SVGLineElement - Web APIs
The SVGLineElement interface provides access to the properties of <line> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" strok...
... SVGLineElement.x1 Read only Returns an SVGAnimatedLength that corresponds to attribute x1 on the given <line> element. SVGLineElement.y1 Read only Returns an SVGAnimatedLength that corresponds to attribute y1 on the given <line> element. SVGLineElement.x2 Read only Returns an SVGAnimatedLength that correspond...
... SVGLineElement.x1 Read only Returns an SVGAnimatedLength that corresponds to attribute x1 on the given <line> element. SVGLineElement.y1 Read only Returns an SVGAnimatedLength that corresponds to attribute y1 on the given <line> element. SVGLineElement.x2 Read only Returns an SVGAnimatedLength that corresponds to attribute x2 on the given <line> ele...
SVGMPathElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGMPathElement' in that specification. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGMPathElement' in that specification. Editor's Draft Removed the implemented interface SVGE...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGMPathElement' in that specification. Editor's Draft Removed the implemented interface SVGExternalResourcesRequired.
SVGMarkerElement - Web APIs
SVG path segment interface The SVGMarkerElement interface corresponds to the marker element. ...
...s. 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_MARKERUNITS_USERSPACEONUSE 1 Attribute markerUnits is 'userSpaceOnUse'. SVG_MARKERUNITS_STROKEWIDTH 2 Attribute markerUnits is 'strokeWidth'. Properties This interface also inherits properties from its parent interface, SVGElement, and implements properties from SVGExternalResourcesRequired, SVGAnimatedPreserveAspectRatio, and SVGStylable. Name Type Description refX SVGAnimatedLength Corresponds to attribute refX o...
...ed 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. ...
SVGMaskElement - Web APIs
The SVGMaskElement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" strok...
... SVGMaskElement.maskUnits Read only An SVGAnimatedEnumeration corresponding to the maskUnits attribute of the given <mask> element. Takes one of the constants defined in SVGUnitTypes. SVGMaskElement.maskContentUnits Read only An SVGAnimatedEnumeration corresponding to the maskContentUnits attribute of the given <mask> el...
... SVGMaskElement.maskUnits Read only An SVGAnimatedEnumeration corresponding to the maskUnits attribute of the given <mask> element. Takes one of the constants defined in SVGUnitTypes. SVGMaskElement.maskContentUnits Read only An SVGAnimatedEnumeration corresponding to the maskContentUnits attribute of the given <mask> element. Takes one of the constants defined...
SVGMetadataElement - Web APIs
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 'SVGMetadataElement' in that spe...
... 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 'SVGMetadataElement' in that specification. Candidate Recommendation No change ...
... 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 'SVGMetadataElement' in that specification. Candidate Recommendation No change Scalable Vector Graph...
SVGRectElement - Web APIs
The SVGRectElement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" strok...
... SVGRectElement.x Read only Returns an SVGAnimatedLength corresponding to the x attribute of the given <rect> element. SVGRectElement.y Read only Returns an SVGAnimatedLength corresponding to the y attribute of the given <rect> element. SVGRectElement.width Read only Returns an SVGAnimatedLength corresponding ...
... SVGRectElement.x Read only Returns an SVGAnimatedLength corresponding to the x attribute of the given <rect> element. SVGRectElement.y Read only Returns an SVGAnimatedLength corresponding to the y attribute of the given <rect> element. SVGRectElement.width Read only Returns an SVGAnimatedLength corresponding to the width attribute of the given <rect...
SVGSVGElement - Web APIs
This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
... SVGSVGElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <svg> element. SVGSVGElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given <svg> element. SVGSVG...
... SVGSVGElement.x Read only An SVGAnimatedLength corresponding to the x attribute of the given <svg> element. SVGSVGElement.y Read only An SVGAnimatedLength corresponding to the y attribute of the given <svg> element. SVGSVGElement.width Read only An SVGAnimatedL...
SVGSetElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGSetElement' in that ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGSetElement' in that specification. Editor's Draft No change Sca...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGAnimationElement. Specifications Specification Status Comment SVG Animations Level 2The definition of 'SVGSetElement' in that specification. Editor's Draft No change Scalable Vector Graphics (SV...
SVGSolidcolorElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. ...
SVGStyleElement - Web APIs
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.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 co...
... stroke="#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">SVGStyleElement</text></a></svg></div> 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.
SVGSwitchElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSwitchElemen...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSwitchElement' in that specification. Candidate Recommendation C...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGGraphicsElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSwitchElement' in that specification. Candidate Recommendation Changed the inheritance fr...
SVGTSpanElement - Web APIs
Methods This interface doesn't provide any specific methods. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTSpanElement' in that specification. Candidate Recommendation No changes ...
... Methods This interface doesn't provide any specific methods. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTSpanElement' in that specification. Candidate Recommendation No changes Scalable Vector Graphics (SVG) 1.1 (Second Edition)...
... Methods This interface doesn't provide any specific methods. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTSpanElement' in that specification. Candidate Recommendation No changes Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGTSpanEl...
SVGTextElement - Web APIs
Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGTextPositioningElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'S...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGTextPositioningElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTextElement' in that specification. Candidate Recomme...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGTextPositioningElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGTextElement' in that specification. Candidate Recommendation Removed the im...
SVGTitleElement - Web APIs
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 'SVGTitleElement' in that sp...
... 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 'SVGTitleElement' in that specification. Candidate Recommendation Removed inheri...
... 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 'SVGTitleElement' in that specification. Candidate Recommendation Removed inheritance from SVGLangSpace a...
SVGVKernElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGVKernElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGVKernElement' in that specification. Recommendation Initial definition ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGVKernElement' in that specification. Recommendation Initial definition ...
SharedWorkerGlobalScope - Web APIs
The SharedWorkerGlobalScope object (the SharedWorker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See the complete list of functions available to workers. Properties This interface inherits properties from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements properties from WindowTimers, WindowBase64, and WindowEventHandlers. SharedWorkerGlobalScope.name Read only The name that the SharedWorker was (optionally) given when it was created using the SharedWorker() constructor. This is mainly useful for debugging purposes. SharedWorkerGlobalScope.applicationCache Read ...
... WindowBase64, and WindowEventHandlers. SharedWorkerGlobalScope.name Read only The name that the SharedWorker was (optionally) given when it was created using the SharedWorker() constructor. This is mainly useful for debugging purposes. SharedWorkerGlobalScope.applicationCache Read only This property returns the ApplicationCache object for the worker (see Using the application cache). Properties inherited from WorkerGlobalScope WorkerGlobalScope.self Returns an object reference to the DedicatedWorkerGlobalScope object itself. WorkerGlobalScope.console Read only Returns the Console associated with the worker. WorkerGlobalScope.location Read only Returns the WorkerLocation associated with the worker. WorkerLocation is a specific location object, mostly a subset of the Location fo...
...workers. WorkerGlobalScope.navigator Read only Returns the WorkerNavigator associated with the worker. WorkerNavigator is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers. WorkerGlobalScope.performance Read only Returns the Performance object associated with the worker, which is a regular performance object, but with a subset of its properties and methods available. Event handlers This interface inherits event handlers from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements event handlers from WindowTimers, WindowBase64, and WindowEventHandlers. SharedWorkerGlobalScope.onconnect Is an EventHandler representing the code to be called when the connect event is raised -- that is, when a MessagePort...
StylePropertyMapReadOnly - Web APIs
The StylePropertyMapReadOnly interface of the the CSS Typed Object Model API provides a read-only representation of 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. StylePrope...
...eturn back a definition list of all the default CSS property values using computedStyleMap(). ...
... element const myElement = document.querySelector('p'); // get the <dl> we'll be populating const stylesList = document.querySelector('#output'); // Retrieve all computed styles with computedStyleMap() const stylePropertyMap = myElement.computedStyleMap(); // iterate thru the map of all the properties and values, adding a <dt> and <dd> for each for (const [prop, val] of stylePropertyMap) { // 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); } Specifications Specification Status Comment CSS Typed OM Level 1The definit...
Text - Web APIs
Web › API › Text
ight="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="473.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Text</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor Text() Returns a Text node with the parameter as its textual content. Properties Inherits properties from its parent, CharacterData. Text.isElementContentWhitespace Read only Returns a Boolean flag indicating whether or not the text node contains only whitespace. Text.wholeText Read only Returns a DOMString containing the text of all Text nodes logically adjacent to this Node, concatenated in document order. Text.assignedSlot Read only Returns the HTMLSlotEle...
...acterData. Text.isElementContentWhitespace Read only Returns a Boolean flag indicating whether or not the text node contains only whitespace. Text.wholeText Read only Returns a DOMString containing the text of all Text nodes logically adjacent to this Node, concatenated in document order. Text.assignedSlot Read only Returns the HTMLSlotElement object associated with the element. Properties included from Slotable The Text interface includes the following property, defined on the Slotable mixin. Slotable.assignedSlot Read only Returns a HTMLSlotElement representing the <slot> the node is inserted in. Methods Inherits methods from its parent, CharacterData. Text.replaceWholeText Replaces the text of the current node and all logically adjacent nodes with the specified...
...tion of 'Text' in that specification. Living Standard Removed the isElementContentWhitespace property. Removed the replaceWholeText() method. Added the Text() constructor. Added the assignedSlot property. Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Text' in that specification. Obsolete Added the isElementContentWhitespace and wholeText properties. Added the replaceWholeText() method. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Text' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (DOM) Level 1 SpecificationThe definition of 'Text' in that specification. Obsolete Initial definition. ...
Touch - Web APIs
Web › API › Touch
screen 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 reports only a single point, these values will be 1. Constructor Touch() Creates a Touch object. Properties This interface has no parent, and doesn't inh...
...f 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 reports only a single point, these values will be 1. 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. A given touch point (say, by a finger) will have the same identifier for the duration of its movement around the surface. This lets you ensure that you're tracking the same touch all the time. Touch.screenX Read only Returns the X coordinate of the touch point relative to the left edge of the screen. Touch.scre...
...ed to the surface by the user, as a float between 0.0 (no pressure) and 1.0 (maximum pressure). Methods This interface has no method and no parent, and doesn't inherits or implements any method. Specifications Specification Status Comment Touch Events - Level 2The definition of 'Touch' in that specification. Draft Added radiusX, radiusY, rotationAngle, force properties, as well as the Touch() constructor. Touch EventsThe definition of 'Touch' in that specification. Recommendation Initial definition. ...
URL - Web APIs
Web › API › URL
You normally create a new URL object by specifying the URL as a string when calling its constructor, or by providing a relative URL and a base URL. You can then easily read the parsed components of the URL or make changes to the URL. If a browser doesn't yet support the URL() constructor, you can access a URL object using the Window interface's Window.URL property. Be sure to check to see if any of your target browsers require this to be prefixed. Note: This feature is available in Web Workers. ...
...URL() constructor, you can access a URL object using the Window interface's Window.URL property. Be sure to check to see if any of your target browsers require this to be prefixed. Note: This feature is available in Web Workers. Constructor new URL() Creates and returns a URL object referencing the URL specified using an absolute URL string, or a relative URL string and a base URL string. Properties hash A USVString containing a '#' followed by the fragment identifier of the URL. host A USVString containing the domain (that is the hostname) followed by (if a port was specified) a ':' and the port of the URL. hostname A USVString containing the domain of the URL. href A stringifier that returns a USVString containing the whole URL. origin Read only Returns a USVString containing ...
...he browser. revokeObjectURL() Revokes an object URL previously created using URL.createObjectURL(). Usage notes The constructor takes a url parameter, and an optional base parameter to use as a base if the url parameter is a relative URL: const url = new URL('../cats', 'http://www.example.com/dogs'); console.log(url.hostname); // "www.example.com" console.log(url.pathname); // "/cats" URL properties can be set to construct the URL: url.hash = 'tabby'; console.log(url.href); // "http://www.example.com/cats#tabby" URLs are encoded according to the rules found in RFC 3986. For instance: url.pathname = 'demonstration.html'; console.log(url.href); // "http://www.example.com/d%C3%A9monstration.html" The URLSearchParams interface can be used to build and manipulate the URL query string. To g...
URLUtilsReadOnly - Web APIs
URLUtilsReadOnly.href Read only Is a DOMString containing the whole URL. URLUtilsReadOnly.protocol Read only Is a DOMString containing the protocol scheme of the URL, including the final ':'. ...
... URLUtilsReadOnly.href Read only Is a DOMString containing the whole URL. ...
... URLUtilsReadOnly.href Read only Is a DOMString containing the whole URL. URLUtilsReadOnly.protocol Read only Is a DOMString containing the protocol scheme of the URL, including the final ':'. ...
URL API - Web APIs
Web › API › URL API
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 an URL object for a given URL parses the URL and provides quick access to its constituent parts through its properties. ...
...t developers is the API itself. Accessing URL components Creating an URL object for a given URL parses the URL and provides quick access to its constituent parts through its properties. 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. 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; Setti...
... 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, then the value of the search property is ?user=someguy&page=news. You can also look up the values of individual parameters with the URLSearchParams object's get() method: let addr = new URL("https://mysite.com/login?user=someguy&page=ne...
Visual Viewport API - Web APIs
The visual viewport is the visual portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. Visual Viewport concepts and usage The mobile web contains two viewports, the layout viewport and the visual viewport. The layout viewport covers all the elements on a page and the visual viewport is what is actually visible on the screen. When the user pinch-zooms into the page, the visual viewport shrinks but the layout viewport is unchanged. ...
... set of image controls to remain on screen regardless of the pinch zoom level of the device? Current browsers vary in how they handle this. The visual viewport lets web developers solve this by positioning elements relative to what's shown on screen. To access a window's visual viewport, you can obtain a VisualViewport object from the window.visualViewport property. The object includes a set of properties describing the viewport. It also adds two events, onresize and onscroll, that fire whenever the visual viewport changes. These events allow you to position elements relative to the visual viewport that would normally be anchored to the layout viewport. Accessing the API window.visualViewport Read only A read-only reference to the window's VisualViewport object. If this property doesn't exi...
...rmation about the 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 requestAnimati...
WebGLContextEvent - Web APIs
The WebContextEvent interface is part of the WebGL API and is an interface for an event that is generated in response to a status change to the WebGL rendering context. Inheritance This interface inherits properties and methods from its parent interface, Event. <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/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill...
... WebGLContextEvent.statusMessage A read-only property containing additional information about the event. Methods This interface doesn't define any own methods, but inherits methods from its parent interface, Event. Examples With the help of the WEBGL_lose_context extension, you can simulate the webglcontextlost and webg...
... WebGLContextEvent.statusMessage A read-only property containing additional information about the event. Methods This interface doesn't define any own methods, but inherits methods from its parent interface, Event. Examples With the help of the WEBGL_lose_context extension, you can simulate the webglcontextlost and webglcontextrestored events: var canvas...
WebGLRenderingContext - Web APIs
gl'); Once you have the WebGL rendering context for a canvas, you can render within it. The WebGL tutorial has more information, examples, and resources on how to get started with WebGL. If you require a WebGL 2.0 context, see WebGL2RenderingContext; this supplies access to an implementation of OpenGL ES 3.0 graphics. Constants See the WebGL constants page. The WebGL context The following properties and methods provide general information and functionality to deal with the WebGL context: WebGLRenderingContext.canvas A read-only back-reference to the HTMLCanvasElement. Might be null if it is not associated with a <canvas> element. WebGLRenderingContext.commit() Pushes frames back to the original HTMLCanvasElement, if the context is not directly fixed to a specific canvas. WebGLRe...
...rom a canvas element. The WebGL rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the WebGL, and execute draw commands. Saving the state of the graphics machine within a single context interface is not unique to WebGL. This is also done in other graphics {{Glossary("API")}}, such as the canvas 2D rendering context. ...
...nvas 2D rendering context. However, the properties and variables you can tweak are different for each API. 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 squa...
Inputs and input sources - Web APIs
ry action. The section Primary squeeze action describes this in more detail. Any additional capabilities a WebXR controller may have are accessed through the input source's gamepad object. This object provides access to all of the buttons, axes, trackpads, and so forth that may be a part of the controller. See Advanced controllers using the gamepad object to learn how to use these controllers. Properties of input sources Each individual XRInputSource has a set of properties that describe the input's available axes and buttons, which hand the user's holding it in, and how the input source is used to handle targeting within the 3D space. Handedness Handedness, indicated by the XRInputSource property handedness, is a string which indicates which of the viewer's hands the controller is in: left or...
...andSource = source; break; case "right": rightHandSource = source; break; } }); }); The inputsourceschange event is also fired once when the session's creation callback first completes execution, so you can use it to fetch the input source list as soon as it's available at startup time. The event is delivered as an XRInputSourceChangeEvent, which includes three properties of interest: session The XRSession for which the input sources have changed. added An array of zero or more XRInputSource objects indicating the input sources that have been newly added to the XR system. removed An array of zero or more XRInputSource objects indicating any input sources that have been removed from the XR system. Identifying the input's profile Each input source has a p...
...mple, where acceleration is constant and not particularly realistic. You can enhance this greatly by applying some knowledge of physics to have the acceleration change over time based on how long the key is held down and other factors. Applying inputs to the scene Now that we have the deltas that need to be applied to the position and orientation--in our example, in the posDelta and orientDelta properties of our avatar object--we can write code to apply those changes. Since we're already rendering the scene on a schedule, we can just add the code to apply these changes there, along with preparing and drawing the scene. function drawFrame(time, frame) { applyExternalInputs(avatar); let pose = frame.getViewerPose(avatar.referenceSpace); animationFrameRequest = session.requestAnimationFrame(d...
Using Web Workers - Web APIs
e from the script that first spawned it, whereas shared workers can be accessed from multiple scripts. Note: See The Web Workers API landing page for reference documentation on workers and additional guides. You can run whatever code you like inside the worker thread, with some exceptions. For example, you can't directly manipulate the DOM from inside a worker, or use some default methods and properties of the window object. But you can use a large number of items available under window, including WebSockets, and data storage mechanisms like IndexedDB. See Functions and classes available to workers for more details. Data is sent between workers and the main thread via a system of messages -- both sides send their messages using the postMessage() method, and respond to messages via the onmessage...
...hods: * sendQuery(queryable function name, argument to pass 1, argument to pass 2, etc. ...
...ssage = resultReceiver; worker.onerror = errorReceiver; worker.postMessage(n - i); } }; The worker sets the property onmessage to a function which will receive messages sent when the worker object's postMessage() is called (note that this differs from defining a global variable of that name, or defining a function with that name. var onmessage and function onmessage will define global properties with those names, but they will not register the function to receive messages sent by the web page that created the worker). This starts the recursion, spawning new copies of itself to handle each iteration of the calculation. The HTML code <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Test threads fibonacci</title> </head> <body> <div id="result"></div> <sc...
Window.getComputedStyle() - Web APIs
Individual CSS property values are accessed through APIs provided by the object, or by indexing with CSS property names. 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. ...
...lues with only longhand names like font-size. Shorthand names like font will not work with most browsers. CSS property values may be accessed using the getPropertyValue(propName) API or by indexing directly into the object such as obj['z-index'] or obj.zIndex. The values returned by getComputedStyle are resolved values. These are usually the same as CSS 2.1's computed values, but for some older properties like width, height, or padding, they are instead the same as used values. Originally, CSS 2.0 defined the computed values as the "ready to be used" final values of properties after cascading and inheritance, but CSS 2.1 redefined them as pre-layout, and used values as post-layout. For CSS 2.0 properties, getComputedStyle returns the old meaning of computed values, now called used values. An examp...
...ssue, browsers may lie about the computed styles for a visited link, returning values as if the user never visited the linked URL. See Plugging the CSS History Leak and Privacy-related changes coming to CSS :visited for examples of how this is implemented. During CSS transitions, getComputedStyle returns the original property value in Firefox, but the final property value in WebKit. In Firefox, properties with the value auto return the used value, not the value auto. So if you apply top:auto and bottom:0 on an element with height:30px and a containing block of height:100px, Firefox's computed style for top returns 70px, as 100 - 30 = 70. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'getComputedStyle()' in that specification. ...
Window.open() - Web APIs
Web › API › Window › open
hitespace 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 open() method creates a new secondary browser window, similar to choosing New Window from the File menu. The url parameter specifies the URL to be fetched and loaded in the new window. If url is an empty string, then a new blank, empty window (URL about:blank) is created with the ...
...indow.open(): it will be null if the window wasn't allowed to open. However, for most other popup blockers, there is no reliable way. What is the JavaScript relationship between the main window and the secondary window? The window.open() method gives a main window a reference to a secondary window; the opener property gives a secondary window a reference to its main window. I cannot access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>. Why is that? It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set prope...
... an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>. Why is that? It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name. More reading on the cross-domain script security restriction: http://www.mozilla.org/projects/secu...me-origin.html Usability issues Avoid resorting to win...
Window.openDialog() - Web APIs
Web › API › Window › openDialog
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). 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 ...
...ted 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. ...
... 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 }; openDialog("http://example.tld/zzz.xul", "dlg", "modal", "pizza", 6.98, retVals); If you set the properties of the retVals object in the dialog code as described below, you can now access them via the retVals array after the openDialog() call returns. Inside the dialog code, you can set the properties as follows: var retVals = window.arguments[2]; retVals.address = enteredAddress; retVals.delivery = "immediate"; Specification This is not part of any specification. Browser Compatibility The comp...
XMLHttpRequest - Web APIs
retrieve any type of data, not just XML. If your communication needs to involve receiving event data or message data from a server, consider using server-sent events through the EventSource interface. For full-duplex communication, WebSockets may be a better choice. Constructor XMLHttpRequest() The constructor initializes an XMLHttpRequest. It must be called before any other method calls. Properties This interface also inherits 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 DOMS...
...MLHttpRequestEventTarget.ontimeout Is an EventHandler that is called whenever the request times out. XMLHttpRequest.upload Read only Is an XMLHttpRequestUpload, representing the upload process. XMLHttpRequest.withCredentials Is a Boolean that indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers. Non-standard properties XMLHttpRequest.channelRead only Is a nsIChannel. The channel used by the object when performing the request. XMLHttpRequest.mozAnonRead only Is a boolean. If true, the request will be sent without cookie and authentication headers. XMLHttpRequest.mozSystemRead only Is a boolean. If true, the same origin policy will not be enforced on the request. XMLHttpRequest.mozBackgroundRequest I...
...tatechange as a property of the XMLHttpRequest instance is supported in all browsers. Since then, a number of additional event handlers have been implemented in various browsers (onload, onerror, onprogress, etc.). See Using XMLHttpRequest. More recent browsers, including Firefox, also support listening to the XMLHttpRequest events via standard addEventListener() APIs in addition to setting on* properties to a handler function. Methods XMLHttpRequest.abort() Aborts the request if it has already been sent. XMLHttpRequest.getAllResponseHeaders() Returns all the response headers, separated by CRLF, as a string, or null if no response has been received. XMLHttpRequest.getResponseHeader() Returns the string containing the text of the specified header, or null if either the response has not yet...
ARIA: listbox role - Accessibility
such an element becomes visible, screen readers announce the label and role of the listbox when it gets focus. If an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader supports this. As focus moves within the list, the screen reader announces the relevant items. Associated ARIA roles, states, and properties Associated Roles option One or more nested options are required. All selected options have aria-selected set to true. All options that are not selected have aria-selected 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 with...
...l. (Note: "labelled", with two L's, is the correct spelling based on the accessibility API conventions.) aria-roledescription A human-readable string value which more clearly identifies the role of the listbox. Screen readers will often read this value to the user after reading the label (if there is one), in place of saying "listbox". (For further details and a full list of ARIA states and properties see the ARIA listbox (role) documentation.) Keyboard interactions When a single-select listbox receives focus: If none of the options are selected before the listbox receives focus, the first option receives focus. Optionally, the first option may be automatically selected. If an option is selected before the listbox receives focus, focus is set on the selected option. When a multi...
...uld manage focus of all descendants of this role. It is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown with a lighter background colour. If the listbox is not part of another widget, it should have the aria-labelledby property set. If one or more entries are not DOM children of listbox, additional aria-* properties will need to be set (see ARIA Best Practices). If there is a valid reason to expand the listbox, the combobox role may be more appropriate. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA listbox role' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'Listbox Rol...
Web applications and ARIA FAQ - Accessibility
JAWS 8 10 Window-Eyes 7 No live region support currently ZoomText ? No live region support currently Note: Early versions of these tools often had partial or buggy ARIA implementations. For notes on JAWS support for ARIA as of JAWS 10, see this article from the Paciello Group: JAWS Support for ARIA. JavaScript Toolkits ARIA roles, states, and properties have been added to a number of popular JavaScript user interface toolkits, including: Dojo/Dijit jQuery UI Fluid Infusion Google Closure Google Web Toolkit BBC Glow Yahoo! User Interface Library (YUI) For more information about JavaScript toolkit accessibility: Steve Faulkner's WAI-ARIA Implementation in JavaScript UI Libraries Can you show me an example of ARIA in action? Sure. ...
...s 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 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 ...
...ges for you. How does HTML5 relate to ARIA? HTML5 introduces a number of useful new semantic tags to HTML. A few of these tags overlap directly with roles available in ARIA, such as the new <progress> element. In cases where the browser supports an HTML5 tag that also exists in ARIA, there is usually no need to also add ARIA roles and states to the element. ARIA includes many roles, states, and properties that aren't available in HTML5, so these will continue to be useful to developers who use HTML5. For more information, Steve Faulkner has written a good overview of the relationship between HTML5 and ARIA. Degrading Gracefully from HTML5 to ARIA When delivering content to browsers that aren't HTML5-aware, you may want to consider gracefully degrading to the use of ARIA where necessary. So, usin...
::cue-region - CSS: Cascading Style Sheets
The ::cue-region CSS pseudo-element matches WebVTT cues within a selected element. This can be used to style captions and other cues in media with VTT tracks. ::cue-region { color: yellow; font-weight: bold; } The properties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its shorthand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
...ia with VTT tracks. ::cue-region { color: yellow; font-weight: bold; } The properties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its shorthand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
...rties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its shorthand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
::cue - CSS: Cascading Style Sheets
Web › CSS › ::cue
The ::cue CSS pseudo-element matches WebVTT cues within a selected element. This can be used to style captions and other cues in media with VTT tracks. ::cue { color: yellow; font-weight: bold; } The properties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
... and other cues in media with VTT tracks. ::cue { color: yellow; font-weight: bold; } The properties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
...d; } The properties are applied to the entire set of cues as if they were a single unit. The only exception is that background and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
@keyframes - CSS: Cascading Style Sheets
that keyframe. You can list the keyframe percentages in any order; they will be handled in the order they should occur. Valid keyframe lists If a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), browsers will use the element's existing styles for the start/end states. This can be used to animate an element from its initial state and back. Properties that can't be animated in keyframe rules are ignored, but supported properties will still be animated. Resolving duplicates If multiple keyframe 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 @keyfra...
... 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%, 30%, and 100% key...
... 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%, 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 ...
width - CSS: Cascading Style Sheets
Web › CSS › @viewport › width
} 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. ...
...lues. <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. ...
...or 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
Using CSS animations - CSS: Cascading Style Sheets
p the performance as smooth as possible. Letting the browser control the animation sequence lets the browser optimize performance and efficiency by, for example, reducing the update frequency of animations running in tabs that aren't currently visible. Configuring the animation To create a CSS animation sequence, you style the element you want to animate with the animation property or its sub-properties. ...
... animation-duration Configures the length of time that an animation should take to complete one cycle. ...
...xamples to explain the different permutations: In this first example, we have three animation names set, but only one duration and iteration count. In this case all three animations are given the same duration and iteration count: animation-name: fadeInOut, moveLeft300px, bounce; animation-duration: 3s; animation-iteration-count: 1; In this second example, we have three values set on all three properties. In this case each animation is run with the corresponding values in the same position on each property, so for example fadeInOut has a duration of 2.5s and an iteration count of 2, etc. animation-name: fadeInOut, moveLeft300px, bounce; animation-duration: 2.5s, 5s, 1s; animation-iteration-count: 2, 1, 5; In this third case, there are three animations specified, but only two durations and itera...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
the context of block layout, including floated, positioned, and table elements. As this page aims to detail things which are specific to block layout 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. Note: At the time of writing (May 2018), there is no real support for the box alignment properties in block layout. This document details how the specification expects these properties to be implemented for completeness, and is likely to change as the specification and browser implementations develop. align-content and justify-content The justify-content property does not apply to block containers or table cells. The align-content property applies to the block axis in order to align the co...
...solves 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 inside a container a flex item in order to use the alignment properties as specified in flexbox. Alignment of blocks horizontally prior to flexbox was typically achieved by way of setting auto margins on the block. A margin of auto will absorb all available space in that dimension, therefore setting a left and right margin of auto, you can push a block into the center: .container { width: 20em; margin-left: auto; margin-right: auto; } In table layout, you h...
...; } In table layout, you have access to the vertical-align property to align the contents of a cell inside that cell. For many use cases, turning the block container into a flex item will give you the alignment capability that you are looking for. In the example below, a container with a single item inside has been turned into a flex container for the purpose of being able to use the alignment properties. Reference CSS Properties justify-content align-content justify-self align-self Glossary Entries Alignment subject Alignment container Fallback alignment ...
CSS Color - CSS: Cascading Style Sheets
Web › CSS › CSS Color
Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
...All color-related CSS properties are touched upon. ...
... Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
Color picker tool - CSS: Cascading Style Sheets
is.g = obj.g; this.b = obj.b; this.a = obj.a; this.hue = obj.hue; this.saturation = obj.saturation; this.value = obj.value; this.format = '' + obj.format; this.lightness = obj.lightness; }; Color.prototype.setFormat = function setFormat(format) { if (format === 'HSV') this.format = 'HSV'; if (format === 'HSL') this.format = 'HSL'; }; /*========== Methods to set Color Properties ==========*/ Color.prototype.isValidRGBValue = function isValidRGBValue(value) { return (typeof(value) === 'number' && isNaN(value) === false && value >= 0 && value <= 255); }; Color.prototype.setRGBA = function setRGBA(red, green, blue, alpha) { if (this.isValidRGBValue(red) === false || this.isValidRGBValue(green) === false || this.isValidRGBValue(blue) === false) return; ...
...odeButton() { var button = document.createElement('div'); button.className = 'switch_mode'; button.addEventListener('click', function() { if (this.picker_mode === 'HSV') this.setPickerMode('HSL'); else this.setPickerMode('HSV'); }.bind(this)); this.node.appendChild(button); }; /*************************************************************************/ // Updates properties of UI elements /*************************************************************************/ ColorPicker.prototype.updateColor = function updateColor(e) { var x = e.pageX - this.picking_area.offsetLeft; var y = e.pageY - this.picking_area.offsetTop; var picker_offset = 5; // width and height should be the same var size = this.picking_area.clientWidth; if (x > size) x = size; if (...
...************************************************/ ColorPicker.prototype.subscribe = function subscribe(topic, callback) { this.subscribers[topic] = callback; }; ColorPicker.prototype.notify = function notify(topic, value) { if (this.subscribers[topic]) this.subscribers[topic](value); }; /*************************************************************************/ // Set Picker Properties /*************************************************************************/ ColorPicker.prototype.setColor = function setColor(color) { if(color instanceof Color !== true) { console.log('Typeof parameter not Color'); return; } if (color.format !== this.picker_mode) { color.setFormat(this.picker_mode); color.updateHSX(); } this.color.copy(color); this.updateHuePicker()...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
other implementations. The idea was not to use the experimental implementations in production code. However, prefixes ultimately were used in production code, and changes to the experimental specification caused people to need to update their sites to keep up. In 2009, the specification looked quite different. To create a flex container you would use display: box and there were a number of box-* properties, which did things that you will recognise from flexbox today. There was an update to the spec that updated the syntax to display: flexbox -- this was again vendor-prefixed. Ultimately the specification was updated to define display: flex as the way to create a flex container. Browser support for the up-to-date version of the specification is excellent from this point forward. There are a few o...
...-block item becomes a flex item, it is blockified and so behavior of display: inline-block like preserving white space between items no longer applies. Remove display: flex to see the fallback behavior. You'll see white space added between the items, which is what happens when using display: inine-block as it prefers white space like other inline items. display: table- The CSS table display properties are potentially very useful as a fallback, due to the fact that they allow design patterns such as full height columns and vertical centering and work back as far as Internet Explorer 8. If you use display: table-cell on an item in your HTML it takes on the styling of an HTML table cell. CSS creates anonymous boxes to represent these items so that you do not need to wrap each item in a wrapper t...
...trates use of the vertical-align property along with display: inline-block. Both display: table-cell and display: inline-block allow for the use of this property. Use of vertical-align enables vertical alignment prior to flexbox. The property is ignored by flexbox and so you can use it in conjunction with display: table-cell or display: inline-block as a fallback and then safely use box alignment properties in flexbox instead. Feature Queries and flexbox You can use feature queries to detect flexbox support: @supports (display: flex) { // code for supporting browsers } Note that Internet Explorer 11 does not support feature queries yet does support flexbox. If you decide the IE11 implementation is too buggy and you wish to serve it the fallback layout then you could use feature queries to se...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
y 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 flex container, making them each appear as tall as the tallest item. Reference CSS Properties flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap order Alignment Properties The properties align-content, align-self, align-items and justify-content initially appeared in the Flexbox specification, but are now defined in Box Alignment. The Flexbox spec now refers to the Box Alignment specification for up to date definitions. Also additional alignment proper...
... Mastering wrapping of flex items How to create flex containers with multiple lines and control the display of the i...
... Mastering wrapping of flex items How to create flex containers with multiple lines and control the display of the items in those lines. Typical use cases of Flexbox Common design patterns that are typical Flexbox use cases. ...
Flow Layout and Overflow - CSS: Cascading Style Sheets
ll 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 shorthand for the overflow-x and overflow-y properties. If you specify only one value for overflow, this value is used for both axes. However, you can specify both values in which case the first is used for overflow-x and therefore the horizontal direction, and the second for overflow-y and the vertical direction. In the below example, I have only specified overflow-y: scroll so we do not get the unwanted horizontal scrollbar. Flow Relative Proper...
...es. However, you can specify both values in which case the first is used for overflow-x and therefore the horizontal direction, and the second for overflow-y and the vertical direction. In the below example, I have only specified overflow-y: scroll so we do not get the unwanted horizontal scrollbar. Flow Relative Properties In the guide to Writing Modes and Flow Layout, we looked at the newer properties of block-size and inline-size which make more sense when working with different writing modes than tying our layout to the physical dimensions of the screen. The Level 3 Overflow Module also includes flow relative properties for overflow - overflow-block and overflow-inline. These correspond to overflow-x and overflow-y but the mapping depends on the writing mode of the document. These propertie...
...odes than tying our layout to the physical dimensions of the screen. The Level 3 Overflow Module also includes flow relative properties for overflow - overflow-block and overflow-inline. These correspond to overflow-x and overflow-y but the mapping depends on the writing mode of the document. These properties currently do not have implementations in browsers, so you will need to use the physical properties at the present time and adjust for your writing mode. Indicating Overflow In the Level 3 Overflow specification we have some properties which can help improve the way content looks in an overflow situation. Inline-Axis Overflow The text-overflow property deals with text overflowing in the inline direction. It takes one of two values clip, in which case content is clipped when it overflows, th...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
modified document order Grid places items that have not been given a grid position in what is described in the specification as "order modified document order". This means that if you have used the order property at all, the items will be placed by that order, not their DOM order. Otherwise they will stay by default in the order that they are entered in the document source. Items with placement properties The first thing grid will do is place any items that have a position. In the example below I have 12 grid items. Item 2 and item 5 have been placed using line based placement on the grid. You can see how those items are placed and the other items then auto-place in the spaces. The auto-placed items will place themselves before the placed items in DOM order, they don't start after the position of...
...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 se...
...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. ...
CSS values and units - CSS: Cascading Style Sheets
Below is an overview of most of these data types. Refer to the page for each value type for more detailed information. ...
...ification or the MDN property page, allowable keywords will be listed in the following form. The following values are the pre-defined keyword values allowed for float. left | right | none | inline-start | inline-end Such values are used without quotes: .box { float: left; } CSS-wide values In addition to the pre-defined keywords that are part of the specification for a property, all CSS properties accept the CSS-wide property values initial, inherit, and unset, which explicitly specify defaulting behaviors. The initial keyword represents the value specified as the property's initial value. The inherit keyword represents the computed value of the property on the element's parent, provided it is inherited. The unset keyword acts as either inherit or initial, depending on whether the proper...
...hich the percentage refers. This quantity can be a value of another property of the same element, the value of a property of an ancestor element, a measurement of a containing block, or something else. As an example, if you specify the width of a box as a percentage, it refers to the percentage of the box's parent's computed width: .box { width: 50%; } Mixing percentages and dimensions Some properties accept a dimension that could be either one of two types, for example a <length> or a <percentage>. In this case the allowed value is detailed in the specification as a combination unit, e.g. <length-percentage>. Other possible combinations are as follows: <frequency-percentage> <angle-percentage> <time-percentage> Special data types (defined in other specs) <color> <image> <position>...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › Cascade
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 document. These style sheet...
...code, but the end result is the same. Some browsers let users modify the user-agent stylesheet. Although some constraints on user-agent stylesheets are set by the HTML specification, browsers still have a lot of latitude: that means that significant differences exist from one browser to another. To simplify the development process, Web developers often use a CSS reset style sheet, forcing common properties values to a known state before beginning to make alterations to suit their specific needs. Author stylesheets Author stylesheets are the most common type of style sheet. These are style sheets that define styles as part of the design of a given web page or site. The author of the page defines the styles for the document using one or more stylesheets, which define the look and feel of the websit...
...is considered to choose one or the other. Resetting styles After your content has finished altering styles, it may find itself in a situation where it needs to restore them to a known state. This may happen in cases of animations, theme changes, and so forth. The CSS property all lets you quickly set (almost) everything in CSS back to a known state. all lets you opt to immediately restore all properties to any of their initial (default) state, the state inherited from the previous level of the cascade, a specific origin (the user-agent stylesheet, the author stylesheet, or the user stylesheet), or even to clear the values of the properties entirely. CSS animations and the cascade CSS animations, using @keyframes at-rules, define animations between states. Keyframes don't cascade, meaning that ...
Layout and the containing block - CSS: Cascading Style Sheets
nvestigate 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. 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. Identifying the containing block The process for identifying the containing block depends entirely on the value of the element's position property: If the position property is static, relative, or sticky, the containing block is formed by the edge of t...
...f filter (only works on Firefox). A contain value of paint (e.g. contain: paint;) Note: The containing block in which the root element (<html>) resides is a rectangle called the initial containing block. It has the dimensions of the viewport (for continuous media) or the page area (for paged media). ...
...aining block in which the root element (<html>) resides is a rectangle called the initial containing block. It has the dimensions of the viewport (for continuous media) or the page area (for paged media). Calculating percentage values from the containing block As noted above, when certain properties are given a percentage value, the computed value depends on the element's containing block. The properties that work this way are box model properties and offset properties: The height, top, and bottom properties compute percentage values from the height of the containing block. The width, left, right, padding, and margin properties compute percentage values from the width of the containing block. Some examples The HTML code for all our examples is: <body> <section> <p>This is a paragrap...
Linear-gradient Generator - CSS: Cascading Style Sheets
is.g = obj.g; this.b = obj.b; this.a = obj.a; this.hue = obj.hue; this.saturation = obj.saturation; this.value = obj.value; this.format = '' + obj.format; this.lightness = obj.lightness; }; Color.prototype.setFormat = function setFormat(format) { if (format === 'HSV') this.format = 'HSV'; if (format === 'HSL') this.format = 'HSL'; }; /*========== Methods to set Color Properties ==========*/ Color.prototype.isValidRGBValue = function isValidRGBValue(value) { return (typeof(value) === 'number' && isNaN(value) === false && value >= 0 && value <= 255); }; Color.prototype.setRGBA = function setRGBA(red, green, blue, alpha) { if (this.isValidRGBValue(red) === false || this.isValidRGBValue(green) === false || this.isValidRGBValue(blue) === false) return; ...
...odeButton() { var button = document.createElement('div'); button.className = 'switch_mode'; button.addEventListener('click', function() { if (this.picker_mode === 'HSV') this.setPickerMode('HSL'); else this.setPickerMode('HSV'); }.bind(this)); this.node.appendChild(button); }; /*************************************************************************/ // Updates properties of UI elements /*************************************************************************/ ColorPicker.prototype.updateColor = function updateColor(e) { var x = e.pageX - this.picking_area.offsetLeft; var y = e.pageY - this.picking_area.offsetTop; // width and height should be the same var size = this.picking_area.clientWidth; if (x > size) x = size; if (y > size) y = size; if ...
...************************************************/ ColorPicker.prototype.subscribe = function subscribe(topic, callback) { this.subscribers[topic] = callback; }; ColorPicker.prototype.notify = function notify(topic, value) { if (this.subscribers[topic]) this.subscribers[topic](value); }; /*************************************************************************/ // Set Picker Properties /*************************************************************************/ ColorPicker.prototype.setColor = function setColor(color) { if(color instanceof Color !== true) { console.log('Typeof parameter not Color'); return; } if (color.format !== this.picker_mode) { color.setFormat(this.picker_mode); color.updateHSX(); } this.color.copy(color); this.updateHuePicker()...
Value definition syntax - CSS: Cascading Style Sheets
and the interactions between them. A component can be a keyword, some characters considered as a literal, or a value of a given CSS data type or of another CSS property. Component value types Keywords Generic keywords A keyword with a predefined meaning appears literally, without quotation marks. For example: auto, smaller or ease-in. The specific case of inherit, initial and unset All CSS properties accept the keywords inherit, initial and unset, that are defined throughout CSS. They are not shown in the value definition, and are implicitly defined. Literals In CSS, a few characters can appear on their own, like the slash ('/') or the comma (','), and are used in a property definition to separate its parts. The comma is often used to separate values in enumerations, or parameters in mathem...
...SS, a few characters can appear on their own, like the slash ('/') or the comma (','), and are used in a property definition to separate its parts. The comma is often used to separate values in enumerations, or parameters in mathematical-like functions; the slash often separates parts of the value that are semantically different, but have a common syntax. Typically, the slash is used in shorthand properties; to separate component that are of the same type, but belong to different properties. Both symbols appear literally in a value definition. Data types Basic data types Some kind of data are used throughout CSS, and are defined once for all values in the specification. Called basic data types, they are represented with their name surrounded by the symbol '<' and '>': <angle>, <string>, ... Non...
...mbol '<' and '>': <angle>, <string>, ... Non-terminal data types Less common data types, called non-terminal data types, are also surrounded by '<' and '>'. Non-terminal data types are of two kinds: data types sharing the same name of a property, put between quotes. In this case, the data type shares the same set of values as the property. They are often used in the definition of shorthand properties. data type not sharing the same name of a property. These data types are very close to the basic data types. They only differ from the basic data types in the physical location of their definition. In this case, the definition is usually physically very close to the definition of the property using them. Component value combinators Brackets Brackets enclose several entities, combinators, and...
Viewport concepts - CSS: Cascading Style Sheets
The width of the viewport is not always the width of the window. If you query the width or height of the window and document in Chrome or Firefox, you may get: document.documentElement.clientWidth /* 1200 */ window.innerWidth /* 1200 */ window.outerWidth /* 1200 */ document.documentElement.clientHeight /* 800 */ window.innerHeight /* 800 */ window.outerHeight /* 900 */ There are several DOM properties that can help you query viewport size, and other similar lengths: The document element's Element.clientWidth is the inner width of a document in CSS pixels, including padding (but not borders, margins, or vertical scrollbars, if present). This is the viewport width. The Window.innerWidth is the width, in CSS pixels, of the browser window viewport including, if rendered, the vertical scrollbar...
...-- the <img> if the source is an SVG file, the SVG itself if the SVG is included directly into the HTML, or the parent if the parent element has a width assigned and -- not the viewport's width. With the above media query being in our SVG file, the CSS is applied if the SVG container is between 400 and 500px. JavaScript The Visual Viewport API provides a mechanism for querying and modifying the properties of the visual viewport. Mobile Viewports Mobile devices come in all shapes and sizes, with screens of differing device pixel ratios. The mobile browser's viewport is the area of the window in which web content can be seen, which is not necessarily the same size as the rendered page. Mobile browsers render pages in a virtual window or viewport, generally at 980px, which is usually wider than the...
...a mobile browser to use the viewport width instead of the default 980px as the width of the screen, developers can include a viewport meta tag, 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 ...
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. 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 pro...
...l: 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 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. revert Specifies behavior that depends on the stylesheet origin to which the declaration belongs: User-agent origin Equivalent to unset. User origin Rolls back the cascade to the user...
...d values are calculated as if no author-level rules were specified for the element. For purposes of revert, the Author origin includes the Override and Animation origins. Formal definition Initial valueThere is no practical initial value for it.Applies toall elementsInheritednoComputed valueas the specified value applies to each property this is a shorthand for.Animation typeas each of the properties of the shorthand (all properties but unicode-bidi and direction) Formal syntax initial | inherit | unset | revert Examples HTML <blockquote id="quote"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </blockquote> Phasellus eget velit sagittis. CSS body { font-size: small; background-color: #F0F0F0; color: blue; } blockquote { background-color: skyblue; color: red; } ...
display - CSS: Cascading Style Sheets
Web › CSS › display
id out in (assuming it is a non-replaced element). 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 the formatting root l...
...sive Enhancement Realizing common layouts using grids Accessibility concerns display: none Using a display value of none on an element will remove it from the accessibility tree. This will cause the element and all its descendant elements to no longer be announced by screen reading technology. If you want to visually hide the element, a more accessible alternative is to use a combination of properties to remove it visually from the screen but keep it parseable by assistive technology such as screen readers. display: contents Current implementations in most browsers will remove from the accessibility tree any element with a display value of contents (but descendants will remain). This will cause the element itself to no longer be announced by screen reading technology. This is incorrect behav...
...specification. More accessible markup with display: contents | Hidde de Vries Display: Contents Is Not a CSS Reset | Adrian Roselli Tables Changing the display value of a <table> element to block, grid, or flex will alter its representation in the accessibility tree. This will cause the table to no longer be announced properly by screen reading technology. Short note on what CSS display properties do to table semantics -- The Paciello Group Hidden content for better a11y | Go Make Things MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.1 | W3C Understanding WCAG 2.0 Formal definition Initial valueinlineApplies toall elementsInheritednoComputed valueas the specified value, except for positioned and floating elements and the root element. In both c...
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
-gap'>. If <'column-gap'> is omitted, it's set to the same value as <'row-gap'>. <'row-gap'> and <'column-gap'> are each specified as a <length> or a <percentage>. Values <length> Is the width of the gutter separating the grid lines. <percentage> Is the width of the gutter separating the grid lines, relative to the dimension of the element. ...
...Values <length> Is the width of the gutter separating the grid lines. <percentage> Is the width of the gutter separating the grid lines, relative to the dimension of the element. ...
...p: normalApplies tomulti-column elements, flex containers, grid containersInheritednoComputed valueas each of the properties of the shorthand:row-gap: as specified, with <length>s made absolute, and normal computing to zero except on multi-column elementscolumn-gap: as specified, with <length>s made absolute, and normal computing to zero except on multi-column elementsAnimation typeas each of the properties of the shorthand:row-gap: a length, percentage or calc();column-gap: a length, percentage or calc(); Formal syntax <'row-gap'> <'column-gap'>? Examples Flex layout HTML <div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> CSS #flexbox { display: flex; flex-wrap: wrap; width: 300px; gap: 20px 5px; } #flexbox > div { borde...
grid-column - CSS: Cascading Style Sheets
column 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. 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. Each <grid-line> value...
...s omitted, it defaults to 1. Negative integers or 0 are invalid. Internet Explorer issues IE11 does not support automatic placement of grid items. All items end up in the first row/col of the grid unless explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. ...
...s explicitly annotated with -ms-grid-column and -ms-grid-row. One can use a little JavaScript to enable automatic annotation: source repository. ...
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. ...
...me 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. ...
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. /* <length> values */ inset: 10px; /* value applied to all edges */ inset: 4px 8px; /* top/bottom left/right */ inset: 5px 15px 10px; /* top left/right bottom */ inset: 2.4em 3em 3em 3em; /* top right bottom left */ /* <percentage>s of the width (left/right) or height (top/bottom) of the containing block */ inset: 10% 5% 5% 5%; /* Keyword value */ inset: auto; /* Global values */ inset: inherit; inset: initial; inset: unset...
...ning block */ inset: 10% 5% 5% 5%; /* Keyword value */ inset: auto; /* Global values */ inset: inherit; inset: initial; inset: unset; Syntax Values The inset property takes the same values as the left property. ...
... Editor's Draft Initial definition ...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
The <length> CSS data type represents a distance value. Lengths can be used in numerous CSS properties, such as width, height, margin, padding, border-width, font-size, and text-shadow. Note: Although <percentage> values are also CSS dimensions, and are usable in some of the same properties that accept <length> values, they are not themselves <length> values. See <length-percentage>. Syntax The <length> data type consists of a <number> followed by one of the units listed below. As with all CSS dimensions, there is no space between the unit literal and the number. The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. Units Relative length units Relative lengths represent a measurement in terms of some other distance. Depending...
...resents the font-size of the root element (typically <html>). When used within the root element font-size, it represents its initial value (a common browser default is 16px, but user-defined preferences may modify this). rlh Equal to the computed value of the line-height property on the root element (typically <html>), converted to an absolute length. When used on the font-size or line-height properties of the root element, it refers to the properties' initial value. Viewport-percentage lengths Viewport-percentage lengths define the <length> value relative to the size of the viewport, i.e., the visible portion of the document. Viewport lengths are invalid in @page declaration blocks. vh Equal to 1% of the height of the viewport's initial containing block. vw Equal to 1% of the width of ...
... to 1% of the size of the initial containing block, in the direction of the root element's inline axis. vb Equal to 1% of the size of the initial containing block, in the direction of the root element's block axis. vmin Equal to the smaller of vw and vh. vmax Equal to the larger of vw and vh. Absolute length units Absolute length units represent a physical measurement when the physical properties of the output medium are known, such as for print layout. This is done by anchoring one of the units to a physical unit, and then defining the others relative to it. The anchor is done differently for low-resolution devices, such as screens, versus high-resolution devices, such as printers. For low-dpi devices, the unit px represents the physical reference pixel; other units are defined relative...
margin-inline - CSS: Cascading Style Sheets
Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends o...
...in-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 following CSS properties: margin-inline-end margin-inline-start Syntax Values The margin-inline property takes the same values as the margin-left property. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a p...
... Editor's Draft Initial definition. Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoAnimation typediscrete ...
overflow - CSS: Cascading Style Sheets
Web › CSS › overflow
sets the desired behavior for an element's overflow -- i.e. when an element's content is too big to fit in its block formatting 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. ...
...en an element's content is too big to fit in its block formatting 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 ov...
...t to nowrap. Setting one axis to visible (the default) while setting the other to a different value results in visible behaving as auto. The JavaScript Element.scrollTop property may be used to scroll an HTML element even when overflow is set to hidden. ...
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. /* <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-orientati...
... /* <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. 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. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typediscrete Formal syntax <'padding-left'>{1,2}...
... Editor's Draft Initial definition ...
place-content - CSS: Cascading Style Sheets
The place-content CSS shorthand property allows you to align content along both the block and inline directions at once (i.e. the align-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...along both the block and inline directions at once (i.e. the align-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ign-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
position - CSS: Cascading Style Sheets
Web › CSS › position
This is the default value. ...
...repository. If you'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 position of any other elements; thus, the space given for the element in the page layout is the same as if position were static. This value creates a new...
...estor. This effectively inhibits any "sticky" behavior (see the GitHub issue on W3C CSSWG). Description Types of positioning A positioned element is an element whose computed position value is either relative, absolute, fixed, or sticky. (In other words, it's anything except static.) A relatively positioned element is an element whose computed position value is relative. The top and bottom properties specify the vertical offset from its normal position; the left and right properties specify the horizontal offset. An absolutely positioned element is an element whose computed position value is absolute or fixed. The top, right, bottom, and left properties specify offsets from the edges of the element's containing block. (The containing block is the ancestor relative to which the element is pos...
scroll-padding-block - CSS: Cascading Style Sheets
The scroll-padding-block shorthand property sets the scroll padding of an element in the block dimension. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ties define offsets for the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This 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. ...
...lport: the region used as the target region for placing things in view of the user. This 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. ...
scroll-padding-inline - CSS: Cascading Style Sheets
The scroll-padding-inline shorthand property sets the scroll padding of an element in the inline dimension. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ies define offsets for the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This 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 targetted element and the edges of the scrollport. ...
...port: the region used as the target region for placing things in view of the user. This 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 targetted element and the edges of the scrollport. ...
text-emphasis - CSS: Cascading Style Sheets
the font, and text-emphasis may affect line height when the current leading is not enough for the marks. text-emphasis doesn't reset the 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. It may be computed to or rendered as 'f' only */ /* Keywords va...
... shape in vertical writing modes when no other shape is given. <string> Display the given string as marks. Authors should not specify more than one character in <string>. The UA may truncate or ignore strings consisting of more than one grapheme cluster. <color> Defines the color of the mark. If no color is present, it defaults to currentcolor. ...
...e character in <string>. The UA may truncate or ignore strings consisting of more than one grapheme cluster. <color> Defines the color of the mark. If no color is present, it defaults to currentcolor. Formal definition Initial valueas each of the properties of the shorthand:text-emphasis-style: nonetext-emphasis-color: currentcolorApplies toall elementsInheritednoComputed valueas each of the properties of the shorthand:text-emphasis-style: as specifiedtext-emphasis-color: computed colorAnimation typeas each of the properties of the shorthand:text-emphasis-color: a colortext-emphasis-style: discrete Formal syntax <'text-emphasis-style'> | <'text-emphasis-color'> Examples A heading with emphasis shape and color This example draws a heading with triangles used to emphasize each character. C...
transition-property - CSS: Cascading Style Sheets
The transition-property CSS property sets the CSS properties to which a transition effect should be applied. The source for this interactive example is stored in a GitHub repository. If 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 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. Syntax /* Keyword values */ transition-property: none; transition-property: all; /* <custom-ident> values */ transition-property: te...
... <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>#wher...
..._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 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 |...
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. Example This example computes and displays the used width value of three elements (updates on resize): HTML <div id="no-width"> <p>No explicit width.</p> <p class="show-used-width">..</p...
...h-inherit"); } updateAllUsedWidths(); window.addEventListener('resize', updateAllUsedWidths); Result Difference from computed value CSS 2.0 defined only computed value as the last step in a property's calculation. Then, CSS 2.1 introduced the distinct definition of used value. An element could then explicitly inherit a width/height of a parent, whose computed value is a percentage. ...
...puted value as the last step in a property's calculation. Then, CSS 2.1 introduced the distinct definition of used value. An element could then explicitly inherit a width/height of a parent, whose computed value is a percentage. For CSS properties that don't depend on layout (e.g., display, font-size, or line-height), the computed values and used values are the same. ...
var() - CSS: Cascading Style Sheets
Web › CSS › var
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. ...
... <declaration-value> The custom property's fallback value, which is used in case the custom property is invalid in the used context. ...
... Candidate Recommendation Initial definition ...
Localizations and character encodings - Developer guides
ection 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 canonical name of the legacy encoding that users of the loc...
...'t follow the guidance given above. (For example, the fallback encoding for the Polish, Hungarian and Czech locales should probably continue to be ISO-8859-2 even though IE has a different fallback encoding.) When in doubt, use windows-1252 as the fallback encoding. Specifying the heuristic detection mode The heuristic detection mode is specified by the preference intl.charset.detector in intl.properties. The setting must be left blank for all locales other than Russian, Ukrainian and Japanese. Do not under any circumstances specify the "universal" detector. It is not actually universal despite its name! Exception for minority languages If the localization is for minority language and the users are typically literate in the majority language of the region and read Web content written in the maj...
... encoding and the heuristic detection mode to be the same as for the localization for the majority language of the 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 Japane...
Mobile Web Development - Developer guides
Web › Guide › Mobile
or touch screens. You can use the pointer or any-pointer media query to load different CSS on a touch-enabled device. Optimizing images To help users whose devices have low or expensive bandwidth, you can optimize images by loading images appropriate to the device screen size and resolution. You do this in CSS by querying for screen height, width, and pixel ratio. You can also make use of CSS properties to implement visual effects like gradients and shadows without images. Mobile APIs Finally, you can take advantage of the new possibilities offered by mobile devices, such as orientation and geolocation. Cross-browser development Write cross-browser code To create web sites that will work acceptably across different mobile browsers: Try to avoid using browser-specific features, such as ve...
...al effects like gradients and shadows without images. Mobile APIs Finally, you can take advantage of the new possibilities offered by mobile devices, such as orientation and geolocation. Cross-browser development Write cross-browser code To create web sites that will work acceptably across different mobile browsers: Try to avoid using browser-specific features, such as vendor-prefixed CSS properties. If you do need to use these features, check whether other browsers implement their own versions of these features, and target them too. For browsers that don't support these features, provide an acceptable fallback. For example, if you set a gradient as a background for some text using a vendor-prefixed property like -webkit-linear-gradient, it's best to include the other vendor-prefixed ver...
... some text using a vendor-prefixed property like -webkit-linear-gradient, it's best to include the other vendor-prefixed versions of the linear-gradient() property. If you don't do that, at least make sure that the default background contrasts with the text: that way, the page will at least be usable in a browser which is not targeted by your linear-gradient rule. See this list of Gecko-specific properties, and this list of WebKit-specific properties, and Peter Beverloo's table of vendor-specific properties. Using tools like CSS Lint can help find problems like this in code, and preprocessors like SASS and LESS can help you to produce cross-browser code. Take care with user agent sniffing It's preferable for web sites to detect specific device features such as screen size and touch screens using...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
uery string, but not the fragment, password, or username. This is unsafe because it can leak information from TLS-protected resources to insecure origins. sizes One or more strings separated by commas, indicating a set of source sizes. Each source size consists of: A media condition. This must be omitted for the last item in the list. A source size value. Media Conditions describe properties of the viewport, not of the image. For example, (max-height: 500px) 1000px proposes to use a source of 1000px width, if the viewport is not higher than 500px. Source size values specify the intended display size of the image. User agents use the current source size to select one of the sources supplied by the srcset attribute, when those sources are described using width (w) descriptors. The se...
... width The intrinsic width of the image in pixels. Must be an integer without a unit. usemap The partial URL (starting with #) of an image map associated with the element. Note: You cannot use this attribute if the <img> element is inside an <a> or <button> element. Deprecated attributes align Aligns the image with its surrounding context. Use the float and/or vertical-align CSS properties instead of this attribute. Allowed values: top Equivalent to vertical-align: top or vertical-align: text-top middle Equivalent to vertical-align: -moz-middle-with-baseline bottom The default, equivalent to vertical-align: unset or vertical-align: initial left Equivalent to float: left right Equivalent to float: right border The width of a border around the image. U...
...etails. name A name for the element. Use the id attribute instead. vspace The number of pixels of white space above and below the image. Use the margin CSS property instead. Styling with CSS <img> is a replaced element; it has a display value of inline by default, but its default dimensions are defined by the embedded image's intrinsic values, like it were inline-block. You can set properties like border/border-radius, padding/margin, width, height, etc. on an image. <img> has no baseline, so when images are used in an inline formatting context with vertical-align: baseline, the bottom of the image will be placed on the text baseline. You can use the object-position property to position the image within the element's box, and the object-fit property to adjust the sizing of the image...
Global attributes - HTML: Hypertext Markup Language
marily on <input> elements, but is usable on any element while in contenteditable mode. is Allows you to specify that a standard HTML element should behave like a registered custom built-in element (see Using custom elements for more details). Note: The item* attributes are part of the WHATWG HTML Microdata feature. 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. It provides a list of element ids (not itemids) with additional properties elsewhere in the document. itemscope itemscope (usually) ...
...itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active. ...
... (usually) works along with itemtype to specify that the HTML contained in a block is about a particular item. itemscope creates the Item and defines the scope of the itemtype associated with it. itemtype is a valid URL of a vocabulary (such as schema.org) that describes the item and its properties context. itemtype Specifies the URL of the vocabulary that will be used to define itemprops (item properties) in the data structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active. lang Helps define the language of an element: the language that non-editable elements are in, or the language that editable elements should be written in by the user. The attribute contains one "language tag" (made of hyphen-separated "language subtags") in th...
CSS Houdini
ts: no pre-processors, post-processors or JavaScript frameworks needed. <script> CSS.paintWorklet.addModule('csscomponent.js'); </script> This added module contains registerPaint() functions, which register completely configurable worklets. The CSS paint() function parameters include the name of the worklet, along with optional parameters. The worklet also has access to the element's custom properties: they don't need to be passed as function arguments. li { background-image: paint(myComponent, stroke, 10px); --highlights: blue; --lowlights: green; } Note: With great power comes great responsibility! With Houdini you could invent your own masonry, grid, or regions implementation, but doing so is not necessarily the best idea. The CSS Working group does a lot of work to ensure every...
... help you if you 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. ...
... 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. 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...
Control flow and error handling - JavaScript
n; You may throw any expression, not just expressions of a specific type. The following code throws several exceptions of varying types: throw 'Error2'; // String type throw 42; // Number type throw true; // Boolean type throw {toString: function() { return "I'm an object!"; } }; Note: You can specify an object when you throw an exception. You can then reference the object's properties in the catch block. // Create an object type UserException function UserException(message) { this.message = message; this.name = 'UserException'; } // Make the exception convert to a pretty string when used as a string // (e.g., by the error console) UserException.prototype.toString = function() { return `${this.name}: "${this.message}"`; } // Create an instance of the object type and t...
...t one or more try...catch statements. If an inner try...catch statement does not have a catch block: it must contain a finally block, and the enclosing try...catch statement's catch block is checked for a match. For more information, see nested try-blocks on the try...catch reference page. ...
...nding on the type of error, you may be able to use the name and message properties to get a more refined message. The name property provides the general class of Error (such as DOMException or Error), while message generally provides a more succinct message than one would get by converting the error object to a string. If you are throwing your own exceptions, in order to take advantage of these properties (such as if your catch block doesn't discriminate between your own exceptions and system ones), you can use the Error constructor. For example: function doSomethingErrorProne() { if (ourCodeMakesAMistake()) { throw (new Error('The message')); } else { doSomethingToGetAJavascriptError(); } } ? try { doSomethingErrorProne(); } catch (e) { // NOW, we actually use `con...
Meta programming - JavaScript
tting a property on an object: let handler = { get: function(target, name) { return name in target? target[name] : 42 } } let p = new Proxy({}, handler) p.a = 1 console.log(p.a, p.b) // 1, 42 The Proxy object defines a target (an empty object here) and a handler object, in which a get trap is implemented. Here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the number 42. Additional examples are available on the Proxy reference page. Terminology The following terms are used when talking about the functionality of proxies. handler Placeholder object which contains traps. traps The methods that provide property access. (This is analogous to the concept of traps in operating systems.) target Object which the proxy vi...
...bout the functionality of proxies. handler Placeholder object which contains traps. traps The methods that provide property access. (This is analogous to the concept of traps in operating systems.) target Object which the proxy virtualizes. It is often used as storage backend for the proxy. Invariants (semantics that remain unchanged) regarding object non-extensibility or non-configurable properties are verified against the target. invariants Semantics that remain unchanged when implementing custom operations are called invariants. If you violate the invariants of a handler, a TypeError will be thrown. Handlers and traps The following table summarizes the available traps available to Proxy objects. See the reference pages for detailed explanations and examples. Handler / trap ...
... Reflect.enumerate() The enumerate method must return an object. handler.ownKeys() Object.getOwnPropertyNames() Object.getOwnPropertySymbols() Object.keys() Reflect.ownKeys() The result of ownKeys is a List. The Type of each result List element is either String or Symbol. The result List must contain the keys of all non-configurable own properties of target. If the target object is not extensible, then the result List must contain all the keys of the own properties of target and no other values. handler.apply() proxy(..args) Function.prototype.apply() and Function.prototype.call() Reflect.apply() There are no invariants for the handler.apply method. handler.construct() new proxy(...args) ...
Regular expression syntax cheatsheet - JavaScript
groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is set. However, you can still use String.matchAll() to get all matches. \n Where "n" is a positive integer. A back reference to the last substring matc...
...ame. For example, to extract the United States area code from a phone number, we could use /\((?<area>\d\d\d)\)/. The resulting number would appear under matches.groups.area. (?:x) Non-capturing group: Matches "x" but does not remember the match. The matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Quantifiers If you are looking to contribute to this document, please also edit the original article Note: In the following, item refers not only to singular characters, but also includes character classes, Unicode property escapes, groups and ranges. Characters Meaning x* Matches the preceding item "x" 0 or more times. For example, /bo*...
...e of the tokens listed in the Values section, below. Many values have aliases or shorthand (e.g. ...
Unicode property escapes - JavaScript
Unicode property escapes Regular Expressions allows for matching characters based on their Unicode properties. A character is described by several properties which are either binary ("boolean-like") or non-binary. For instance, unicode property escapes can be used to match emojis, punctuations, letters (even letters from specific languages or scripts), etc. Note: For Unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of Unicode code points. See also RegExp.prototype.unicode. Note: Some Unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of January 2020). Syntax The following s...
...e of the tokens listed in the Values section, below. Many values have aliases or shorthand (e.g. the value Decimal_Number for the General_Category property may be written Nd, digit, or Decimal_Number). For most values, the UnicodePropertyName part and equals sign may be omitted. If a UnicodePropertyName is specified, the value must correspond to the property type given. Note: As there are many properties and values available, we will not describe them exhaustively here but rather provide various examples Rationale Before ES2018 there was no performance-efficient way to match characters from different sets based on scripts (like Macedonian, Greek, Georgian etc.) or propertyName (like Emoji etc) in JavaScript. Check out tc39 Proposal on Unicode Property Escapes for more info. Examples General ...
...on of all the subcategories using short aliases) story.match(/\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}/gu); Scripts and script extensions Some languages use different scripts for their writing system. For instance, English and Spanish are written using the Latin script while Arabic and Russian are written with other scripts (respectively Arabic and Cyrillic). The Script and Script_Extensions Unicode properties allow regular expression to match characters according to the script they are mainly used with (Script) or according to the set of scripts they belong to (Script_Extensions). For example, A belongs to the Latin script and ? to the Greek script. let mixedCharacters = "a??"; // Using the canonical "long" name of the script mixedCharacters.match(/\p{Script=Latin}/u); // a // Using a short alias ...
Memory Management - JavaScript
hms and their respective limitations. References The main concept that garbage collection algorithms rely on is the concept of reference. Within the context of memory management, an object is said to reference another object if the former has access to the latter (either implicitly or explicitly). For instance, a JavaScript object has a reference to its prototype (implicit reference) and to its properties values (explicit reference). In this context, the notion of an "object" is extended to something broader than regular JavaScript objects and also contain function scopes (or the global lexical scope). Reference-counting garbage collection This is the most naive garbage collection algorithm. This algorithm reduces the problem from determining whether or not an object is still needed to determin...
...age collection algorithm. This algorithm reduces the problem from determining whether or not an object is still needed to determining if an object still has any other objects referencing it. An object is said to be "garbage", or collectible if there are zero references pointing to it. Example var x = { a: { b: 2 } }; // 2 objects are created. One is referenced by the other as one of its properties. // The other is referenced by virtue of being assigned to the 'x' variable. // Obviously, none can be garbage-collected. var y = x; // The 'y' variable is the second thing that has a reference to the object. x = 1; // Now, the object that was originally in 'x' has a unique reference // embodied by the 'y' variable. var z = y.a; // Reference to 'a' property ...
...ver its 'a' property is still referenced by // the 'z' variable, so it cannot be freed. z = null; // The 'a' property of the object originally in x // has zero references to it. It can be garbage collected. Limitation: Circular references There is a limitation when it comes to circular references. In the following example, two objects are created with properties that reference one another, thus creating a cycle. They will go out of scope after the function call has completed. At that point they become unneeded and their allocated memory should be reclaimed. However, the reference-counting algorithm will not consider them reclaimable since each of the two objects has at least one reference pointing to them, resulting in neither of them being marked for ga...
TypeError: can't define property "x": "obj" is not extensible - JavaScript
The JavaScript exception "can't define property "x": "obj" is not extensible" occurs when Object.preventExtensions() marked 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. Message TypeError: Cannot create property for a non-extensible object (Edge) TypeError: can't define property "x": "obj" is not extensible (Firefox) TypeError: Cannot define property: "x", object is not extensible. (Chrome) Error type TypeError What went wrong? Usually, an object is extensible and new properties can be added to it. However, in this case Object.preventExtensions() marked 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. Examp...
...In sloppy mode, the addition of the "x" property is silently ignored. ...
...In sloppy mode, the addition of the "x" property is silently ignored. ...
SyntaxError: missing : after property id - JavaScript
var obj = { propertyKey: 'value' }; Examples Colons vs. ...
... var obj = { propertyKey: 'value' }; Examples Colons vs. equal signs This code fails, as the equal sign can't be used this way in this object initializer syntax. ...
... as the equal sign can't be used this way in this object initializer syntax. var obj = { propertyKey = 'value' }; // SyntaxError: missing : after property id Correct would be to use a colon, or to use square brackets to assign a new property after the object has been created already. var obj = { propertyKey: 'value' }; // or alternatively var obj = { }; obj['propertyKey'] = 'value'; Empty properties You can't create empty properties like this: var obj = { propertyKey; }; // SyntaxError: missing : after property id If you need to define a property without a value, you might use null as a value. var obj = { propertyKey: null }; Computed properties If you create a property key from an expression, you need to use square brackets. Otherwise the property name can't be computed: var obj = {...
TypeError: "x" is read-only - JavaScript
The global variable or object property that was assigned to is a read-only property. ...
...ome) TypeError: Cannot assign to read only property '0' of [object Array] (Chrome) Error type TypeError What went wrong? The global variable or object property that was assigned to is a read-only property. (Technically, it is a non-writable data property.) 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]++; // TypeErro...
... 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 silence the infamous "undefined is not a function" error by doing this: 'use strict'; undefined = function() {}; // TypeError: "undefined" is read-only Valid cases 'use strict'; var obj...
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. The arguments object is a local variable available within all non-arrow functions. You can refer to a function's arguments inside that function by using its arguments object. It has entries for each argument the function was called with, with the first entry's index at 0. For ...
...ument 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 object, you can use ES2015's Array.from() method or spread syntax to convert arguments t...
... want to count how many parameters a function is declared to accept, inspect that function's length property. Using typeof with arguments The typeof operator returns 'object' when used with arguments console.log(typeof arguments); // 'object' The type of individual arguments can be determined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument Properties arguments.callee Reference to the currently executing function that the arguments belong to. Forbidden in strict mode. arguments.length The number of arguments that were passed to the function. arguments[@@iterator] Returns a new Array iterator object that contains the values for each index in arguments. Examples Defining a function that concatenates several strings This example defin...
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. 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 ...
...or 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. ...
...The currently executing function. arguments.caller : The function that invoked the currently executing function. arguments.length: The number of arguments passed to the function. Defining method functions Getter and setter functions You can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that supports the addition of new properties. The syntax for defining getters and setters uses the object literal syntax. get Binds an object property to a function that will be called when that property is looked up. set Binds an object property to a function to be called when there is an attempt to set that property. Method definition syntax Starting with ECMAScript 2015, you are able to define own methods in a shorter syntax...
Intl.Collator.prototype.resolvedOptions() - JavaScript
The Intl.Collator.prototype.resolvedOptions() method returns 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. 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 langua...
...scription 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. ...
...vided 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 these properties, they are omitted. Examples Using the resolvedOptions method var de = new Intl.Collator('de', { sensitivity: 'base' }) var usedOptions = de.resolvedOptions(); usedOptions.locale; // "de" usedOptions.usage; // "sort" usedOptions.sensitivity; // "base" usedOptions.ignorePunctuation; // false usedOptions.collation; // "default" usedOptions.numeric; ...
Intl.DateTimeFormat() constructor - JavaScript
, "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". 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 val...
...e "h11", "h12", "h23", or "h24". This option overrides the hc language tag, if both are present, and the hour12 option takes precedence in case both options have been specified. formatMatcher The format matching algorithm to use. Possible values are "basic" and "best fit"; the default is "best fit". See the following paragraphs for information about the use of this property. The following properties describe the date-time components to use in formatted output, and their desired representations. Implementations are required to support at least the following subsets: weekday, year, month, day, hour, minute, second weekday, year, month, day year, month, day year, month month, day hour, minute, second hour, minute Implementations may support other subsets, and requests will ...
...entation of the minute. Possible values are "numeric", "2-digit". second The representation of the second. Possible values are "numeric", "2-digit". timeZoneName The representation of the time zone name. Possible values are: "long" (e.g., British Summer Time) "short" (e.g., GMT+1) The default value for each date-time component property is undefined, but if all component properties are undefined, then year, month, and day are assumed to be "numeric". Examples Using DateTimeFormat In basic use without specifying a locale, DateTimeFormat uses the default locale and default options. var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); // toLocaleString without arguments depends on the implementation, // the default locale, and the default time zone console.log(new Int...
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 given loc...
...e 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 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 prop...
...aximumFractionDigits 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 at least one of them was provided in the options argument. Examples Using the resolvedOptions method var de = new Intl.PluralRules('de-DE'); var usedOptions = de.resolvedOptions(); usedOptions.locale; // "de-DE" usedOptions.maximumFractionDigits; // 3 usedOptions.minimumFractionDigits; // 0 usedOptions.minimumIntegerDigits; // 1 usedOptions.pluralCategorie...
JSON - JavaScript
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. ...
... 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. Static methods JSON.parse(text[, reviver]) Parse the string text as JSON, optionally transform the produced value and its properties, and return the value. Any violations of the JSON syntax, including those pertaining to the differences between JavaScript and JSON, cause a SyntaxError to be thrown. The reviver option allows for interpreting what the replacer has used to stand in for other datatypes. JSON.stringify(value[, replacer[, space]]) Return a JSON string corresponding to the specified value, optionally including only...
...urn the value. Any violations of the JSON syntax, including those pertaining to the differences between JavaScript and JSON, cause a SyntaxError to be thrown. The reviver option allows for interpreting what the replacer has used to stand in for other datatypes. JSON.stringify(value[, replacer[, space]]) Return a JSON string corresponding to the specified value, optionally including only certain properties or replacing property values in a user-defined manner. By default, all instances of undefined are replaced with null, and other unsupported native data types are censored. The replacer option allows for specifying other behavior. Examples Example JSON { "browsers": { "firefox": { "name": "Firefox", "pref_url": "about:config", "releases": { "1": { "rel...
Number - JavaScript
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 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 zer...
...er.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. Number.POSITIVE_INFINITY Special value representing infinity. Returned on overflow. Number.prototype Allows the addition of properties to the Number object. Static methods Number.isNaN() Determine whether the passed value is NaN. Number.isFinite() Determine whether the passed value is a finite number. Number.isInteger() Determine whether the passed value is an integer. Number.isSafeInteger() Determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1). Number.parseFloat(string) This ...
...ng([radix]) Returns a string representing the specified object in the specified radix ("base"). Overrides the Object.prototype.toString() method. Number.prototype.valueOf() Returns the primitive value of the specified object. Overrides the Object.prototype.valueOf() method. Examples Using the Number object to assign values to numeric variables The following example uses the Number object's properties to assign values to several numeric variables: const biggestNum = Number.MAX_VALUE const smallestNum = Number.MIN_VALUE const infiniteNum = Number.POSITIVE_INFINITY const negInfiniteNum = Number.NEGATIVE_INFINITY const notANum = Number.NaN Integer range for Number The following example shows the minimum and maximum integer values that can be represented as Number object. (Mor...
Object.entries() - JavaScript
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]));. ...
... 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 compatible Object.entries() support in older environments that do not natively support it, you can use any of the following: a demonstration implementation of Object.entries in the tc39/proposal-object-values-entries (if you don't need any support for IE); a polyfill in the es-shims/Object.
... property which isn't enumerable const myObj = Object.create({}, { getFoo: { value() { return this.foo; } } }); myObj.foo = 'bar'; console.log(Object.entries(myObj)); // [ ['foo', 'bar'] ] // non-object argument will be coerced to an object console.log(Object.entries('foo')); // [ ['0', 'f'], ['1', 'o'], ['2', 'o'] ] // returns an empty array for any primitive type, since primitives have no own properties console.log(Object.entries(100)); // [ ] // iterate through key-value gracefully const obj = { a: 5, b: 7, c: 9 }; for (const [key, value] of Object.entries(obj)) { console.log(`${key} ${value}`); // "a 5", "b 7", "c 9" } // Or, using array extras Object.entries(obj).forEach(([key, value]) => { console.log(`${key} ${value}`); // "a 5", "b 7", "c 9" }); Converting an Object to a Map The n...
Object.isSealed() - JavaScript
ve 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 // If you make an empty object non-extensible, // it is vacuously sealed. Object.preventExtensions(empty); Object.isSealed(empty); // === true // The same is not true of a non-empty object...
...rable 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 // If you make an empty object non-extensible, // it is vacuously sealed. Object.preventExtensions(empty); Object.isSealed(empty); // === true // The same is not true of a non-empty object, // unless its properties are all non-configurable. var hasProp = { fee: 'fie foe fum' }; Object.preventExtensions(hasProp); Object.isSealed(hasProp); // === false // But make them all non-configurable // and the object becomes sealed. Object.defineProperty(hasProp, 'fee', { configurable: false }); Object.isSealed(hasProp); // === true // The easiest way to seal an object, of course, // is Object.seal. var sealed = {}...
...alse }); Object.isSealed(hasProp); // === true // The easiest way to seal an object, of course, // is Object.seal. var sealed = {}; Object.seal(sealed); Object.isSealed(sealed); // === true // A sealed object is, by definition, non-extensible. Object.isExtensible(sealed); // === false // A sealed object might be frozen, // but it doesn't have to be. Object.isFrozen(sealed); // === true // (all properties also non-writable) var s2 = Object.seal({ p: 3 }); Object.isFrozen(s2); // === false // ('p' is still writable) var s3 = Object.seal({ get p() { return 0; } }); Object.isFrozen(s3); // === true // (only configurability matters for accessor properties) 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-ob...
Object.prototype.propertyIsEnumerable() - JavaScript
ntax 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 method returns false. Examples A basic use of propertyIsEnumerable The following example shows the use of propertyIsEnumerable on objects and arrays: var o = {}; var a = []; o.prop = 'is enumerable'; a[0] = 'is enumerable'; o.propertyIsEnumerable('prop'); // returns true a.propertyIsEnumerable(0...
...propertyIsEnumerable The following example shows the use of propertyIsEnumerable on objects and arrays: var o = {}; var a = []; o.prop = 'is enumerable'; a[0] = 'is enumerable'; o.propertyIsEnumerable('prop'); // returns true a.propertyIsEnumerable(0); // returns true User-defined vs. built-in objects The following example demonstrates the enumerability of user-defined vs. ...
... User-defined vs. built-in objects The following example demonstrates the enumerability of user-defined vs. built-in properties: var a = ['is enumerable']; a.propertyIsEnumerable(0); // returns true a.propertyIsEnumerable('length'); // returns false Math.propertyIsEnumerable('random'); // returns false this.propertyIsEnumerable('Math'); // returns false Direct vs. ...
Reflect - JavaScript
Reflect is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of proxy handlers. Reflect is not a function object, so it's not constructible. Description Unlike most global objects, Reflect is not a constructor. You cannot use it with a new operator or invoke the Reflect object as a function. All properties and methods of Reflect are static (just like the Math object). The Reflect object provides the following static functions which have the same names as the proxy handler methods. Some of these methods are also the same as corresponding methods on Object, although they do have some subtle differences between them. Static methods Reflect.apply(target, thisArgument, argumentsList) Calls a target function with arguments as speci...
...sExtensible(). 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. ...
... 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. ...
RegExp - JavaScript
from another") when the first argument is a RegExp and the second flags argument is present. A new RegExp from the arguments is created instead. When using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary. ...
...RegExp and the second flags argument is present. A new RegExp from the arguments is created instead. When using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary. For example, the following are equivalent: let re = /\w+/ let re = new RegExp('\\w+') Perl-like RegExp properties Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. (Perl is the programming language from which JavaScript modeled its regular expressions.). See 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.lastInde...
... RegExp.prototype.dotAll Whether . matches newlines or not. ...
Iteration protocols - JavaScript
. 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 invoked as a method on the iterable object. Therefore inside of the function, the this keyword can be used to 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. The iterator protocol The iterator protocol defines a standard way to produce a sequence of values (either finite ...
...The iterator protocol defines a standard way to produce a sequence of values (either finite or infinite), and potentially a return value when all values have been generated. An object is an iterator when it implements a next() method with the following semantics: Property Value next() A zero-argument function that returns an object with at least the following two properties: done (boolean) Has the value false if the iterator was able to produce the next value in the sequence. (This is equivalent to not specifying the done property altogether.) Has the value true if the iterator has completed its sequence. In this case, value optionally specifies the return value of the iterator. value Any JavaScript value returned by the iterator.
...n the sequence. (This is equivalent to not specifying the done property altogether.) Has the value true if the iterator has completed its sequence. In this case, value optionally specifies the return value of the iterator. value Any JavaScript value returned by the iterator. Can be omitted when done is true. The next() method must always return an object with appropriate properties including done and value. If a non-object value gets returned (such as false or undefined), a TypeError ("iterator.next() returned a non-object value") will be thrown. Note: It is not possible to know reflectively whether a particular object implements the iterator protocol. However, it is easy to create an object that satisfies both the iterator and iterable protocols (as shown in th...
Property accessors - JavaScript
However, the property/method distinction is little more than a convention. ...
...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. Syntax object.property object['property'] Description One can think of an object as an associative array (a.k.a. map, 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 ...
...For example, object.$1 is valid, while object.1 is not. ...
var - JavaScript
rty of the global object. This means its property descriptor cannot be changed and it cannot be deleted using delete. The corresponding name is also added to a list on the internal [[VarNames]] slot on the global environment record (which forms part of the global lexical environment). The list of names in [[VarNames]] enables the runtime to distinguish between global variables and straightforward properties on the global object. The property created on the global object for global variables, is set to be non-configurable because the identifier is to be treated as a variable, rather than a straightforward property of the global object. JavaScript has automatic memory management, and it would make no sense to be able to use the delete operator on a global variable. 'use strict'; var x = 1; globalThi...
...or on a global variable. 'use strict'; var x = 1; globalThis.hasOwnProperty('x'); // true delete globalThis.x; // TypeError in strict mode. Fails silently otherwise. delete x; // SyntaxError in strict mode. Fails silently otherwise. Note that in both NodeJS CommonJS modules and native ECMAScript modules, top-level variable declarations are scoped to the module, and are not, therefore added as properties to the global object. Unqualified identifier assignments The global object sits at the top of the scope chain. When attempting to resolve a name to a value, the scope chain is searched. This means that properties on the global object are conveniently visible from every scope, without having to qualify the names with globalThis. or window. or global.. So you can just type: function foo() { S...
... you want to create a property with that name on the global object. foo = 'f' // In non-strict mode, assumes you want to create a property named `foo` on the global object globalThis.hasOwnProperty('foo') // true In ECMAScript 5, this behavior was changed for strict mode. Assignment to an unqualified identifier in strict mode will result in a ReferenceError, to avoid the accidental creation of properties on the global object. Note that the implication of the above, is that, contrary to popular misinformation, JavaScript does not have implicit or undeclared variables, it merely has a syntax that looks like it does. var hoisting Because variable declarations (and declarations in general) are processed before any code is executed, declaring a variable anywhere in the code is equivalent to declari...
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. ...
... 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. ...
... 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. ...
The "codecs" parameter in common media types - Web media technologies
mas. audio/ogg; codecs=vorbis An Ogg file containing a Vorbis audio track. video/webm; codecs="vp8, vorbis" A WebM file containing VP8 video and/or Vorbis audio. video/mp4; codecs="avc1.4d002a" An MPEG-4 file containing AVC (H.264) video, Main Profile, Level 4.2. As is the case with any MIME type parameter, codecs must be changed to codecs* (note the asterisk character, *) if any of the properties of the codec use special characters which must be percent-encoded per RFC 2231, section 4: MIME Parameter Value and Encoded Word Extensions. You can use the JavaScript encodeURI() function to encode the parameter list; similarly, you can use decodeURI() to decode a previously encoded parameter list. When the codecs parameter is used, the specified list of codecs must include every codec used fo...
...ils. 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. The default value is 0 (not monochrome). CCC CCC indicates the chroma subsampling as three...
...ome example AV1 codec strings: av01.2.15M.10.0.100.09.16.09.0 AV1 Professional Profile, level 5.3, Main tier, 10 bits per color component, 4:2:2 chroma subsampling using ITU-R BT.2100 color primaries, transfer characteristics, and YCbCr color matrix. The studio swing representation is indicated. av01.0.15M.10 AV1 Main Profile, level 5.3, Main tier, 10 bits per color component. The remaining properties are taken from the defaults: 4:2:0 chroma subsampling, BT.709 color primaries, transfer characteristics, and matrix coefficients. Studio swing representation. ISO Base Media File Format: MP4, QuickTime, and 3GP All media types based upon the ISO Base Media File Format (ISO BMFF) share the same syntax for the codecs parameter. These media types include MPEG-4 (and, in fact, the QuickTime file f...
Populating the page: how browsers work - Web Performance
TML and CSS, the preload scanner will find the scripts and image, and start downloading them as well. To ensure the script doesn't block the process, add the async attribute, or the defer attribute if JavaScript parsing and execution order is not important. Waiting to obtain CSS doesn't block HTML parsing or downloading, but it does block JavaScript, because JavaScript is often used to query CSS properties' impact on elements. Building the CSSOM The second step in the critical rendering path is processing CSS and building the CSSOM tree. The CSS object model is similar to the DOM. The DOM and CSSOM are both trees. They are independent data structures. The browser converts the CSS rules into a map of styles it can understand and work with. The browser goes through each rule set in the CSS, creatin...
...p preferences mean an unlimited number of differing viewport sizes. In this phase, taking the viewport size into consideration, the browser determines what the dimensions of all the different boxes are going to be on the screen. Taking the size of the viewport as its base, layout generally starts with the body, laying out the dimensions of all the body's descendants, with each element's box model properties, providing placeholder space for replaced elements it doesn't know the dimensions of, such as our image. The first time the size and position of nodes are determined is called layout. Subsequent recalculations of node size and locations are called reflows. In our example, suppose the initial layout occurs before the image is returned. Since we didn't declare the size of our image, there will be...
...ickly. To ensure repainting can be done even faster than the initial paint, the drawing to the screen is generally broken down into several layers. If this occurs, then compositing is necessary. Painting can break the elements in the layout tree into layers. Promoting content into layers on the GPU (instead of the main thread on the CPU) improves paint and repaint performance. There are specific properties and elements that instantiate a layer, including <video> and <canvas>, and any element which has the CSS properties of opacity, a 3D transform, will-change, and a few others. These nodes will be painted onto their own layer, along with their descendants, unless a descendant necessitates its own layer for one (or more) of the above reasons. Layers do improve performance, but are expensive when it...
Graphic design for responsive sites - Progressive web apps (PWAs)
ed in. high res and low res image copies One option here is to create a hi res and a low res set of images, then use resolution media queries to serve the hi res images only to hi res devices. Programmatic images You should also try to use programmatic/vector graphics as much as possible, as they theoretically scale infinitely so will still look crisp at high resolutions. ...
...ges You should also try to use programmatic/vector graphics as much as possible, as they theoretically scale infinitely so will still look crisp at high resolutions. You could use CSS3 properties for generating effects like drop shadows, gradients and rounded corners, and you could also consider using SVG for other UI elements, instead of raster graphics formats. The downsides here are that CSS3 properties and SVG don't work on old browsers such as IE6-8 (although Polyfills are available, and you could build in fallbacks), and SVG isn't suitable for high detail images, such as photographs. ...
...Making your own font file can be a bit fiddly, but there are a number of good icon font services available such as font awesome. ...
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. CSS has the capacity to present content according to the media type. ...
... @page:right. For print media, you normally use appropriate length units like inches (in) and points (pt = 1/72 inch), or centimeters (cm) and millimeters (mm). It is equally appropriate to use ems (em) to match the font size, and percentages (%). You can control how the content of the document breaks across page boundaries, by using the page-break-before, page-break-after and page-break-inside properties. Example This rule sets the page margins to one inch on all four sides: @page {margin: 1in;} This rule ensures that every H1 element starts on a new page: h1 {page-break-before: always;} More details For full details of CSS support for paged media, see Paged media in the CSS Specification. Like other features of CSS, printing depends on browser choice and its settings. For example, t...
... CSS Specification. Like other features of CSS, printing depends on browser choice and its settings. For example, the Mozilla browser supplies default margins, headers, and footers for printing. Keep in mind that you can't completely control the printed format. It is impossible to anticipate every user's browser choice and settings at the time of printing. User interfaces CSS has some special properties for devices that support a user interface, like computer displays. These properties dynamically change the appearance of content as the user works with the interface. There are five special selectors: Selector Selects E:hover Any E element that has the pointer over it E:focus Any E element that has keyboard focus E:active The E element that is inv...
x - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x
Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value 0 ...
... stroke: red; stroke-width: .5px; stroke-dasharray: 2px; } tref Warning: As of SVG2 <tref> is deprecated and shouldn't be used. For <tref>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value 0 ...
...es are ignored. Value List of (<length> | <percentage>) Default value 0 Animatable Yes tspan For <tspan>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value none ...
y - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y
Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, y defines the y coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value 0 ...
... stroke: red; stroke-width: .5px; stroke-dasharray: 2px; } tref Warning: As of SVG2 <tref> is deprecated and shouldn't be used. For <tref>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, y defines the y coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value 0 ...
...es are ignored. Value List of (<length> | <percentage>) Default value 0 Animatable Yes tspan For <tspan>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, y defines the y coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. Value List of (<length> | <percentage>) Default value none ...
selection - Archive of obsolete content
election has been made."); } var selection = require("sdk/selection"); selection.on('select', myListener); // You can remove listeners too. selection.removeListener('select', myListener); Iterating Over Discontiguous Selections Discontiguous selections can be accessed by iterating over the selection module itself. Each iteration yields a Selection object from which text, html, and isContiguous properties can be accessed. Private Windows If your add-on has not opted into private browsing, then you won't see any selections made in tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. Examples Log the current contiguous selection as t...
...Setting the selection removes all current selections, inserts the specified text at the location of the first selection, and selects the new text. Getting the selection when there is no current selection returns null. Setting the selection when there is no current selection throws an exception. Getting the selection when isContiguous is tru...
simple-prefs - Archive of obsolete content
an. { "description": "Does it have tentacles?", "type": "bool", "name": "hasTentacles", "value": true, "title": "Tentacles" } boolint Displayed as a checkbox and stores an integer. A boolint is presented to the user as a checkbox, but instead of storing true or false, the "on" or "off" checkbox states are mapped to integers using "on" or "off" properties in the specification. To provide this mapping the boolint requires two mandatory attributes called "on" and "off", both of which are supplied as strings. Note that even so, the "value" property is supplied as an integer. { "type": "boolint", "name": "myBoolint", "on": "1", "off": "2", "value": 1, "title": "My Boolint" } integer Display...
... Parameters prefName : String The name of the preference to watch for changes. listener : Function The listener function that processes the event. removeListener(prefName, listener) Unregisters an event listener for the specified preference. Parameters prefName : String The name of the preference to watch for changes. listener : Function The listener function that processes the event. Properties prefs This property is an object containing the simple-prefs you have defined for your add-on. You can use it to access preference values and to change them. Suppose you've defined a preference like this: "preferences": [{ "name": "somePreference", "title": "Some preference title", "description": "Some short description for the preference", "type": "string", "va...
url - Archive of obsolete content
; // "co.uk" console.log(urls.getTLD("https://developer.mozilla.org/")); // "org" Parameters url : string The URL, as a string. Returns string : The top-level domain for the URL. URL Methods toString() Returns a string representation of the URL. Returns string : The URL as a string. toJSON() Returns a string representation of the URL. Returns string : The URL as a string. Properties scheme The name of the protocol in the URL, without the trailing ':'. Compare with protocol. For example: var url = require("sdk/url").URL("https://developer.mozilla.org/Add-ons?example=true&visible=yes#top"); console.log(url.scheme); // https userPass The username:password part of the URL, null if not present. host The host of the URL, null if not present. For example: var url = require...
.... Mirrors window.location.search. For example: var url = require("sdk/url").URL("https://developer.mozilla.org/Add-ons?example=true&visible=yes#top"); console.log(url.search); // ?example=true&visible=yes DataURL Methods 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. ...
widget - Archive of obsolete content
he listener function that was registered. getView(window) Retrieve a WidgetView instance of this widget relative to a browser window. Parameters window : BrowserWindow The BrowserWindow instance to match. Returns WidgetView : A WidgetView instance associated with the browser window. Any changes subsequently applied to this object will only be applied to the widget attached to that window. Properties label The widget's label. Read-only. content A string containing the widget's content. It can contain HTML. Setting it updates the widget's appearance immediately. However, if the widget was created using contentURL, then this property is meaningless, and setting it has no effect. contentURL The URL of content to load into the widget. This can point to local content loaded from your add-on'...
...n event listener with the widget view. 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 widget view. Parameters type : string The type of event for which listener was registered. listener : function The listener function that was registered. Properties label The widget view's label. Read-only. content A string containing the widget view's content. It can contain HTML. Setting it updates the widget view's appearance immediately. However, if the widget view was created using contentURL, then this property is meaningless, and setting it has no effect. contentURL The URL of content to load into the widget. This can point to local content load...
content/loader - Archive of obsolete content
Provides one of the building blocks for those modules that use content scripts to interact with web content, such as panel and page-mod. Usage The module exports a constructor for the Loader object, which inherits on(), once(), and removeListener() functions that enable its users to listen to events. Loader adds code to initialize and validate a set of properties for managing content scripts: contentURL contentScript contentScriptFile contentScriptWhen contentScriptOptions allow When certain of these properties are set, the Loader emits a propertyChange event, enabling its users to take the appropriate action. The Loader is used by modules that use content scripts but don't themselves load content, such as page-mod. Modules that load their own content, such as panel and page-worker...
...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. This...
content/worker - Archive of obsolete content
the contentScriptFile option. Optional. onMessage function Functions that will registered as a listener to a 'message' events. onError function Functions that will registered as a listener to an 'error' events. Worker Worker is composed from the EventEmitter trait, therefore instances of Worker and their descendants expose all the public properties exposed by EventEmitter along with additional public properties that are listed below. Methods postMessage(data) Asynchronously emits "message" events in the enclosed worker, where content script was loaded. Parameters data : number,string,JSON The data to send. Must be stringifiable to JSON. destroy() Destroy the worker by removing the content script from the page and removing all regist...
...es that are listed below. Methods postMessage(data) Asynchronously emits "message" events in the enclosed worker, where content script was loaded. Parameters data : number,string,JSON The data to send. Must be stringifiable to JSON. destroy() Destroy the worker by removing the content script from the page and removing all registered listeners. A detach event is fired just before removal. Properties port Object that allows you to: send customized messages to the worker using the port.emit function receive events from the worker using the port.on function 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...
event/target - Archive of obsolete content
objects in SDK on which events are emitted. Also see the tutorial on implementing event targets to get started with this API. Instantiation It's easy to create event target objects, no special arguments are required. const { EventTarget } = require("sdk/event/target"); let target = EventTarget(); For a convenience though optional options arguments may be used, in which case all the function properties with keys like: onMessage, onMyEvent... will be auto registered for associated 'message', 'myEvent' events on the created instance. All other properties of options will be ignored. Adding listeners EventTarget interface defines on method, that can be used to register event listeners on them for the given event type: target.on('message', function onMessage(message) { // Note: `this` pseudo va...
...ir methods chained: target.on('message', handleMessage) .on('data', parseData) .on('error', handleError); EventTarget EventTarget is an exemplar for creating an objects that can be used to add / remove event listeners on them. Events on these objects may be emitted via emit function exported by event/core module. Methods initialize() Method initializes this event source. It goes through properties of a given options and registers listeners for the ones that look like event listeners. on(type, listener) Registers an event listener that is called every time events of specified type are emitted. worker.on('message', function (data) { console.log('data received: ' + data) }); Parameters type : String The type of event. listener : Function The listener function that processes the even...
io/text-streams - Archive of obsolete content
TextReader Methods close() Closes both the stream and its backing stream. read(numChars) Reads and returns a string from the stream. If the stream is closed, an exception is thrown. Parameters numChars : number The number of characters to read. If not given, the remainder of the stream is read. Returns string : The string read. If the stream is at the end, the empty string is returned. Properties closed True if the stream is closed. TextWriter Methods close() Flushes the backing stream's buffer and closes both the stream and the backing stream. If the stream is already closed, an exception is thrown. flush() Flushes the backing stream's buffer. write(str) Writes a string to the stream. If the stream is closed, an exception is thrown. Parameters str : string The string to writ...
...ing stream are closed, also on the background thread. If the stream is already closed, an exception is thrown immediately. Parameters str : string The string to write. callback : callback callback, if given, must be a function. It's called as callback(error) when the write completes. error is an Error object or undefined if there was no error. Inside callback, this is the TextWriter object. Properties closed True if the stream is closed. ...
system/xul-app - Archive of obsolete content
For more information, see the MDN documentation. Globals Functions is(name) Checks whether the host application is the given application. Parameters name : string A host application name. Returns boolean : True if the host application is name and false otherwise. isOneOf(names) Checks whether the host application is one of the given applications. Parameters names : array An array of host application names. ...
...entation for details on version comparisons. Parameters version : string The version to compare. lowInclusive : string The lower bound of the version range to compare. The range includes this bound. highExclusive : string The upper bound of the version range to compare. The range does not 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 platf...
ui/toolbar - Archive of obsolete content
The event the listener is listening for. Toolbar supports the following events: attach, detach, show, and hide. listener : function The listener to remove. destroy() Destroys the toolbar. After calling this function, the toolbar will no longer be visible and its menu item will no longer appear in the Firefox "Toolbars" menu. Calling this function also causes the detach event to be emitted. Properties title The toolbar's title. This is read-only and must be unique. It's also not available until after the attach event is emitted. items The array of frames hosted by this toolbar. This property is read-only and is not available until after the attach event is emitted. hidden Boolean indicating whether the toolbar is hidden. This property is read-only and is not available until after the att...
...ted. hidden Boolean indicating whether the toolbar is hidden. This property is read-only and is not available until after the attach event is emitted. Events attach This event is emitted when the toolbar is first loaded. Note that since there is only one toolbar for the whole browser, opening another browser window does not cause this event to be emitted again. ...
window/utils - Archive of obsolete content
nt and an optional hash of options as its second argument. var { open } = require('sdk/window/utils'); var window = open('data:text/html,Hello Window'); This function wraps nsIWindowWatcher.openWindow. Parameters uri : string URI of the document to be loaded into the window. Only chrome, resource, and data schemes are accepted. options : object Options for the function, with the following properties: Name Type parent nsIDOMWindow Parent for the new window. Optional, defaults to null. name string Name that is assigned to the window. Optional, defaults to null. features object Map of features to set for the window, defined like this: { width: 10, height: 15, chrome: true }. See the window.open features documentation f...
... args object Extra argument(s) to be attached to the new window as the window.arguments property. Returns nsIDOMWindow openDialog(options) Opens a top level window and returns its nsIDOMWindow representation. This is the same as open, but you can supply more features. It wraps window.openDialog. Parameters options : object Options for the function, with the following properties: Name Type url string URI of the document to be loaded into the window. Defaults to "chrome://browser/content/browser.xul". name string Optional name that is assigned to the window. Defaults to "_blank". features string Map of features to set for the window, defined like: { width: 10, height: 15, chrome: true }. For the ...
File I/O - Archive of obsolete content
Getting files in special directories Components.utils.import("resource://gre/modules/FileUtils.jsm"); // get the "data.txt" file in the profile directory var file = FileUtils.getFile("ProfD", ["data.txt"]); Or the same without using FileUtils.jsm: // Get profile directory. var file = Components.classes["@mozilla.org/file/directory_service;1"]. getService(Components.interfaces.nsIProperties). get("ProfD", Components.interfaces.nsIFile); // Or using Services.jsm and Ci = Components.interfaces var file = Services.dirsvc.get("ProfD", Ci.nsIFile); // Append the file name. file.append("data.txt"); // Note: "file" is an object that implements nsIFile. If you want the // file system path, use file.path Note: file is an object that implements nsIFile. If you want the file s...
...mozilla.org/network/safe-file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); stream.init(aFile, 0x04 | 0x08 | 0x20, 0600, 0); // readwrite, create, truncate stream.write(pngBinary, pngBinary.length); if (stream instanceof Components.interfaces.nsISafeOutputStream) { stream.finish(); } else { stream.close(); } More There are more methods and properties on nsIFile and nsILocalFile interfaces; please refer to their documentation for more details. Those methods/properties are mostly self-explanatory, so we haven't included examples of using them here. ...
Sidebar - Archive of obsolete content
have been known to complain about this "feature", and if two or more extensions try to open their sidebars on startup, the user will see a flurry of sidebars opening and closing with which ever extension going last "winning". Web panels sidebar Content such as web pages can be safely loaded as sidebar in the "viewWebPanelsSidebar". Bookmarks with "Load this bookmark in sidebar" checked in the properties open in the "viewWebPanelsSidebar". A web page can use window.sidebar to create bookmark with that property. To open a page in the "viewWebPanelsSidebar" from chrome code (browser/addon/extension) such as from menuitem, it can call: openWebPanel(aTitle, aURI); Accessing the sidebar from a browser.xul script The sidebar content is always in a document separate from the main browser document (t...
...sidebar from a browser.xul script The sidebar content is always in a document separate from the main browser document (the sidebar is actually implemented as a XUL browser element). This means you can't directly access the sidebar content from a script referenced from a browser.xul overlay. To access your sidebar's window or document objects, you need to use the contentWindow or contentDocument properties of document.getElementById("sidebar") respectively. For example the code below calls a function defined in the sidebar's context: var sidebarWindow = document.getElementById("sidebar").contentWindow; // Verify that our sidebar is open at this moment: if (sidebarWindow.location.href == "chrome://yourextension/content/whatever.xul") { // call "yourNotificationFunction" in the sidebar's con...
StringView - Archive of obsolete content
For actually supported values see here. buffer Read only arrayBuffer The buffer to be shared between stringView.rawData and stringView.bufferView view references. rawData Read only arrayBufferView An arrayBufferView con...
... length Optional A number expressing the length in codepoints of the new stringView. If not specified it will take the length of the input. Examples var myStringView = StringView.makeFromBase64("SGVsbG8gd29ybGQh"); alert(myStringView) // "Hello world!" This function is useful in order to pass binary data containing strings. See also this example. StringView instances' properties encoding A string expressing the encoding type. For possible values see here. buffer The buffer to be shared between stringView.rawData and stringView.bufferView view references. rawData An arrayBufferView containing the representation of the string as an array of 8-bit, 16-bit, or 32-bit integers (depending on the chosen encoding). bufferView An arrayBufferView containing the...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
You also have to make one small change to the makefile in the same directory, adding the follow...
...You also have to make one small change to the makefile in the same directory, adding the following line: USE_EXTENSION_MA...
Appendix F: Monitoring DOM changes - Archive of obsolete content
hNodes._i++); const XHTML = 'http://www.w3.org/1999/xhtml'; doc = doc || document; let style = doc.createElementNS(XHTML, 'style'); style.setAttribute('type', 'text/css'); let preamble = ' @-moz-keyframes ' + EVENT + ' { \n\ from { clip: rect(1px, auto, auto, auto); } to { clip: rect(0px, auto, auto, auto); } \n\ }\n'; let properties = [ 'animation-duration: 0.0001s;', 'animation-name: ' + EVENT + ' !important;' ]; properties = properties.map(function (prop) ' ' + watchNodes.NAMESPACE + prop) .join('\n'); doc.addEventListener('animationstart', listener, false); function listener(event) { if (event.animationName == EVENT...
...Content code // should make do without weak references. ...
Setting Up a Development Environment - Archive of obsolete content
at 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 download, this is ...
... If everything went well, you should see an output similar to this: Creating XPI file. adding: install.rdf (deflated 50%) adding: chrome.manifest (deflated 50%) adding: content/browserOverlay.js (deflated 42%) adding: content/browserOverlay.xul (deflated 69%) adding: skin/browserOverlay.css (stored 0%) adding: locale/browserOverlay.dtd (deflated 52%) adding: locale/browserOverlay.properties (stored 0%) Creating XPI file. Done! Build finished successfully. If you inspect the bin directory, you should see the xulschoolhello2.xpi file. If you run make again, you'll only see the last line of the build process. That is because make can tell that the file in the bin directory is up to date, and nothing needs to be done. Making changes on source files will make make run the necessary...
chargingchange - Archive of obsolete content
Property Type Description BatteryManager.charging boolean The system's battery charging status. ...
... The chargingchange event is fired when the charging attribute of the battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.charging boolean The system's battery charging status. Returns true if the battery is charging, if the state of the system's battery is not determinable, or if no battery is attached to the system. Returns false if the battery is discharging. Read only. Example navigator.getBattery().then(function(battery) { console.
levelchange - Archive of obsolete content
Property Type Description BatteryManager.level double (float) The system's battery charging level scaled from 0 to 1.0. ...
... The levelchange event is fired when the level attribute of the battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.level double (float) The system's battery charging level scaled from 0 to 1.0. Returns 0 if the battery is empty and the system is about to suspend. Returns 1.0 if the battery is full, if the implementation is unable to report the battery's level, or if there is no battery attached to the system. Read only. Example navigator...
Index of archived content - Archive of obsolete content
Interacting with page scripts Loading Content Scripts Reddit Example port self Contributor's Guide Classes and Inheritance Content Processes Getting Started Modules Private Properties Firefox Compatibility Module structure of the SDK Porting the Library Detector Program ID SDK API Lifecycle SDK and XUL Comparison Testing the Add-on SDK Two Types of Scripts Working with Events XUL Migration Guide ...
...igger.installChrome InstallTrigger.startSoftwareUpdate Trigger Scripts and Install Scripts Windows Install File Object Methods Install Object Methods Properties InstallVersion Object Methods Properties Return Codes WinProfile Object Methods WinReg Object ...
Bookmark Keywords - Archive of obsolete content
ile the bookmark into a folder by using the "File Bookmark..." menu option. To open the Bookmark manager go to "bookmarks" menu and select the "Manage Bookmarks" option. This will open up the Bookmark manager. In Figure 2, we can see the bookmark has been filed into a folder called "Widgets." You can create a folder with another name, or not put your keymarks into a folder at all. Changing the Properties To alter the properties of the bookmark, highlight the bookmark and select the "Properties..." button at the top of the Bookmark manager. This will open up a dialog box that will let you edit the properties of the bookmark. The original title of the bookmark won't apply. You can name the bookmark whatever you want, but it's often handy to make the title very similar to the keyword you plan to us...
...up a Google Keymark To set up a keymark that will search Google directly form the address bar, go to Google and run a search for any word. Once you get a result page, bookmark that page. You'll need to replace the word for which you searched. One such example, with the relevant term highlighted, is shown in Figure 7. Once this result page has been bookmarked, we need only adjust the boookmark's properties. In this case, we'll give it a keyword and title of google and replace the term "geitost" with the %s, as shown (with extra highlighting) in Figure 8. Now we can run Google searches straight from the address bar. These searches can be as complex as Google will tolerate, since the entered data will be converted to URL-encoded text before it's sent to the Google servers. Thus we could type any of ...
Creating a Firefox sidebar extension - Archive of obsolete content
ifierskey keys from the dtd, remove the <keyset> from the firefoxOverlay.xul file. One must then set the key attribute of the menuitem to "". The extension needs to provide some special manifest files that control how it is installed and where its chrome resources are stored. The first is install.rdf, the install manifest. See Install Manifests for a complete listing of the required and optional properties. The install manifest is listed in Example 5. Example 5. install.rdf <?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"> <em:id>emptysidebar@yourdomain.com</em:id> <em:name>EmptySidebar Extension</em:name> <em:version>1.0</em:version> ...
...xVersion> </Description> </em:targetApplication> </Description> </RDF> The other manifest file is chrome.manifest, the chrome manifest file. The chrome manifest creates a lookup for all the resource types used by the extension. The manifest also tells Firefox that the extension has an overlay that needs to be merged into the browser. For more information on chrome manifests and the properties they support, see the Chrome Manifest reference. The manifest used in this extension is listed in Example 6. Example 6. chrome.manifest content emptysidebar chrome/content/ locale emptysidebar en-US chrome/locale/ skin emptysidebar classic/1.0 chrome/skin/ overlay chrome://browser/content/browser.xul chrome://emptysidebar/content/firefoxOverlay.xul Test While you're developing your sidebar...
Dehydra Function Reference - Archive of obsolete content
process_type(type) Dehydra calls this for each class, struct, enum, union, and typedef declaration. process_type is called after process_function is called for all the member functions. ...
...hould be reported for the warning. If no location is provided, the location is inferred from the last process_type or process_function. _print(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.
Drag and Drop Example - Archive of obsolete content
to create an element of a particular type. First, we'll add the wrapper scripts: <script src="chrome://global/content/nsDragAndDrop.js"/> <script src="chrome://global/content/nsTransferable.js"/> <script src="dragboard.js"/> An additional script file dragboard.js is included which will contain the code we will write ourselves. The board will be created using a stack element. We'll use some style properties to set the width and height of the stack. A maximum size is also specified so that it doesn't resize when new elements are dragged onto it. The board will need to respond to the dragdrop event so that an element is created when the user drags onto it. <stack id="board" style="width:300px; height: 300px; max-width: 300px; max-height: 300px" ondragover="nsDragAndDrop.dragOver(event, b...
...n 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 window. The label attribute is set to ...
Twitter - Archive of obsolete content
Most of Twitter's methods are supported, but not all. List methods, spam reporting methods, and OAuth are not currently supported. If something is not supported but you would like it 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 s...
...equest is the XHR used in the request. textStatus is a simple string describing the type of error. errorThrown is an exception object, if one was thrown. The examples below all use this first, simpler style. The second style will be familiar if you have used jQuery.ajax() -- in fact the object is passed as-is (almost) to it. In other words, define a data property that is itself an object whose properties correspond to the parameters of the Twitter method. With this style you can use any of the various jQuery.ajax() options in your request: data, success, complete, etc. Example: jetpack.lib.twitter.statuses.update({ data: { status: "O frabjous day!" }, username: "basic_auth_username", password: "basic_auth_password", success: function () console.log("Hey!") }); User authentication Y...
Message Summary Database - Archive of obsolete content
which message a message is in reply to, etc. This allows us to store watch/ignore information on a thread object, and avoids having to generate threading information whenever a folder is open. This has arguably been more trouble than it's been worth, especially when we've threaded incorrectly. Meta Information The nsIDBFolderInfo interface handles the folder meta data. This also supports generic properties. There is a method on nsIMsgDatabase to get the dbFolderInfo. Mork - the Good, the Bad, and the Ugly Mork has a horrible reputation and we're always asked why we don't just replace it with some other db. The bottom line is that we haven't been able to justify the very large cost of doing so because there won't be any benefit to the end-user, at least in the short term. Here are some of the trade...
...here are very few bugs in the Mork code. Mork loads the whole database in memory, and keeps it there. This makes it very fast to access our database objects, but it does increase memory usage. Mork assumes the caller will do file locking, so two processes or threads writing to the same database can corrupt it. But I believe sql-lite has the same problem. Mork is schema-less. This means we can add properties to rows arbitrarily. And we only pay the storage cost for a property if the row has the property set. We can still index on these properties, if we want. We would need the equivalent capabilities if we replaced Mork. ...
Monitoring downloads - Archive of obsolete content
this.dlMgr = Components.classes["@mozilla.org/download-manager;1"] .getService(Components.interfaces.nsIDownloadManager); this.dlMgr.addListener(downloadlogger); // Open the database, placing its file in the profile directory this.dbFile = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsIFile); this.dbFile.append("downloadlogger.sqlite"); // Get access to the storage service and open the database this.storageService = Components.classes["@mozilla.org/storage/service;1"] .getService(Components.interfaces.mozIStorageService); var dbConn = this.storageService.openDatabase(this.dbFile); ...
... it doesn't monitor for further changes to the log. It simply displays the state of downloads at the moment the window was opened. ...
File object - Archive of obsolete content
ed, leading and trailing spaces are removed from the filename, so new File(" abc.txt ") just creates a file called abc.txt. Filenames starting and ending with the pipe symbol (|) are interpreted as pipes. Readable pipelines (i.e. pipe to programs generating output on stdout) begin with the pipe symbol; writeable pipelines end with the pipe symbol. Bi-directional pipelines are not supported. Properties Static Properties File.input A File object that represents the standard input (stdin). File.currentDir A File object that represents the standard output (stdout). File.currentDir A File object that represents the standard error (stderr). File.currentDir A File object referring to the current directory; this property may be set. File.separator The system name separator (slash on UNIX)...
...erties File.input A File object that represents the standard input (stdin). File.currentDir A File object that represents the standard output (stdout). File.currentDir A File object that represents the standard error (stderr). File.currentDir A File object referring to the current directory; this property may be set. File.separator The system name separator (slash on UNIX). Instance Properties File.length The length of the file in bytes, or the number of entries in the directory. Note: calculating the length of the directory is very expensive. File.parent The directory containing the file. File.path The canonical path to the file. File.name The name of the file. File.isDirectory True if the file is a directory. File.isFile True if the file is a file. File.exists True if...
XBL 1.0 Reference - Archive of obsolete content
specified by the binding. Bindings can be bound to elements using Cascading Style Sheets (CSS) or DOM. One element can be bound to several bindings at once. Functionally bindings should be correlated with Behaviors and Viewlink but being implemented as one integrated XML solution. Bindings can contain event handlers that are registered on the bound element, an implementation of new methods and properties that become accessible from the bound element, and anonymous content that is inserted around the bound element. There are numerous adjustments in the current implementation in comparison of earlier XBL proposals, and not all of them are reflected yet in this document. The documentation process is still in progress: please keep it in your mind while using the provided information. XBL Elements...
... This example is targeted to demonstrate the XBL usage rather than to be a practically useful application. For this reason it contains many comments and some blocks could be avoided in a more compact solution yet used here for demonstration purposes. notes.ht...
XBL - Archive of obsolete content
o called Extensible Bindings Language) is a language for describing bindings that can be attached to elements in other documents. The element that the binding is attached to, called the bound element, acquires the new behavior specified by the binding. Bindings can contain event handlers that are registered on the bound element, an implementation of new methods and properties that become accessible from the bound element, and anonymous content that is inserted underneath the bound element. Most XUL widgets are at least partially implemented using XBL. You can build your own reusable widgets from existing XUL, HTML, SVG, and other primitives using XBL. Specifications ...
...ently a working draft, 2005) stands for SVG's XML Binding Language. It is supposed to include a subset of XBL 2.0 features needed for SVG. It's similar in spirit to Mozilla's XBL, but there are a few subtle (and not-so-subtle) differences. For example, names of the elements are different. Also sXBL lacks some features of XBL, such as bindings inheritance and defining methods/properties on bound elements. XBL 2.0 (W3C Candidate Recommendation) was developed to address problems found in XBL 1.0 and to allow for implementations in a broader range of Web browsers. In 2009 Mozilla announced plans to implement XBL2 in future versions of Gecko. Some differences between sXBL and XBL2 are lis...
List of commands - Archive of obsolete content
nkey/sou...torOverlay.xul http://lxr.mozilla.org/seamonkey/sou...onalToolbar.js http://lxr.mozilla.org/seamonkey/sou...rceOverlay.xul http://lxr.mozilla.org/seamonkey/sou...extOverlay.xul http://lxr.mozilla.org/seamonkey/sou...lityOverlay.js http://lxr.mozilla.org/seamonkey/sou...oomOverlay.xul http://lxr.mozilla.org/seamonkey/sou...torOverlay.xul http://lxr.mozilla.org/seamonkey/sou...ark.properties http://lxr.mozilla.org/seamonkey/sou...kmarks-temp.js http://lxr.mozilla.org/seamonkey/sou.../bookmarks.xml http://lxr.mozilla.org/seamonkey/sou...rksOverlay.xul http://lxr.mozilla.org/seamonkey/sou...okmarksTree.js List of commands (listed alphabetically) Browser:AddBookmark Browser:AddBookmarkAs Browser:AddGroupmarkAs Browser:Back Browser:EditPage Browser:Find Browser:FindAgain...
...rowser:Print Browser:PrintPreview Browser:SavePage Browser:SearchInternet Browser:SendPage Browser:UploadFile cmd_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_expandfolder cmd_bm_export cmd_bm_find cmd_bm_import cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_newseparator cmd_bm_open cmd_bm_openinnewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectAll cmd_bm_setnewbookmarkfolder cmd_bm_setnewsearchfolder cmd_bm_setpersonaltoolbarfolder cmd_bm_sortfolder cmd_bm_sortfolderbyname cmd_close cmd_closeOtherTabs cmd_closeWindow cmd_copy cmd_copyImage cmd_copyLink cmd_cut cmd_delete cmd_editPage cmd_findTypeLinks cmd_findTypeText cmd_goToLine cmd_handleBackspace cmd_handleShiftBackspace cmd_minimize...
appendNotification - Archive of obsolete content
he 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 notification box. See Notification box events. ...
...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. ...
Extensions - Archive of obsolete content
as Context Clicked Firefox uses its own popupshowing event listener to adjust the items on the context menu. This allows the menu to have different commands for different types of targets. While the popup is open, the gContextMenu global variable is set to an object which handles all of the functionality specific to the Firefox context menu. ...
...he popup is open, the gContextMenu global variable is set to an object which handles all of the functionality specific to the Firefox context menu. Specifically, this object is initialized with a set of properties that indiciate the type of object that was the target of the context menu. For instance, the 'onLink' property is set to true when a link was context-clicked. You may wish to use these properties instead of determining the type yourself, as the code already handles various special and complex cases that would take a lot of code to deal with manually. The following are the most common properties that you can check. An example follows. target The element that was context clicked. If the keyboard was used to open a context menu, this will be the focused element. onTextI...
Menus - Archive of obsolete content
up or down arrow on the keyboard, then pressing the return key or right arrow key will open the menu. If it were a menuitem, then pressing the return key would have launched the command associated with it. There may be occasion to access or set this programatically with a script. If the menu has been created using a menulist, this is easily accomplished using the selectedItem or selectedIndex properties. However, it is not possible to use these properties for menus whose popup is the child of menu, button, or toolbarbutton. However, there is a way to access the active item using the nsIMenuBoxObject interface: activeItem = xulMenu.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject).activeChild; where xulMenu is the menu, button, or toolbarbutton object. You can set the active ...
... deactivate all items, and keyboard navigation will start from the top of the menu. It should be noted that setting the active item in this way will not affect the selected property or selected attribute of the previously and newly activated item. You must unset/set those explicity for each item affected, if you want them to be. For menulists, however, setting the selectedItem or selectedIndex properties on the menu will automatically take care of that for you. ...
Introduction to XBL - Archive of obsolete content
owever, XUL provides no means in which you can change how an element works (or add a new element which can be reused). For example, you might want to change how the pieces of a scroll bar function. For this, you need XBL. An XBL file contains a set of bindings. Each binding describes the behavior of a XUL widget. For example, a binding might be attached to a scroll bar. The behavior describes the properties and methods of the scroll bar in addition to describing the XUL elements that make up a scroll bar. Like XUL, XBL is an XML language, so it has similar syntax rules. The following example shows the basic skeleton of an XBL file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="binding1"> <!-- content, property, method and event descriptions go here --> </bi...
...pecific binding, much like how you would point to an anchor in an HTML file. You will usually put all of your bindings in a single file. The result in this example, is that all scrollbar elements will have their behavior described by the binding 'binding1'. A binding has five types of things that it declares: Content: child elements that are added to the element that the binding is bound to. Properties: properties added to the element. They can be accessed through a script. Methods: methods added to the element. They can be called from a script. Events: events, such as mouse clicks and keypresses that the element will respond to. The binding can add scripts to provide default handling. In addition new events can be defined. Style: custom style properties that the XBL defined element has. ...
Templates - Archive of obsolete content
hich is used only for trees. Content Builder The content builder takes the content inside the template element and duplicates it for each row. For instance, if the user had ten bookmarks in the example above, ten label elements would be created and added as children of the vbox element. If you were to use DOM functions to traverse the tree, you will find these elements there and can query their properties. These elements get displayed, but the template itself is not displayed, although it still exists in the document tree. In addition, the id of each of the labels will be set to the RDF resource for that row. The content builder always starts at the place where uri="rdf:*" is specfied. If the uri attribute is placed on an element lower in the element tree, the elements outside are only created on...
...nd, doesn't generate the DOM elements for the rows. Instead, it gets the data directly from the RDF datasource whenever it needs it. Since trees are often expected to display thousands of rows of data, this is much more efficient. Creating an element for every cell would be too costly. However, the tradeoff is that trees may only display text, and, since no elements are created, you can't use CSS properties to style tree cells in the same way. The tree builder is only used for trees. Other elements use only the content builder. This isn't a problem though, since other elements such as menus wouldn't be expected to display too many items. It's also possible to use the content builder for trees as well, and a treeitem element and related elements will be created for each row. Rules In the image of ...
XPCOM Interfaces - Archive of obsolete content
lity that could be implemented by components. Components are what implement the code in Mozilla that does things. Each component implements the functionality as described by interfaces. A single component might implement multiple interfaces. And multiple components might implement the same interface. Let's take an example of a file component. An interface would need to be created which describes properties and functions that can be performed on files. A file would need properties for its name, modification date and its size. Functions of a file would include moving, copying and deleting it. The File interface only describes the characteristics of a file, it does not implement it. The implementation of the File interface is left to a component. The component will have code which can retrieve the fi...
...nceof operator returns true if aFile implements the nsILocalFile interface. This also has the side effect of calling QueryInterface(), so aFile will be a valid nsILocalFile afterwards. Calling the Functions of an Interface Now that we have an object that refers to a component with the nsILocalFile interface, we can call the functions of nsILocalFile through it. The table below shows some of the properties and methods of the nsILocalFile interface. initWithPath This method is used to initialize the path and filename for the nsILocalFile. The first parameter should be the file path, such as '/usr/local/mozilla'. leafName The filename without the directory part. fileSize The size of the file. isDirectory() Returns true if the nsILocalFile represents a directory. remove(recursive) Del...
XUL Questions and Answers - Archive of obsolete content
"2" label="vghjkvk" checked="true"/> <listitem type="checkbox" value="3" label="hukfzgjcfj" disabled="true"/> </listbox> </window> List box handlers can only check for listitems not listcells. If user wants checkbox support for multicolumn lists, then they will have to implement one. Are XUL attributes integers? XUL attributes such as left="100" or top="200", as well as corresponding properties, look as if they're integers but they are actually handled as strings. To convert them to integers use the parseInt() JavaScript function. While the attributes are always strings per the DOM specification, the properties will eventually be fixed to return the value with the correct type. Using the "icon" attribute on a button From XULPlanet.com reference: This attribute should be used to ...
...attribute on a button From XULPlanet.com reference: 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. How to use Dynamic Objects in Toolbar There may be a few ways to implement this: By building your menupopup from an RDF datasource, which could be generated on the server. By getting data (e.g. JSON string) from the server, parsing it on client,...
action - Archive of obsolete content
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width Me...
assign - Archive of obsolete content
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". ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
bbox - Archive of obsolete content
Archive › Mozilla › XUL › bbox
It is equivalent to using an hbox element with an align attribute set to baseline. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
box - Archive of obsolete content
Archive › Mozilla › XUL › box
If the box has an orient attribute that is set to horizontal, the child elements are laid out from left to right in the order that they appear in the box. If orient is set to vertical, the child elements are laid out from top to bottom. Child elements do not overlap. The default orientation is horizontal. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
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. For menuitems or buttons that just want to have their disabled status set when the feature should be disabled, you should use a command element instead. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
broadcasterset - Archive of obsolete content
The broadcasterset and its descendants are not displayed. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
caption - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A header for a groupbox. It may contain either a text label, using the label attribute, or child elements for a more complex caption. More information is available in the XUL tutorial. Attributes accesskey, crop, image, label, tabindex Properties accessKey, crop, image, label, tabIndex Examples <groupbox> <caption label="My groupbox"/> </groupbox> <groupbox flex="1"> <caption> <checkbox label="A checked groupbox"/> </caption> </groupbox> Attributes accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. ...
.... 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. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. crop Type: string Gets and sets the value of the crop attribute. image Type: image URL Gets and sets the value of the image attribute. label Type: string Gets and sets the value of the label attribute. tabIndex ...
colorpicker - Archive of obsolete content
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. ...
...r in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. type Type: 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 s...
column - Archive of obsolete content
Each child of the column element is placed in each successive cell of the grid. The column with the most child elements determines the number of rows in each column. It is common to use columns only to define width and flexibility for the grid column and not place elements directly inside the column. More information is available in the XUL tutorial. Example See grid for an example. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
columns - Archive of obsolete content
Child column elements define the individual columns to appear in the grid. The columns element may be nested inside another columns element. Other elements placed inside a columns element occupy the full height of the grid and are placed in their corresponding positions between the columns. More information about columns is available in the XUL tutorial. Example See grid for an example. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
conditions - Archive of obsolete content
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
The grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
grippy - Archive of obsolete content
More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
hbox - Archive of obsolete content
Archive › Mozilla › XUL › hbox
This is equivalent to the box element, except it defaults to horizontal orientation. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
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 appears in ...
...is 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. href Type: string Defines a URL to open when this element is clicked. Requires the class attribute to include text-link. value Type: string The text to be used for the label. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. crop Type: string Gets and sets the value of the...
listcol - Archive of obsolete content
You can make some columns flexible and other columns non-flexible. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
listcols - Archive of obsolete content
There should be only one listcols element in a list box. If there is no listcols element, the list box has a single column. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
listhead - Archive of obsolete content
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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...
listheader - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A header for a single column in a listbox. Attributes disabled Properties acesssibleType Examples <listbox> <listhead> <listheader label="Name"/> <listheader label="Occupation"/> </listhead> <listitem> <listcell label="George"/> <listcell label="House Painter"/> </listitem> <listitem> <listcell label="Mary Ellen"/> <listcell label="Candle Maker"/> </listitem> <listitem> <listcell label="Roger"/> <listcell label="Swashbuckler"/> </listitem> </listbox> 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...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ord...
observes - Archive of obsolete content
The observes element should be placed inside the element that wants to observe the broadcaster. When an observed attribute is modified on the broadcaster, the attribute's value will be forwarded and set on the parent element of the observer. More information is available in the XUL tutorial. Attributes attribute, element Examples (example needed) Attributes 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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
page - Archive of obsolete content
Archive › Mozilla › XUL › page
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Similar to a window, except it should be used for XUL files that are to be loaded into an iframe. Examples (example needed) Attributes Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Pr...
...ize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, 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 Properties 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, tooltipText, top, width Methods Inherited Meth...
popupset - Archive of obsolete content
This element is optional; the given elements need not appear in a popupset container. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
preferences - Archive of obsolete content
It's supposed to be a child of <prefpane> element. <preferences> element should contain one or more <preference> elements. Note: it's not clear which of the following methods and properties are public. Examples <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> <preference 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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
query - Archive of obsolete content
Archive › Mozilla › XUL › query
The attributes and content of the query are dependent on the type of datasource being used. For RDF datasources, the query should contain one content element as well as member and/or triple elements. For XML datasources, the query should have an expr attribute and may optionally contain assign elements. For SQL datasources, the query should contain an SQL statement as text. Attributes expr 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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
queryset - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A container for query elements when more than one query is used. For more information, see Multiple Queries. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
resizer - Archive of obsolete content
If you place a custom resizing button inside the resizer, the user will be able to resize the window by dragging it. The resizer will send a command event after the resize is complete. Note: Starting in Gecko 2.0, you can also specify a target element using the element attribute, to use the resizer to resize the specified element instead of the window. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
richlistitem - Archive of obsolete content
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. ...
...n 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.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessible Type: nsIAccessible Returns the accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. label Type: string Gets the concatentation of text from any child label elements. Does ...
row - Archive of obsolete content
Archive › Mozilla › XUL › row
Each child of the row element is placed in each successive cell of the grid. The row with the most child elements determines the number of columns in each row, which may be smaller or larger than the number of column elements defined in the grid. More information is available in the XUL tutorial. Example See grid for an example. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
rows - Archive of obsolete content
Archive › Mozilla › XUL › rows
Child row elements define the individual rows to appear in the grid. Each child of a rows element should be a row element. The rows element may be nested inside another rows element. The children of these nested rows are counted as normal rows as if they were part of the parent. However, nesting rows elements allows groups of rows to have a separate appearance such as a different border, or separate scrolling may be defined for these rows. Non-row related elements placed inside a rows element occupy the full width of the grid and are placed in their corresponding positions between the rows. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
script - Archive of obsolete content
You should usually put scripts in a separate file pointed to by the src attribute, but you may also place the script inline inside the opening and closing script tags. More information is available in the XUL tutorial. Attributes src, type Examples <script src="test.js"/> <script src="http://example.com/js/test.js"/> <script> function foo(){ // code } </script> Attributes src Type: URI The URI of the script. type Type: language content type The language of the script. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
scrollbox - Archive of obsolete content
Note that a scrollbox doesn't cause scrollbars to be displayed. It is intended to be used when an application wants to be able to adjust the scroll position itself. If you just want scrollbars to appear, add style='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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
scrollcorner - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used for the small box where the horizontal and vertical scrollbars meet. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
separator - Archive of obsolete content
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
spacer - Archive of obsolete content
It is usually used to place spacing within a container. If you don't specify that the spacer has a size or is flexible, the spacer does not occupy any space. If you want a small gap, consider using a separator instead. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
stack - Archive of obsolete content
Archive › Mozilla › XUL › stack
The first element is placed on the bottom and each successive child is placed above the previous. All elements are displayed at once. Child elements may also be placed at absolute positions within the stack. The top, right, bottom, and left attributes on a child of the stack specify the position of that element. The bottom and right attributes can also be used in conjunction with top and left to set the width and/or height of the children of the stack. Note that bottom and right attributes, unlike rect, are relative to the bottom and right of the stack. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
stringbundleset - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A container for stringbundle elements. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] 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 tha...
...cates 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. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. command Type: element id Gets and sets the value of the command attribute. control Type: tabs element Returns the enclosing tabs element. crop ...
tabpanel - Archive of obsolete content
This element is optional and you may just use any other container in place of it. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
template - Archive of obsolete content
Elements are constructed from a datasource. For more information see the rule element. More information is available in the XUL tutorial. Attributes container, member Examples (example needed) Attributes container Type: string May optionally be set to the variable to use as the container or reference variable. If not specified, the variable specified in the uri attribute of the content tag in the template's first rule is used. member Type: string May optionally be set to the variable to use as the member variable. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
textnode - Archive of obsolete content
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). ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
toolbaritem - Archive of obsolete content
This element should wrap all customizable items (unless they're instances of toolbarbutton). If you don't need the thing you're placing in the toolbar to be customized then it doesn't need to be in a toolbaritem element. The element is used, for example, to hold the location bar's textbox in Firefox. It is also used to group buttons together so they can be added and removed all at once like Firefox's unified-back-forward-button. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
toolbarpalette - Archive of obsolete content
It is not displayed, but is used by the toolbar customization dialog to display the list of items. The children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be added to the toolbar. Do not add the various spacing items, as those are added automatically. You can add your own custom buttons to the Firefox browser by using an overlay that overlays the toolbarpalette with the idBrowserToolbarPalette. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
toolbarset - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Firefox only This element is used as a container for custom toolbars, which are added in the custom toolbar dialog. Examples (example needed) Attributes Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor...
...sources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width Met...
treechildren - Archive of obsolete content
For content trees, the content will be placed inside this element. This element is also used to define container rows in the tree. More information is available in the XUL tutorial. Attributes alternatingbackground Attributes alternatingbackground Obsolete since Gecko 2.0 Type: boolean If true, the background of the tree's rows will alternate between two colors. You can use the :-moz-tree-row CSS style to do this instead. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
treecols - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A group of treecol elements. There should one and only one treecols element in a tree. More information is available in the XUL tutorial. Attributes pickertooltiptext Properties accessibleType Examples (example needed) Attributes pickertooltiptext Type: string The text for the tooltip on the column picker. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-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. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ord...
triple - Archive of obsolete content
It is used to check for an assertion within a graph. If such an assertion exists, the rule may match, assuming that all the conditions match. If the assertion does 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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
vbox - Archive of obsolete content
Archive › Mozilla › XUL › vbox
This is equivalent to the box element, except it defaults to vertical orientation. More information is available in the XUL tutorial. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
where - Archive of obsolete content
Archive › Mozilla › XUL › where
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. ...
...ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties 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, tooltipText, top, width M...
Extentsions FAQ - Archive of obsolete content
ou want is a one button access to that extension with a prefilled bounce address, right? could someone make an extension for Thunderbird that preview upcomeing events and number of new messages? In our company I write this extension that connects to our GroupWare server (HTTP). What server should souch extension work gainst? Did you mean Exchange? How to attach information using the StringProperties of an IMAP message with out changing the properties? String properties are implemented as IMAP user flags. However not all servers support user flags, in which case you get reduced functionality as follows: all flags are stored in your local cache and are lost if your cache gets invalidated, and only "known" properties are copied when messages are copied. The list of "known" properties is: junks...
...educed functionality as follows: all flags are stored in your local cache and are lost if your cache gets invalidated, and only "known" properties are copied when messages are copied. The list of "known" properties is: junkscore junkscoreorigin label priority keywords. Keywords - In the GUI they are called Tags. They replace the old Labels (although the labels are still recognised). ...
NPN_Enumerate - Archive of obsolete content
<< Gecko Plugin API Reference << Scripting plugins Summary Gets the names of the properties and methods of the specified NPObject. Syntax #include <npruntime.h> bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifiers, uint32_t *identifierCount); Parameters The function has the following parameters: npp The NPP indicating which plugin instance is making the request. npobj The object of which the properties and methods are to be retrieved. identifiers A pointer to receive a pointer to the start of an array of string identifiers of the names of the properties and methods of npobj. ...
...e NPP indicating which plugin instance is making the request. npobj The object of which the properties and methods are to be retrieved. identifiers A pointer to receive a pointer to the start of an array of string identifiers of the names of the properties and methods of npobj. identifierCount A pointer to receive the number of identifiers in identifiers. Returns true if the names of the properties and methods were successfully retrieved, otherwise false. Note: The caller must call NPN_MemFree() on the pointer received through the identifiers parameter of a successful call to NPN_Enumerate to release the array of string identifiers when it is no longer needed. The callee allocates this array via NPN_MemAlloc(). ...
Theme changes in Firefox 2 - Archive of obsolete content
m Firefox 2. Changes to the default theme The table below lists all the changes made in the default theme for Firefox 2; you can use this information as a starting point for figuring out the changes you need to make. File Description of change browser/bookmarks/addBookmark.css Updated to include microsummary-related CSS changes. browser/bookmarks/bookmarksProperties.css New file; includes microsummary-related CSS. browser/browser.css Needs to be updated to include new CSS for microsummaries, search fields, iconic bookmark menu items, and more. browser/dropmark-nav-small.png New file; used as the drop-down menu arrow on the navigation buttons, when using small icons. browser/dropmark-nav.png New file; used as the drop-do...
...ditable menu list when there are no microsummaries available. menulist#name[droppable="false"] menulist#name[droppable="false"] > .menulist-editable-box menulist#name[droppable="false"] > .menulist-editable-box > html|*.textbox-input menulist#name[droppable="false"] > .menulist-dropmarker menulist#name[droppable="false"] > menupopup This file styles addBookmark2.xul. bookmarks/bookmarksProperties.css This is a new file in Firefox 2, and should contain the same CSS code as you added to addBookmark.css. This file styles bookmarksProperties.xul. Note: This CSS may be moved out into a separate file that will be referenced by both files in the future. browser.css The following styles used in Firefox 1.5 themes are no longer used in Firefox 2 and should be removed from your theme: #boo...
-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. ...
... Values -ms-content-zoom-limit-min Value of the -ms-content-zoom-limit-min property. ...
::-ms-check - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-check CSS pseudo-element is a Microsoft extension that represents checkboxes and radio button groups created by <input type="checkbox"> and <input type="radio">. This pseudo-element is supported only in Internet Explorer and Microsoft Edge. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-check in its selector. Other properties are ignored. -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust background-clip background-color background-image background-origin background-repeat background-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-sty...
::-ms-expand - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-expand CSS pseudo-element is a Microsoft extension that represents the button of a <select> menu control that opens or closes the drop-down menu. Typically it is a triangle that points downward. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-expand in its selector. Other properties are ignored. -ms-high-contrast-adjust background-clip background-color background-image background-origin background-position-x background-position-y background-repeat background-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-l...
::-ms-fill-lower - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-fill-lower CSS pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by the thumb. 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. background-clip background-color background-image background-origin background-repeat background-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-r...
::-ms-fill-upper - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-fill-upper CSS pseudo-element is a Microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. A slider control is one possible representation of <input type="range">. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill-upper in its selector. Other properties are ignored. background-clip background-color background-image background-origin background-repeat background-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 bo...
::-ms-fill - Archive of obsolete content
Only animation-name applies to an indeterminate one. (A progress bar is determinate if it has a value attribute set; otherwise it is indeterminate. ...
...s animation for an indeterminate progress bar. By setting animation-name on ::-ms-fill, you can change the animation, as shown in this table: Value Description none Turns off the animation so that no dots are displayed. -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. Other properties are ignored. animation-name background-clip, background-color, background-image, background-origin, background-repeat, and background-size border border-radius box-shadow box-sizing color cursor display (values block, inline-block, none) font height margin -ms-background-posit...
::-ms-thumb - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-thumb CSS pseudo-element is a Microsoft extension that represents the thumb that the user moves within the track of a slider control to alter its numerical value. 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. background-clip background-color background-image background-origin background-repeat background-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 ...
::-ms-value - Archive of obsolete content
Other properties are ignored. ...
... The ::-ms-value CSS pseudo-element is a Microsoft extension that applies rules to the value of a text or password <input> control or the content of a <select> control. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-value in its selector. Other properties are ignored. background-clip background-color background-image background-origin background-repeat background-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...
Accessing XML children - Archive of obsolete content
var a = {}; a.foo = 1; a["bar"] = 2; In E4X, the . ...
... <blue/> </red> <foo> XML Lists Many times, however, a single element will have two or more children of the same type. In this case, accessing foo.bar will return an XML list object, of all child elements of the type "bar". IMPORTANT It is your responsibility to determine whether you have an XML list or a single element when using the . operator. E4X behaves no differently when returning these properties. The XML list behaves much like an array. var element = <foo> <bar baz="1">red</bar> <bar baz="2">blue</bar> </foo>; var list = element.bar; list.length(); // returns 2 list[0]; // the first bar element list[1]; // the second bar element Notice further that this list is "live" in the sense that changes made to the list are reflected back in the eleme...
Enumerator - Archive of obsolete content
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...
...v.FreeSpace / bytesPerGB; var totalGB = drv.TotalSize / 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 mod...
VBArray - Archive of obsolete content
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 va...
...ay = a End Function --> </script> <script type="text/javascript"> <!-- function VBArrayTest(vbarray){ var a = new VBArray(vbarray); var b = a.toArray(); var i; for (i = 0; i < 9; i++) { document.writeln(b[i]); } } --> </script> </head> <body> <script type="text/javascript"> <!-- VBArrayTest(CreateVBArray()); --> </script> </body> Properties The VBArray object has no properties. Methods VBArray.dimensions Returns the number of dimensions in a VBArray. VBArray.getItem Returns the item at the specified location. VBArray.lbound Returns the lowest index value used in the specified dimension of a VBArray. VBArray.toArray Returns a standard JavaScript array converted from a VBArray. VBArray.ubound Returns the highest index value used in the specified dimension of...
New in JavaScript 1.1 - Archive of obsolete content
r 3.0 was the second major version of the browser with JavaScript support. JavaScript versions Netscape Navigator 3.0 also introduced JavaScript language versions. <SCRIPT LANGUAGE="JavaScript"> <!-- JavaScript for Navigator 2.0. --> <SCRIPT LANGUAGE="JavaScript1.1"> <!-- JavaScript for Navigator 3.0. --> New features in JavaScript 1.1 New objects Array Boolean Function Number New properties Number.MAX_VALUE Number.MIN_VALUE NaN Number.NEGATIVE_INFINITY Number.POSITIVE_INFINITY New methods Array.prototype.join() Array.prototype.reverse() Array.prototype.sort() Array.prototype.split() New operators typeof void Other new features <noscript> LiveConnect. Communication between Java and JavaScript. Changed functionality in JavaScript 1.1 "Object deletion". ...
...TY 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 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() an...
Object.prototype.watch() - Archive of obsolete content
This example ensures that every Person always has a valid name and an age between 0 and 200. class Person { constructor(name, age) { this.watch('age', this._isValidAssignment.bind(this)); this.watch('name', this._isValidAssignment.bind(this)); this.name = name; this.age = age; } toString() { return th...
... newval) => { console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval); return newval; }); o.p = 2; o.p = 3; delete o.p; o.p = 4; o.unwatch('p'); o.p = 5; This script displays the following: o.p changed from 1 to 2 o.p changed from 2 to 3 o.p changed from undefined to 4 Using watch() to validate an object's properties You can use watch to test any assignment to an object's properties. This example ensures that every Person always has a valid name and an age between 0 and 200. class Person { constructor(name, age) { this.watch('age', this._isValidAssignment.bind(this)); this.watch('name', this._isValidAssignment.bind(this)); this.name = name; this.age = age; } toString() { return this.name + ', ' + this.age; } _isValidAssignment(id, oldval, new...
Packages - Archive of obsolete content
he support for this object was removed in Gecko 16, see LiveConnect for details. Created by The Packages object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method. Description The Packages object lets you access the public methods and fields of an arbitrary Java class from within JavaScript. The java, netscape, and sun properties represent the packages java.*, netscape.*, and sun.* respectively. Use standard Java dot notation to access the classes, methods, and fields in these packages. For example, you can access a constructor of the Frame class as follows: var theFrame = new Packages.java.awt.Frame(); For convenience, JavaScript provides the top-level netscape, sun, and java objects that are synonyms for the Packages...
...represent the packages java.*, netscape.*, and sun.* respectively. Use standard Java dot notation to access the classes, methods, and fields in these packages. For example, you can access a constructor of the Frame class as follows: var theFrame = new Packages.java.awt.Frame(); For convenience, JavaScript provides the top-level netscape, sun, and java objects that are synonyms for the Packages properties with the same names. Consequently, you can access Java classes in these packages without the Packages keyword, as follows: var theFrame = new java.awt.Frame(); The className property represents the fully qualified path name of any other Java class that is available to JavaScript. You must use the Packages object to access classes outside the netscape, sun, and java packages. Properties class...
Archived open Web documentation - Archive of obsolete content
ach() Ok, in the end I didn't remove the old code as it isn't hosted anywhere (I thought the github reference contained the code) but inserted a faster implementation above while retaining the rest of the document. Iterator The Iterator function returns an object which implements legacy iterator protocol and iterates over enumerable properties of an object. LiveConnect (Please update or remove as needed.) MSX Emulator (jsMSX) Old Proxy API Proxies are objects for which the programmer has to define the semantics in JavaScript. The default object semantics are implemented in the JavaScript engine, often written in lower-level languages like C++. Proxies l...
... XHTML(TM) 1.0 The Extensible HyperText Markup Language (Second Edition) defines XHTML to be a reformulation of HTML 4 as an XML 1.0 application. Talk:JavaScript Reference The guide section links to an interesting document discussing how to create and use private variables in objects, which is great if you want to protect the various properties within an object from being poked at accidentally. I also just read a document on proper inheritance using apply(). Well if you combine the two, you can have inherited private variables: Scope Cheatsheet JavaScript with Mozilla extensions has both function-scoped vars and block-scoped lets. Along with hoisting and dynamic behavior, scope in Ja...
Using the DOM File API in chrome code - Extensions
from the inherent security risks associated with allowing web content free access to the contents of their disks. If you pass a path to the File constructor from unprivileged code (such as web content), an exception will be thrown. Scope Availability In the JSM scope File is available without needing to do anything special. In Bootstrap scope, this must be imported in like so: Cu.importGlobalProperties( [ "File" ] ) Accessing a file by hard-coded pathname To reference a file by its path, you can simply use a string literal: var file = File.createFromFileName("path/to/some/file"); Cross platform note: However using hard-coded paths raises cross platform issues since it uses a platform-dependent path separator (here "/"). In the XUL/Mozilla platform there isn't sadly an equivalent to Java Fi...
...s explained in the next section. Accessing files in a special directory You can also use the directory service to obtain and build the path to a file to access. For example, let's say your add-on needs to access a file in the user's profile. You can do so like this: var dsFile = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsIFile); dsFile.append("myfilename.txt"); var file = File.createFromNsIFile(dsFile); This uses the directory service to locate the profile directory (with the location key "ProfD", see below for more details), then appends the name of the file we want to work with by calling nsIFile.append(). Finally, we instantiate the File object by ...
Canonical order - MDN Web Docs Glossary: Definitions of Web-related terms
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. 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...
... The description of the formal syntax used for CSS values on MDN ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
... In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
task has a Window as its global object. This is the vast majority of JavaScript code on the Web. Code running in a Worker has a WorkerGlobalScope object as its global object. 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 F...
...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 Global Functions are stored as properties in the window object. We created a Global Function called greeting, then invoked it using the window object. Explanation: The global function greeting was stored in the window object, like this: greeting: function greeting() { console.log("Hi!"); } ...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
Tracks are also created in the implicit grid by positioning a grid item outside of the tracks created in the explicit grid. The image below shows the first row track on a grid. Track sizing in the explicit grid When defining grid tracks using grid-template-columns and grid-template-rows you may use any length unit, and also the flex unit, fr which indicates a portion of the available space in the grid container. ...
... ...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
In the example below we have a three-column and two-row track grid, with 20-pixel gaps between column tracks and 20px-gaps between row tracks. ...
...<div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> In terms of grid sizing, gaps act as if they were a regular grid track however nothing can be placed into the gap. The gap acts as if the grid line at that location has gained extra size, so any grid item placed after that line begins at the end of the gap. The grid-gap properties are not the only thing that can cause tracks to space out. Margins, padding or the use of the space distribution properties in Box Alignment can all contribute to the visible gap - therefore the grid-gap properties should not be seen as equal to "the gutter size" unless you know that your design has not introduced any additional space with one of these methods. Learn More Property reference ...
Mixin - MDN Web Docs Glossary: Definitions of Web-related terms
A mixin is a class or interface in which some or all of its methods and/or properties are unimplemented, requiring that another class or interface provide the missing implementations. The new class or interface then includes both the properties and methods from the mixin as well as those it defines itself. All of the methods and properties are used exactly the same regardless of whether they're implemented in the mixin or the interface or class that implements the mixin. The advantage of mixins is that they can be used to simplify the design of APIs in which multiple interfaces need to include the same methods and properties. ...
...The mixin is implemented by both of those interfaces. ...
Property (JavaScript) - MDN Web Docs Glossary: Definitions of Web-related terms
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". ...
... 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". ...
Flexbox - Learn web development
er. This specifies how much of the overflowing amount is taken away from each flex item's size, to stop them overflowing their container. This is quite an advanced flexbox feature, and we won't be covering it any further in this article. The minimum size value we discussed above. This can be specified individually using the flex-basis longhand value. We'd advise against using the longhand flex properties unless you really have to (for example, to override something previously set). They lead to a lot of extra code being written, and they can be somewhat confusing. Horizontal and vertical alignment You can also use flexbox features to align flex items along the main or cross axis. Let's explore this by looking at a new example -- flex-align0.html (see it live also) -- which we are going to turn ...
...a horizontal menu bar, with some buttons jammed into the top left hand corner. First, take a local copy of this example. Now, add the following to the bottom of the example's CSS: div { display: flex; align-items: center; justify-content: space-around; } Refresh the page and you'll see that the buttons are now nicely centered, horizontally and vertically. We've done this via two new properties. align-items controls where the flex items sit on the cross axis. By default, the value is stretch, which stretches all flex items to fill the parent in the direction of the cross axis. If the parent hasn't got a fixed width in the cross axis direction, then all flex items will become as long as the longest flex items. This is how our first example got equal height columns by default. The ce...
Multiple-column layout - Learn web development
file and adding the CSS into the appropriate places. At the bottom of the section you can see a live example 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:...
...ellus laoreet sit amet. Sed auctor cursus massa at porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula.</p> </div> </div> .container { column-width: 250px; 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...
Positioning - Learn web development
taken its place in the normal layout flow, you can then modify its final position, including making it overlap other elements on the page. Go ahead and update the position declaration in your code: position: relative; If you save and refresh at this stage, you won't see a change in the result at all. ...
... 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. ...
Styling web forms - Learn web development
ine 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 on the other hand shows...
... background : rgba(0,0,0,.1); border-radius: 5px; } Now that our text fields are complete, we need to adjust the display of the single and multiple line text fields to match, since they won't typically look the same using the defaults. Tweaking the textareas <textarea> elements default to being rendered as an inline-block element. The 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...
CSS basics - Learn web development
is called a ruleset. (The term ruleset is often referred to as just rule.) Note the names of the individual parts: Selector This is the HTML element name at the start of the ruleset. It defines the element(s) to be styled (in this example, <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...
... px values as you like. Your work-in-progress should look similar to this: CSS: all about boxes Something you'll notice about writing CSS: a lot of it is about boxes. This includes setting size, color, and position. Most HTML elements on your page can be thought of as boxes sitting on top of other boxes. CSS layout is mostly based on the box model. Each box taking up space on your page has properties like: padding, the space around the content. In the example below, it is the space around the paragraph text. border, the solid line that is just outside the padding. margin, the space around the outside of the border. In this section we also use: width (of an element). background-color, the color behind an element's content and padding. color, the color of an element's content (usu...
Third-party APIs - Learn web development
es Now let's look at another API example -- the New York Times API. This API allows you to retrieve New York Times news story information and display it on your site. This type of API is known as a RESTful API -- instead of getting data using the features of a JavaScript library like we did with Mapquest, we get data by making HTTP requests to specific URLs, with data like search terms and other properties encoded in the URL (often as URL parameters). This is a common pattern you'll encounter with APIs. An approach for using third-party APIs Below we'll take you through an exercise to show you how to use the NYTimes API, which also provides a more general set of steps to follow that you can use as an approach for working with new APIs. Find the documentation When you want to use a third party A...
...f no articles are returned. If so, we don't try to display any -- we create a <p> containing the text "No results returned." and insert it into the.<section> If some articles are returned, we, first of all, create all the elements that we want to use to display each news story, insert the right contents into each one, and then insert them into the DOM at the appropriate places. To work out which properties in the article objects contained the right data to show, we consulted the Article Search API reference (see NYTimes APIs). Most of these operations are fairly obvious, but a few are worth calling out: We used a for loop (for(var j = 0; j < current.keywords.length; j++) { ... } ) to loop through all the keywords associated with each article, and insert each one inside its own <span>, inside ...
CSS performance optimization - Learn web development
s a style sheet it knows that it only needs to apply it for a specific scenario, it still downloads the stylesheet, but doesn't render block. By separating out the CSS into multiple files, the main render-blocking file, in this case styles.css, is much smaller, reducing the time that rendering is blocked. Animating on the GPU Browsers are optimized to handle CSS animations, and handle animating properties that do not trigger a reflow (and therefore also a repaint) very well. To improve performance, the node being animated can be moved off the main thread and onto the GPU. Properties that will lead to compositing include 3D transforms (transform: translateZ(), rotate3d(), etc.), animating transform and opacity, position: fixed, will-change, and filter. Some elements, including <video>, <canvas> and...
... moved off the main thread and onto the GPU. Properties that will lead to compositing include 3D transforms (transform: translateZ(), rotate3d(), etc.), animating transform and opacity, position: fixed, will-change, and filter. Some elements, including <video>, <canvas> and <iframe>, are also on their own layer. When an element is promoted as a layer, also known as composited, animating transform properties is done in the GPU, resulting in improved performance, especially on mobile. will-change property The CSS will-change property tells browsers which properties of an element are expected to change enabling browsers to set up optimizations before the element is actually changed, improving performance by doing potentially expensive work before it is required. will-change: opacity, transform; The...
Framework main features - Learn web development
Writing components As mentioned in the previous chapter, most frameworks have some kind of component model. React components can be written with JSX, Ember components with Handlebars, and Angular and Vue components with a templating syntax that lightly extends HTML. Regardless of their opinions on how components should be written, each framework's components offer a way to describe the external properties they may need, the internal state that the component should manage, and the events a user can trigger on the component's markup. The code snippets in the rest of this section will use React as an example, and are written with JSX. Properties Properties, or props, are external data that a component needs in order to render. Suppose you're building a website for an online magazine, and you need ...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Componentizing our React app - Learn web development
from our map() function -- remember that JSX allows us to mix up JavaScript and markup structures! Let's try the following instead of what we have already: const taskList = props.tasks.map(task => <Todo />); Look again at your app; now our tasks look more like they used to, but they're missing the names of the tasks themselves. Remember that each task we map over has the id, name, and checked properties we want to pass into our <Todo /> component. If we put that knowledge together, we get code like this: const taskList = props.tasks.map(task => ( <Todo id={task.id} name={task.name} completed={task.completed} /> )); Now the app looks like it did before, and our code is less repetitive. Unique keys Now that React is rendering our tasks out of an array, it has to keep track of which one is wh...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
React interactivity: Events and state - Learn web development
riggers 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 but different -- standard onclick handler properties). All browser events follow this format in JSX - on, followed by the name of the event. Let's apply this to our app, starting in the Form.js component. Handling form submission At the top of the Form() component function, 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 whate...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Getting started with Svelte - Learn web development
t is being imported and used. This file is the entry point for our app, and it initially looks like this: import App from './App.svelte'; const app = new App({ target: document.body, props: { name: 'world' } }); export default app; main.js starts by importing the Svelte component that we are going to use. Then in line 3 it instantiates it, passing an option object with the following properties: target: The DOM element inside which we want the component to be rendered, in this case the <body> element. props: the values to assign to each prop of the App component. A look under the hood How does Svelte manage to make all these files work together nicely? The Svelte compiler processes the <style> section of every component and compiles them into the public/build/bundle.css file. I...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Dynamic behavior in Svelte: working with variables and props - Learn web development
p, we covered the following topics: Creating and using components. Turning static markup into a live template. Embedding JavaScript expressions in our markup. Iterating over lists using the {#each} directive. Passing information between components with props. Listening to DOM events. Declaring reactive statements. Basic debugging with console.log() and reactive statements. Binding HTML properties with the bind:property directive. Triggering reactivity with assignments. Using reactive expressions to filter data Explicitly defining our reactive dependencies In the next article we will add further functionality, which will allow users to edit todos. Previous Overview: Client-side JavaScript frameworks Next In this module Introduction to client-side frameworks Framework mai...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Vue conditional rendering: editing existing todos - Learn web development
f 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 inside our data() property: isDone: this.done, Add the following block below the data() { } block: computed: { isDone() { return this.done; } }, Now when you save and re...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Rendering a list of Vue components - Learn web development
" :done="true"></to-do-item> </li> </ul> When you make this change, every JavaScript expression between the <li> tags will have access to the item value in addition to the other component attributes. 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 set to done="false". Update the label="My ToDo Item" attribute to :label="item.label", and the :done="false" attribute to :done="item.done", as seen in context below: <ul> <li v-for="item in ToDoItems" :key="item.id"> <to-do-item :label="i...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Vue resources - Learn web development
ajor release of the framework with a lot of major changes. It went into active beta in April, 2020. The biggest change is a new Composition API that works as an alternative to the current property-based API. In this new API, a single setup() function is used on the component. Only what you return from this function is available in your <template>s. You are required to be explicit about "reactive" properties when using this API. Vue handles this for you using the Options API. This makes the new API typically considered a more advanced use case. There are also a handful of other changes, including a change in how Apps are initialized in Vue. To read more about the changes involved with Vue 3, refer to this article by Vue School which goes over most of the major changes in Vue 3. Previous Overvi...
... interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Theme concepts
o suppress the mandatory "theme_frame": image with an empty or transparent image. You would use an empty or transparent image if, for example, you wanted to tile a centrally justified image, such as to create this effect Here you specify the weta image like this: "images": { "theme_frame": "empty.png", "additional_backgrounds": [ "weta_for_tiling.png"] }, and the images tiling with: "properties": { "additional_backgrounds_alignment": [ "top" ], "additional_backgrounds_tiling": [ "repeat" ] }, Full details of how to setup this theme can be found in the themes example weta_tiled. Full detais of the alignment and tiling options can be found in the "theme" key description. Alternatively, you can use multiple images, say combining the original weta image with this one anchored to the ...
...gnment and tiling options can be found in the "theme" key description. Alternatively, you can use multiple images, say combining the original weta image with this one anchored to the left of the header to create this effect Where the images are specified with: "images": { "theme_frame": "empty.png", "additional_backgrounds": [ "weta.png", "weta-left.png"] }, and their alignment by: "properties": { "additional_backgrounds_alignment": [ "right top" , "left top" ] }, Full details of how to setup this theme can be found in the themes example weta_mirror. Full details of the alignment options can be found in the "theme" key description. Static animated themes It is possible to create an animated theme using an APNG format image, as in the themes example animated. However, remember that...
Chrome registration
the user interface are also contained within the content packages, as well as most XBL binding files. Locale Localizable applications keep all their localized information in locale providers. This allows translators to plug in a different chrome package to translate an application without altering the rest of the source code. The two main types of localizable files are DTD files and Java-style properties files. Skin A skin provider is responsible for providing a complete set of files that describe the visual appearance of the chrome. Typically a skin provider will provide CSS files and images. Note: Scripts (including those found in XBL) loaded from skin packages will not execute. The chrome registry The Gecko runtime maintains a service known as the chrome registry that provides mappings...
...ult since Firefox 1.5. Disabling it manually was possible by specifying xpcnativewrappers=no until Firefox 4. Note: Support for this flag has been removed in Gecko 2.0. You can no longer disable XPCNativeWrappers. To update your add-on to work without this flag: If your add-on depends upon XBL bindings attached to content objects (that is, it needs to be able to call functions or get and set properties created by the XBL binding), you'll need to use the object's wrappedJSObject property to obtain a wrapped object. If you need to call functions or access properties defined by the content -- for example, if your add-on wants to add a button to the page that calls a JavaScript function defined by the page. The xpcnativewrappers flag applies only to content packages; it is not recognized for lo...
Debugging on Windows
elect General from the drop down list. "Program arguments:" should show the options. Some common options would be the URL of the file you want the browser to open as soon as it starts, starting the Profile Manager, or selecting a profile. You can also redirect the console output to a file (by adding "> filename.txt" for example, without the quotes). In VC 7 and 8 this option is called Project > Properties > Debugging > Command Arguments. VC 8 also allows you to set environment variables there. Setting breakpoints in DLLs which are not yet loaded in memory VC++ 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 le...
... There is an environment variable that can disable breaking for assertions. This is how you would normally set it: set XPCOM_DEBUG_BREAK=warn The environment variable takes also other values besides warn, see XPCOM_DEBUG_BREAK for more details. Note that unlike Unix, the default for Windows is not warn, it's to pop up a dialog. To set the environment variable for Visual Studio, use Project > Properties > Debugging > Environment and click the little box. Then use XPCOM_DEBUG_BREAK=warn Changing running code You normally shouldn't need to do this (just quit the application, set the environment variable described above, and run it again). And this can be dangerous (like trashing your hard disc and corrupting your system). So unless you feel comfortable with this, don't do it. You have been warn...
Multiple Firefox profiles
d the selected profile, without prompting at startup. Note: To access other profiles after selecting this option, you must start the Profile Manager first. Using the profiles Windows If you want to have the profile manager to pop up each time you start Firefox, so you can choose a profile, you will need to edit the "Target" of the launch icon. To do this: Right-click the icon and choose "Properties". When the properties dialog box pops up, you should see a "Target" text field that you can edit, and it should show the current file path. After the closing quote, add -ProfileManager. Click Ok. Now whenever you double click that icon, the profile manager should appear, allowing you to choose which profile you'd like to use. If you want individual icons to launch specific profiles, you wil...
...can edit, and it should show the current file path. After the closing quote, add -ProfileManager. Click Ok. Now whenever you double click that icon, the profile manager should appear, allowing you to choose which profile you'd like to use. If you want individual icons to launch specific profiles, you will need to edit the "Target" of each icon. To do this: Right-click the icon and choose "Properties". When the properties dialog box pops up, you should see a "Target" text field that you can edit, and it should show the current file path. To permanently set a specific profile, add -p PROFILE_NAME to the target path, but outside of the quotes, replacing "PROFILE_NAME" with the actual profile name you chose. If you would also like to allow multiple instances of Firefox to run at the same time...
Cross Process Object Wrappers
ver, although CPOWs are convenient, they have serious limitations and can cause responsiveness problems, so should only be used when necessary and only as a migration aid. Passing CPOWs from frame scripts Frame scripts can send messages to chrome using one of two global functions: sendAsyncMessage() or sendSyncMessage(). The optional third parameter to each of these functions is an object whose properties are objects to wrap. For example, this frame script sends a DOM node to chrome when the user clicks it, as the clicked property of the third argument: // frame script addEventListener("click", function (event) { sendAsyncMessage("my-e10s-extension-message", {}, { clicked : event.target }); }, false); In the chrome script, the DOM node is now accessible through a Cross Process Object Wrapper, ...
...he clicked property of the third argument: // frame script addEventListener("click", function (event) { sendAsyncMessage("my-e10s-extension-message", {}, { clicked : event.target }); }, false); In the chrome script, the DOM node is now accessible through a Cross Process Object Wrapper, as a property of the objects property of the message. ...
HTMLIFrameElement.getStructuredData()
Specification Not part of any specification. ...
... Specification Not part of any specification. ...
mozbrowseractivitydone
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 on such an activity will be ignored and have no effect. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: success A Boolean that indicates whether the activity has completed successfully (true) or not (false). Examples var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowseractivitydone", function(event) { if(event.details.success) { console.log('Activity completed successfully'); } else { console.log('Activity not completed successfully'); } }); Re...
mozbrowserasyncscroll
acing 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 mozbrowserasyncscroll event is fired when the content of a browser <iframe> is scrolled. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top The scroll top position in CSS pixels of the document within the browser <iframe>. left The scroll left position in CSS pixels of the document within the browser <iframe>. width The width in CSS pixels of the visible part of the document within the browser <iframe>. height The height in CSS pixels of the visible part of the document within the browser <iframe>. scrollWidth The to...
mozbrowsererror
ill not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowsererror event is fired when an error occurs while trying to load content within a browser <iframe>. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
...he browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. detail The detail property returns an anonymous JavaScript object with the following properties: type A DOMString representing the type of error that occurred. Possible values are: fatal(crash) unknownProtocolFound fileNotFound dnsNotFound connectionFailure netInterrupt netTimeout cspBlocked phishingBlocked malwareBlocked unwantedBlocked offline malformedURI redirectLoop unknownSocketType netReset notCached isprinting deniedPortAccess proxyResol...
mozbrowserfindchange
behavior may change in the future. The mozbrowserfindchange event is fired when a search method is invoked in the browser <iframe> content. This includes HTMLIFrameElement.findAll(), HTMLIFrameElement.findNext(), and HTMLIFrameElement.clearMatch(). General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: active A Boolean indicating whether a search is currently active (true), or not (false.) searchString A DOMString representing the string that is currently being searched for. searchLimit A number indicating the maximum number of searches that can be returned. numberOfMatches A number indicating the number of matches returned by the search. activeMatchOrdinal A number indicating the ...
mozbrowsericonchange
d the behavior may change in the future. The mozbrowsericonchange event is sent when a new icon (e.g. <link rel="icon"> or <link rel="apple-touch-icon">) is available in the browser <iframe>'s content. It will be fired once for each icon available. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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.addEve...
mozbrowserloadend
rloadend event is fired when the browser <iframe> has finished loading all its assets, or has failed to load. This can be used when the embedder wants to stop spinning a loading indicator, or update the UI in some other way to indicate loading is complete. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
...he browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. 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 ...
mozbrowserlocationchange
ry user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowserlocationchange event is fired when a browser <iframe>'s location changes -- it is fired every time navigation occurs. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
...he browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. detail The detail property returns an anonymous JavaScript object with the following properties: url A DOMString representing the URL of the new location. canGoBack A Boolean that defines whether it's possible to go back in the navigation history (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 t...
mozbrowsermanifestchange
change in the future. The mozbrowsermanifestchange event is fired when the manifest location of the app loaded in the browser <iframe> changes. By this, we are referring to the href of the manifest, as defined in <link rel="manifest" href=" ... ">. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: href The URL of the new app manifest. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowsermanifestchange", function(event) { console.log("New manifest URL: " + event.details.href); }); Related Events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationc...
mozbrowsermetachange
e large incompatibilities between implementations and the behavior may change in the future. The mozbrowsermetachange event is fired when a <meta> element related to web applications is added, removed or changed. See below for the applicable types. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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 ...
mozbrowseropensearch
n implementations and the behavior may change in the future. The mozbrowseropensearch event is fired when a link to a search engine is found -- i.e. when an instance of <link rel="search" type="application/opensearchdescription+xml"> is encountered. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: title A DOMString representing the title of the search engine. href A DOMString representing URL of the search engine. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowseropensearch", function( event ) { console.log("New search engine encountered: " + event.details.title); }); Related Events mozbrowserasyncscroll mozbrowserclose mozbrowse...
mozbrowseropentab
entations and the behavior may change in the future. The mozbrowseropentab event is fired when a new tab is opened within a browser <iframe> as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: url A DOMString representing the URL of the new document loaded. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowseropentab", function( event ) { console.log("A new document has opened containing the content at " + event.details.url + "."); }); Related Events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror moz...
mozbrowseropenwindow
usually when the content of a browser <iframe> successfully calls the window.open() method, or the user clicks on a link with an unknown target. The embedder must use the <iframe> passed in the event.details.frameElement property as the new window content. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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> th...
mozbrowserresize
acing 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 mozbrowserresize event is fired when a browser <iframe> viewport is resized in some way. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: width A number representing the new width of the <iframe> viewport, in device pixels. height A number representing the new height of the <iframe> viewport, in device pixels. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserresize", function( event ) { console.log("The new window size is " + event.details.width + " x " + event.details.height ...
mozbrowserscroll
uction 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 mozbrowserscroll event is fired when the browser <iframe> content scrolls. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top A number representing the new vertical scroll position of the <iframe> viewport -- in CSS pixels -- from the top of the viewport. left A number representing the new horizontal scroll position of the <iframe> viewport -- in CSS pixels -- from the left of the viewport. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscroll", function( event...
mozbrowserscrollareachanged
tations and the behavior may change in the future. The mozbrowserscrollareachanged event is fired when the available scrolling area in the browser <iframe> changes. This can occur on resize and when the page size changes (while loading for example.) General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: width A number representing the new scroll area width of the <iframe> viewport, in CSS pixels. height A number representing the new scroll area height of the <iframe> viewport, in CSS pixels. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscrollareachanged", function( event ) { console.log("The new scroll area is " + event.details.width + ...
mozbrowserscrollviewchange
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 mozbrowserscrollviewchange event is fired when asynchronous scrolling (i.e. APCZ) starts or stops. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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 mozbrowserco...
mozbrowsersecuritychange
There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowsersecuritychange event is fired when the browser <iframe> has connected to the server, and when the mixed content state changes. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: 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 da...
mozbrowservisibilitychange
e incompatibilities between implementations and the behavior may change in the future. The mozbrowservisibilitychange event is fired when the visibility state of the current browser iframe <iframe> changes, for example due to a call to setVisible(). General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
... browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: visible A Boolean that indicates whether the browser iframe is visible (true) or not (false). Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowservisibilitychange", function( event ) { if(event.details.visible) { console.log("The browser is visible."); } else { console.log("The browser is hidden."); } }); Related Events mozbrowser...
::-moz-tree-image
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-cell-text
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-cell
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-column
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-drop-feedback
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-line
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
::-moz-tree-separator
Activated by the properties attribute. ...
... Activated by the properties attribute. ...
MozScrolledAreaChanged
This event, introduced in Gecko 1.9.2, is fired whenever either or both of these values change. ...
...ding 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 only DOMString The type of event. bubblesRead only Boolean Whether the event normally bubbles or not. cancelableRead only Boolean Whether the event is cancellable or not. viewRead only ...
Script security
ndow object interact. This all takes place within the same compartment, with no need for security checks or wrappers. When objects share an origin but not a global - for example two web pages from the same protocol, port, and domain - they belong to two different compartments, and the caller gets a transparent wrapper to the target object. Transparent wrappers allow access to all the target's properties: functionally, it's as if the target is in the caller's compartment. Cross-origin If the two compartments are cross-origin, the caller gets a cross-origin wrapper. This denies access to all the object's properties, except for a few properties of Window and Location objects, as defined by the same-origin policy. Privileged to unprivileged code The most obvious example of this kind of securi...
...on, but reduced privileges with respect to chrome. If the caller has a higher privilege than the target object, the caller gets an Xray wrapper for the object. Xrays are designed to prevent untrusted code from confusing trusted code by redefining objects in unexpected ways. For example, privileged code using an Xray to a DOM object sees only the original version of the DOM object. Any expando properties are not visible, and if any native DOM properties have been redefined, they are not visible in the Xray. The privileged code is able to waive Xrays if it wants unfiltered access to the untrusted object. See Xray vision for much more information on Xrays. Unprivileged to privileged code If the caller has lower privileges than the target object, then the caller gets an opaque wrapper. An opa...
AddonListener
void onEnabling( in Addon addon, in boolean needsRestart ) Parameters addon The Addon that is being enabled needsRestart True if an application restart is necessary for the change to take effect onEnabled() Called when an add-on has been enabled. void onEnabled( in Addon addon, ) Parameters addon...
... Called when an add-on has been uninstalled. void onUninstalled( in Addon addon, ) Parameters addon The Addon that has been uninstalled onOperationCancelled() Called when a pending operation for an add-on is cancelled. void onOperationCancelled( in Addon addon, ) Parameters addon The Addon that has had a pending operation cancelled onPropertyChanged() Called when one or more properties of Addon has changed. Only applies to the following properties: applyBackgroundUpdates void onPropertyChanged( in Addon addon, in string properties[] ) Parameters addon The Addon that has had its properties changed properties An array of the names of properties that changed. ...
Assert.jsm
act approximation of equality between two objects to keep the chance of false positives to a minimum. JSON.stringify is not designed to be used for this purpose; objects may have ambiguous toJSON() implementations that would influence the test. ...
... as equivalent to expected, including nested properties expected Test reference to evaluate against actual message Short explanation of the expected result notDeepEqual() The non-equivalence assertion tests for any deep inequality. undefined notDeepEqual( actual, expected, message ); Parameters actual Test subject to be evaluated as not equivalent to expected, including nested properties expected Test reference to evaluate against actual message Short explanation of the expected result strictEqual() The strict equality assertion tests strict equality, as determined by ===. undefined strictEqual( actual, expected, message ); Parameters actual Test subject to be evaluated as strictly equivalent to expected expected Test reference to evaluate against actual me...
API-provided widgets
Properties Property Description id the ID of the widget (required). type a string indicating the type of widget. Possible types are button for simple button widgets (the default) view for buttons that open a panel or subview, depending on where they are placed. custom for fine-grained control over the creation of the widget. viewId Only useful for views (and required there): the id of the that should be shown when clicking the widget. ...
... in an overflowable toolbar (optional, default: true) defaultArea default area to add the widget to (optional, default: none; required if non-removable) shortcutId id of an element that has a shortcut for this widget (optional, default: null). This is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings inside customizableWidgets.properties). If you're in an add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass in yourself. showInPrivateBrowsing whether to show the widget in private browsing mode (optional, default: true) Event handlers You can also define several event handlers which will be called at various stages in a widget's lifetime: ...
Widget Wrappers
Widget wrappers are objects that provide information about a widget. There are 'group' wrappers which provide information about the widget across all windows, and 'single' wrappers which provide information about a specific instance in a specific window. Group wrapper Methods forWindow() A method to obtain a single window wrapper for a widget, in the window aWindow passed as the only argument. Properties All of a wrapper's properties are read-only unless otherwise indicated. Attribute Description id the widget's ID type the type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom' provider the provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL instances an array of all instances (single...
...her the widget is currently disabled. NB: this property is writable, and will toggle all the widgets' nodes' disabled states label for API-provided widgets, the label of the widget tooltiptext for API-provided widgets, the tooltip of the widget showInPrivateBrowsing for API-provided widgets, whether the widget is visible in private browsing Single wrapper Properties All of a wrapper's properties are read-only unless otherwise indicated. Attribute Description id the widget's ID type the type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom' provider the provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL node reference to the corresponding DOM nod...
DownloadError
becauseSourceFailed Read only boolean Indicates an error occurred while reading from the remote location. ...
...re. Properties Attribute Type Description result Read only nsresult The result code associated with this error. becauseSourceFailed Read only boolean Indicates an error occurred while reading from the remote location. becauseTargetFailed Read only boolean Indicates an error occurred while writing to the local target. Inherits properties from Error. ...
DownloadTarget
This is a dynamic property, which is updated when the download is completed or when the Download.refresh() method is called. ...
...rom 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's properties be updated if the user moves or deletes the target file or its associated ".part" file, which contains a partially-downloaded file's contents. Promise refresh(); Parameters None. Promise resolves to undefined when the state of the download has been updated. Promise can be rejected with Never. ...
FxAccountsOAuthClient.jsm
ountsOAuthClient(Object options); Method overview launchWebFlow(); tearDown(); Attributes parameters Object Returns the set of parameters that initialized the Firefox Accounts OAuth flow. onComplete Function Gets called when the Firefox Accounts OAuth flow successfully completes. First and only argument is an Object that has "state" and "code" properties. Constructor FxAccountsOAuthClient() Creates and returns a new FxAccountsOAuthClient 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 cl...
...ks that are in use by this client. ...
XPCOMUtils.jsm
This section provides some pseudocode that demonstrates how to put together a JavaScript class based on the steps listed above. Constructor The constructor is a simple method that handles any required initialization tasks. function MyComponent() { // initialize the component here } Class declaration Declare the class prototype, using a form similar to this. MyComponent.prototype = { // properties required for XPCOM registration: classDescription: "unique text description", classID: Components.ID("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"), contractID: "@example.com/xxx;1", // [optional] custom factory (an object implementing nsIFactory). If not // provided, the default factory is used, which returns // |(new MyComponent()).QueryInterface(iid)| in its createInstan...
...nts and can be assigned to NSGetFactory global variable. generateCI() Generates an nsIClassInfo implementation for a component. The returned object should be assigned to the classInfo property of a JS object, the QueryInterface() function generated by generateQI will return it automatically then. function generateCI( classInfo ); Parameters classInfo An object containing the optional properties interfaces, contractID, classDescription, classID, flags. This parameter should not be the component itself because that would cause a memory leak. Return value An nsIClassInfo implementation returning the values of the properties from the classInfo parameter in its various properties. Exceptions thrown This method throws an exception with the message "In generateCI, don't use a component fo...
Application Translation with Mercurial
ne new text with the id privatebrowsingpage.howToStart4 in the file aboutPrivateBrowsing.dtd. Tips for finding files with usually easily translateable texts: Look for files in browser/chrome/browser/ Look for a file with only a few changes Suggestions Files starting with about... Files in the preferences directory (browser/chrome/browser/preferences/) The browser.dtd and browser.properties files if there aren't too many new strings. Tracking the translation progress If you translate more than a few strings, you usually want to keep track of what has already been translated (and later if the text has been tested in the product as fitting into the available area and suiting the functionality it describes). This guide achieves this with the Firefox extension Scrapbook. You ...
... if necessary) using "View" > "Sidebar" > "Scrapbook" or by clicking its toolbar button which you likely have to add by toolbar customization if you didn't do this before. Drag the tab with the localization error showing missing and obsolete strings to the sidebar. After Scrapbook has saved the web page to your local disk, click with the right mouse button on the page in the sidebar and choose "Properties" from the context menu which gets opened. Rename it something meaningful, e.g. "Firefox <version number> translation". After you saved the dialog, click with the left mouse button on the page in the sidebar to open the locally saved copy. Opening English files and the target locale side-by-side The localization report shows the IDs of added or removed texts, but the English text itself is sti...
Localization: Frequently asked questions
This page lists tweaks and tips that may not require a complete page on its own. For more detailed documentation about localization in general, see our Localization page. ...
...s that may not require a complete page on its own. For more detailed documentation about localization in general, see our Localization page. ...
Index
to compare-locales. It allows Mozilla localizers to easily check their work. 7 L10n testing with xcode Firefox for iOS, Localization Once you have your l10n testing environment set up in Xcode, testing your Firefox on iOS localization is a breeze. 8 Localization and Plurals Internationalization, Localization You're likely here because you're localizing a .properties file and it had a link to this page. This page is to help explain how to localize these strings so that the correct plural form is shown to the user. For example, "1 page" vs "2 pages". 9 Localization content best practices Apps, Extensions, Internationalization, Localization, Mozilla, l10n, l12y This document provides best practices for developers to create localizable code,...
... out some sweet features that will make you more efficient and make your l10n contributions easier. 27 Localizing without a specialized tool From the Create a New Localization document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (DTD and properties) used in the Mozilla source code. With that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. Repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. 28 Mozilla L10...
L20n Javascript API
variables that extend the context data available for the evaluation of this entity. Returns a string. ctx.getEntitySync(id: String, ctxdata: Object?) Retrieve an object with data evaluated from an entity called id. If passed, ctxdata is a simple hash object with a list of variables that extend the context data available for the evaluation of this entity. Returns an object with the following properties: value: the string value of the entity, attributes: an object of evaluated attributes of the entity, globals: a list of global variables used while evaluating the entity, locale: locale code of the language the entity is in; it can be different than the first locale in the current fallback chain if the entity couldn't be evaluated and a fallback translation had to be used. ctx.localize(id...
...textContent = l10n.entities.hello.value; node.classList.remove('hidden'); }); The callback becomes bound to the entities on the ids list. It will be called when the entities become available (asynchronously) or whenever the translation of any of the entities changes. localize should be the preferred way of localizing the UI. The callback function is passed an l10n object with the following properties: entities: an object whose keys are the identifiers and value are the entity objects as returned by getEntitySync, reason: an object with the reason why callback was invoked. The reason object can be: { locales: Array<String> } if callback was invoked because of a change of the current locale (see requestLocales), { global: String } if callback was invoked because the value of one of th...
NSS API Guidelines
All hashing update, MACing update, and encrypt/decrypt functions which act like filters should have a consistent signature: SECStatus PK11_DigestOp(PK11Context *context, unsigned char *inBuf, SECBufferLeninLe...
...d insert their additional parameters between the context (first parameter) and the output buffer. All hashing update, MACing update, and encrypt/decrypt functions which act like filters should have a consistent signature: SECStatus PK11_DigestOp(PK11Context *context, unsigned char *inBuf, SECBufferLeninLen) Functions like these which have different properties, for example, additional parameters, callbacks, etc., should insert their additional parameters between the context (first parameter) and the input buffer. Within your layer, multiple similar functions should have consistent parameter order. Callback Functions Callback functions should all contain an opaque parameter (void *) as their first argument, passed by the original caller. Callbacks...
Rhino Debugger
enu item. Simply single-click on the red dot or the line number of the line at which you want to clear a breakpoint. The red dot will disappear and the breakpoint at that location will be cleared. Viewing Variables The lower-left (dockable) pane in the debugger main window contains a tab-pane with two tabs, labeled "this" and "Locals". Each pane contains a tree-table which displays the properties of the current object and currently visible local variables, respectively. This The properties of the current object are displayed in the this table. If a property is itself a JavaScript object the property may be expanded to show its sub-properties. The this table is updated each time control returns to the debugger or when you change the stack location in the Context: window. Locals Th...
...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 JavaScript Runtime
yped language, the static Java type of a JavaScript value is java.lang.Object. The behavior of the JavaScript engine is undefined if a value of any type other than the ones described above is introduced into JavaScript. (This caveat does not apply to scripts that use LiveConnect; the Java values are wrapped and unwrapped as appropriate to conform to the above type constraints.) Property Access Properties in JavaScript objects may be accessed using either string or numeric identifiers. Conceptually, all accessors are converted to strings in order to perform the lookup of the property in the object. However, this is not the implementation used in practice because a number to string conversion is too expensive to be performed on every array access. Instead, every property accessor method in Scripta...
...ument objects are host objects. The easiest way to define new host objects is by using ScriptableObject.defineClass(). This method defines a set of JavaScript objects using a Java class. Several of the examples define host objects this way. If the services provided by defineClass are insufficient, try other methods of ScriptableObject and FunctionObject, such as defineProperty and defineFunctionProperties. Contexts and Threads Every thread that executes JavaScript must have an associated Context. Multiple threads (with multiple associated Contexts) may act upon the same set of objects. Any host objects that are defined are responsible for any synchronization required to run safely from multiple threads. ...
Garbage collection
ject. Allocation Kind Cells are classified by allocation kind. The allocation kind determines the size of the object and the finalization behavior. Allocation kind is defined by enum AllocKind. Arenas always hold objects of the same allocation kind. Thus, an arena holds objects all of the same size and finalization behavior. Compartments The JS heap is partitioned into compartments. Some key properties of compartments are: Every cell (JS heap object) belongs to at most one compartment. (Some cells are shared across all compartments in a Zone.) An object may not hold a direct pointer to an object in another compartment. Instead, it must store a wrapper for the other object. This allows compartments to be used for security checks: objects in the same compartment have the same access requireme...
...artments are a fundamental cross-cutting concept in SpiderMonkey (see also Compartments), though anything related to memory is now more concerned with Zones, especially GC. Zone A zone is a collection of compartments. Zones mainly serve as boundaries for GCs: the garbage collector collects at the level of a zone, not an individual compartment. Unlike compartments, zones have no special security properties. Some properties of zones are: Every compartment belongs to exactly one zone Every JS heap object belongs to exactly one zone. Objects from the same zone but different compartments can share an arena. Objects from different zones cannot be stored in the same arena. A zone remains alive as long as any JS heap objects in the zone are alive. Chunk A Chunk is the largest internal unit of m...
SpiderMonkey Internals
ed. The debugger will have to consult jsopcode.def on its own to figure out where to plant trap instructions to implement functions like step out, but a future jsdbgapi.h will provide convenience interfaces to do these things. At most one trap per bytecode can be set. When a script (JSScript) is destroyed, all traps set in its bytecode are cleared. Watchpoints, for intercepting set operations on properties and running a debugger-supplied function that receives the old value and a pointer to the new one, which it can use to modify the new value being set. Line number to PC and back mapping functions. The line-to-PC direction "rounds" toward the next bytecode generated from a line greater than or equal to the input line, and may return the PC of a for-loop update part, if given the line number of th...
...imitive types. They have similar structure, generally starting with class definitions and continuing with internal constructors, finalizers, and helper functions. jsobj.*, jsscope.* These two pairs declare and implement the JS object system. All of the following happen here: creating objects by class and prototype, and finalizing objects; defining, looking up, getting, setting, and deleting properties; creating and destroying properties and binding names to them. The details of a native object's map (scope) are mostly hidden in jsscope.[ch]. jsatom.cpp, jsatom.h The atom manager. Contains well-known string constants, their atoms, the global atom hash table and related state, the js_Atomize() function that turns a counted string of bytes into an atom, and literal pool (JSAtomMap) methods. ...
JSClass.flags
ERS Obsolete since JSAPI 43 Correctly implements GC read and write barriers. JSCLASS_NEW_ENUMERATE Obsolete since JSAPI 37 This class's enumerate hook is actually a JSNewEnumerateOp, not a JSEnumerateOp. JSCLASS_NEW_RESOLVE Obsolete since JSAPI 36 This class's resolve hook is actually a JSNewResolveOp, not a JSResolveOp. JSCLASS_SHARE_ALL_PROPERTIES Obsolete since JavaScript 1.8.5 Instructs SpiderMonkey to automatically give all properties of objects of this class the JSPROP_SHARED attribute. JSCLASS_NEW_RESOLVE_GETS_START Obsolete since JSAPI 16 The resolve hook expects to receive the starting object in the prototype chain passed in via the *objp in/out parameter. (This is meaningful only if the JSCLASS_NEW_RESOL...
...ts the new JSTraceOp signature instead of the old JSMarkOp signature. This is recommended for all new code that needs custom marking. SpiderMonkey reserves a few other flags for its internal use. They are JSCLASS_IS_ANONYMOUS, JSCLASS_IS_GLOBAL, JSCLASS_IS_PROXY, and JSCLASS_HAS_CACHED_PROTO. JSAPI applications should not use these flags. ...
JSObject
JSObject is the type of JavaScript objects in the JSAPI. Objects are made up of the following parts: Most objects have a prototype. See JS_GetPrototype. An object inherits properties, including methods, from its prototype (which is another object). Most objects have a parent. See JS_GetParent. An object's parent is another object, usually either the global object or an object that represents an activation record. The JavaScript engine sometimes uses this relationship to implement lexical scoping. Security-sensitive applications can use this relationship to make every object a member of some security domain. Almost every object can have any number of its own properties. The term own property refers to a property of an object that is not inherited from its prototype. Each property...
...See JS_DefineProperty. Every object is associated with a JSClass and a JSObjectOps. ...
JSObjectOps.enumerate
Warning! ...
...ject properties. The type of the callback is JSNewEnumerateOp. For native objects, the enumerate callback first checks the JSCLASS_NEW_ENUMERATE flag of the object's class. If the flag is present, enumerate simply delegates the call to JSClass.enumerate. Otherwise, it invokes the JSClass.enumerate hook as an old-style JSEnumerateOp to give the object an opportunity to define any remaining lazy properties. Then it iterates over obj's defined properties, walking the internal data structure they're stored in. ...
JSPrincipals
Use JS_HoldPrincipals and JS_DropPrincipals. codebase char * Pointer to the codebase for the principal. Obsolete since JSAPI 13 getPrincipalArray void * (*)(JSContext *, JSPrincipals *) Pointer to the function that returns an array of principal definitions. Obsolete since JSAPI 12 globalPrivilegesEnabled JSBool (*)(JSContext *, JSPrincipals *) Flag indicating whether principals are enabled globally. ...
...e principals are no longer in use and are destroyed. ...
JSPropertyDescriptor
setter The set syntax binds an object property to a function to be called when there is an attempt to set that property. ...
... 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 rewritten Description A descriptor is a property that describes an object's properties. There are two main types of property descriptors that exist in an object: a data descriptor and an access descriptor. You can use the Object.getOwnPropertyDescriptor() 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 descript...
JSPropertySpec
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, its setter is never called. Description JSPropertySpec defines the attributes for a single JS property to associate with an object. ...
... getter JSNativeWrapper or SelfHostedWrapper Getter method for the property. setter JSNativeWrapper or SelfHostedWrapper Setter method for the property. If a property is read-only, its setter is never called. Description JSPropertySpec defines the attributes for a single JS property to associate with an object. Pass to JS_DefineProperties or JS_InitClass to create the properties and assign them to an object. To define an array of JSPropertySpec, use JS_PSG, JS_PSGS, JS_SELF_HOSTED_GET, JS_SELF_HOSTED_GETSET, and JS_PS_END See Also MXR ID Search for JSPropertySpec JSFunctionSpec JSNativeWrapper JS_DefineProperties JS_PSG JS_PSGS JS_SELF_HOSTED_GET JS_SELF_HOSTED_GETSET JS_PS_END bug 766448 - changed type of getter and setter to wrapper bug 938728 - added selfH...
JS_AlreadyHasOwnProperty
y 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 whether a property already exists on a specific JSObject without modifying the object. By design, this search may not find a property that other property lookup functions, such as JS_LookupProperty, would find. For native objects--objects whose properties are stored in the default data structure provided by SpiderMonkey--these functions simply check that data structure to see if the specified field is present. They do not search anywhere else for the property. This means that: The prototype chain of obj is not searched. The object's JSClass.resolve hook is not called, so lazily defined properties are not found. (This is the only API that can di...
...ta structure to see if the specified field is present. They do not search anywhere else for the property. This means that: The prototype chain of obj is not searched. The object's JSClass.resolve hook is not called, so lazily defined properties are not found. (This is the only API that can directly detect that a lazily resolved property has not yet been resolved.) Shared, permanent, delegated properties are not found. (Such properties are an implementation detail of SpiderMonkey. They are meant to be a transparent optimization; this is the only API that breaks the abstraction.) For non-native objects, this falls back on a complete search. This calls the JSObjectOps.lookupProperty hook. *foundp is set to true only if lookupProperty reports that the property was found on obj itself and not on som...
JS_DefineProperty
escription JS_DefineProperty defines a single property in a specified object, obj. JS_DefineUCProperty is the Unicode version of the function. JS_DefinePropertyById is the same but takes a JS::HandleId for the property name. JS_DefineProperty is the fundamental operation on which several more convenient, higher-level functions are based, including JS_DefineFunction, JS_DefineFunctions, JS_DefineProperties, JS_DefineConstDoubles, JS_DefineObject, and JS_InitClass. It differs from JS_SetProperty in that: it does not behave like ordinary property assignment in the JavaScript language; it allows the application to specify additional details (getter, setter, and attrs) governing the new property's behavior; it never calls a setter; it can call the JSClass.addProperty callback when JS_SetProperty ...
...er; it can call the JSClass.addProperty callback when JS_SetProperty would not, because it can replace an existing property. The parameters specify the new property's name, initial stored value, getter, setter, and Property attributes (attrs). If obj already has an own property with the given name or id, the existing property is replaced. These functions can currently replace JSPROP_PERMANENT properties, but such usage is deprecated. The JavaScript engine will call the getter or setter callback each time the property is read or written, whether from JavaScript code or via JSAPI functions like JS_GetProperty and JS_SetProperty. (Exception: If attrs contains the JSPROP_READONLY flag, the setter will never be called, as property assignment will fail before it gets that far. Also note that certain ...
JS_DefinePropertyWithTinyId
obj JSObject * Object for which to create the new property. name const char * or const jschar * Name for the property to create. namelen size_t (only in JS_DefineUCPropertyWithTinyId) The length of name in characters; or (size_t) -1 to indicate that name is null-terminated. tinyid int8 8-bit ID to aid in sharing getter and setter callbacks among properties. value jsval Initial stored value for the new property. getter JSPropertyOp getProperty method for retrieving the current property value. setter JSPropertyOp setProperty method for specifying a new property value. attrs unsigned int Property attributes. Description JS_DefinePropertyWithTinyId defines an object property with a tin...
...y-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 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 pa...
JS_DeleteElement2
m 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. ...
...Element2 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_FS
Syntax #define JS_FS(name,call,nargs,flags) ... #define JS_FN(name,call,nargs,flags) ... #define JS_SYM_FN(symbol,call,nargs,flags) ... // Added in SpiderMonkey 38 #define JS_FNINFO(name,call,info,nargs,flags) ... // Added in SpiderMonkey 17 #define JS_SELF_HOSTED_FN(name,selfHostedName,nargs,flags) ... // Added in SpiderMonkey 31 #define JS_SELF_HOSTED_SYM_FN(symbol, selfHostedName, nargs, flags) ... // Added in SpiderMonkey 38 #define JS_SYM_FNSPEC(symbol, call, info, nargs, flags, selfHostedName) ... // Added in SpiderMonkey 38 #define JS_FNSPEC(name,call,info,nargs,flags,selfHostedName) ... ...
...nes a method with the string id "@@iterator".) See an example in the JSAPI User Guide. See Also MXR ID Search for JS_FS MXR ID Search for JS_FN MXR ID Search for JS_SYM_FN MXR ID Search for JS_FNINFO MXR ID Search for JS_SELF_HOSTED_FN MXR ID Search for JS_SELF_HOSTED_SYM_FN MXR ID Search for JS_SYM_FNSPEC MXR ID Search for JS_FNSPEC MXR ID Search for JS_FS_END JSFunctionSpec JS_DefineProperties JS_InitClass bug 775788 - added JS_FNINFO. bug 920433 - added JS_SELF_HOSTED_FN and JS_FNSPEC. bug 1082672 - added JS_SYM_FN JS_SELF_HOSTED_SYM_FN JS_SYM_FNSPEC. ...
JS_NewPropertyIterator
is feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Crate an iterator object for use with JS_NextProperty. Syntax JSObject * JS_NewPropertyIterator(JSContext *cx, JS::Handle<JSObject*> obj); Name Type Description cx JSContext * The JS context in which to enumerate properties. 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 whose properties are to be enumerated. Description Create an object to iterate over the enumerable own properties of obj, in arbitrary order. (This differs from longstanding for..in loop order, which uses the order in which obj's propertie...
...er must be in a request on this JSContext. obj JS::Handle&lt;JSObject*&gt; The object whose properties are to be enumerated. Description Create an object to iterate over the enumerable own properties of obj, in arbitrary order. (This differs from longstanding for..in loop order, which uses the order in which obj's properties were defined. Note also that while for..in includes properties inherited from prototypes, iterator objects do not.) On success, this returns an iterator object that can be passed to JS_NextProperty to fetch the property ids. On error, it returns NULL. The iterator object created by this function is not a JavaScript Iterator. It is an opaque object with no properties visible from JavaScript. See Also bug 1081660 ...
JS_NextProperty
till work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Get the next property id from an iterator object produced by JS_NewPropertyIterator. Syntax bool JS_NextProperty(JSContext *cx, JS::HandleObject iterobj, JS::MutableHandleId idp); Name Type Description cx JSContext * The JS context in which to enumerate properties. ...
... 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. ...
JS_PSGS
Syntax #define JS_PSG(name, getter, flags) ... #define JS_PSGS(name, getter, setter, flags) ... #define JS_SELF_HOSTED_GET(name, getterName, flags) ... // Added in SpiderMonkey 31 #define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) ... // Added in SpiderMonkey 31 #define JS_PS_END ... Name Type Description name const char * The JavaScript name for the property. (or index, if JSPROP_INDEX is present in flags) getter JSNative Pointer to the C/C++ implementation of the getter function. ...
... const char * The function's name in Self-Hosted JavaScript code for setter function. Description These macros encapsulate the definition of JSNative-backed JSPropertySpecs, by defining the JSNativeWrappers for them. See Also MXR ID Search for JS_PSG MXR ID Search for JS_PSGS MXR ID Search for JS_SELF_HOSTED_GET MXR ID Search for JS_SELF_HOSTED_GETSET JSPropertySpec JS_DefineProperties JS_InitClass bug 684526 - added. bug 938728 - added JS_SELF_HOSTED_GET and JS_SELF_HOSTED_GETSET. ...
JS_PreventExtensions
Syntax // Added in SpiderMonkey 45 bool JS_PreventExtensions(JSContext *cx, JS::HandleObject obj, JS::ObjectOpResult &result); // Obsolete since JSAPI 39 bool JS_PreventExtensions(JSContext *cx, JS::HandleObject obj, bool *succeeded); 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 to be made non-extensible. result JS::ObjectOpResult &amp; (out parameter) Receives the result of the operation. ...
...ject Object to be made non-extensible. result JS::ObjectOpResult &amp; (out parameter) Receives the result of the operation. Added in SpiderMonkey 45 succeeded bool * Outparam indicating, on JSAPI success, whether the object is now non-extensible. Obsolete since JSAPI 39 Description All JavaScript objects recognize the concept of extensibility: whether new properties may be added to the object. In some situations, it may be convenient to prohibit new properties. In JavaScript this may be accomplished using the Object.preventExtensions method. The similar JSAPI method is JS_PreventExtensions. The failure-mode information below is new as of SpiderMonkey 36. Before then, JS_PreventExtensions did not accept a succeeded argument; in those cases where *succee...
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. ...
...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; }, 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 w...
SavedFrame
me view that the content compartment has (A -> C), or it can view all stack frames, including the frames from chrome compartments (A -> B -> C). To view everything, use an XrayWrapper. This is the default wrapper. To see the stack as the content compartment sees it, waive the xray wrapper with Components.utils.waiveXrays: const contentViewOfStack = Components.utils.waiveXrays(someStack); Accessor Properties of the SavedFrame.prototype Object source The source URL for this stack frame, as a string. line The line number for this stack frame. column The column number for this stack frame. functionDisplayName Either SpiderMonkeyaEUR(TM)s inferred name for this stack frameaEUR(TM)s function, or null. asyncCause If this stack frame is the asyncParent of other stack frames, then this is a string repre...
...e asynchronous call, for example where the promise was created. If the frame responsible for the call is not accessible to the caller, this points to the youngest accessible ancestor of the real frame, if any. In all other cases, this is null. parent This stack frameaEUR(TM)s caller, or null if this is the oldest frame on the stack. In this case, there might be an asyncParent instead. Function Properties of the SavedFrame.prototype Object toString Return this frame and its parents formatted as a human readable stack trace string. Source Metadata Generated from file: js/src/doc/SavedFrame/SavedFrame.md Watermark: sha256:3475238d6704c659cb3e411b9c601d6ee836762dea14203f1f00ecf2c3b32452 Changeset: 251fccc1f62b ...
TPS Password Lists
Required. submitURL: the submit URL for the password. Optional. Used for passwords in form fields. realm: the http realm for the password. Optional. Used for http authentication passwords. username: required. password: required. usernameField: the username field for a form password. Optional. passwordField: the password field for a form password. Optiona...
...ed. submitURL: the submit URL for the password. Optional. Used for passwords in form fields. realm: the http realm for the password. Optional. Used for http authentication passwords. username: required. password: required. usernameField: the username field for a form password. Optional. passwordField: the password field for a form password. Optional. changes: an object containing any of the above properties, which are applied during a modify action. Optional. Password lists and phase actions Following are the functions that can be used in phase actions related to passwords: Passwords.add Passwords.delete Passwords.modify Passwords.verify Passwords.verifyNot ...
TPS Tests
t Here's an example TPS test to tie it all together. // Phase declarations var phases = { "phase1": "profile1", "phase2": "profile2", "phase3": "profile1" }; // Asset list // the initial list of bookmarks to be added to the browser var bookmarks_initial = { "menu": [ { uri: "http://www.google.com", title "google.com", changes: { // These properties are ignored by calls other than Bookmarks.modify title: "Google" } }, { folder: "foldera" }, { folder: "folderb" } ], "menu/foldera": [ { uri: "http://www.yahoo.com", title: "testing Yahoo", changes: { location: "menu/folderb" } } ] }; // The state of bookmarks after the first 'modify' action has been performed // on them. Note th...
... title: "Google" } }, { folder: "foldera" }, { folder: "folderb" } ], "menu/foldera": [ { uri: "http://www.yahoo.com", title: "testing Yahoo", changes: { location: "menu/folderb" } } ] }; // The state of bookmarks after the first 'modify' action has been performed // on them. ...
WebReplayRoadmap
er supports DOM mutation breakpoints (bug 1547692), the recording can be searched for DOM mutations, and mutations can be logged to the console and seeked to later. Allowing CSS to be changed while paused somewhere in the recording and update graphics with the effects of those changes. Object Watching (not yet implemented) It would be nice to log the changes to a specific object or one of its properties, so that the points of those changes can be seeked to later. Bookmarks (not yet implemented) It would be nice to be able to bookmark points in the recording so that they show up on the timeline and can be seeked to later. Code Path Highlighting (not yet implemented) When paused in a frame, the code path taken through the frame (the lines/expressions executed) could be highlighted somehow, whi...
...o 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 debugger for investigation. Memory Analysis (not yet implemented) Analyzing memory usage and leaks in JS can be dif...
Gecko object attributes
a-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. Applied to: any role Exposed in ARIA: aria-live relevant Space delimited string with keywords describing what kinds of changes in the subtree are informational, as opposed to presentational. If not specified, the default should be considered "additions text", which indicates that n...
...t Space delimited string with keywords describing what kinds of changes in the subtree are informational, as opposed to presentational. If not specified, the default should be considered "additions text", which indicates that newly created objects and changes to text and text equivalents should be considered relevant, and that the hiding or removal of items is not. Please see the ARIA States and Properties module for more information. Exposed in ARIA: aria-relevant container-atomic Is this change inside a region that should always be presented at once. If yes, member-of relation will point to the root of the region. See the Live Region Support for more information. container-busy The current changes are not yet complete. A state change event for the A11y API's BUSY state will be fired on the c...
XUL Accessibility
name The following rules to generate accessible name are applied: check aria-labelledby attribute, name is generated from elements pointed by aria-labelledby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-labelledby="descr1 descr2" />...
... append the accessible value Searching specific element in neighbour of the element search inside the element subtree go up through parents (max level is 5) and search inside theirs subtrees if the element is anonymous then search in whole anonymous subtree, here the attribute anonid is used instead of id attribute Accessible properties This section describes common rules how accessibility properties are formed for XUL elements. name The following rules to generate accessible name are applied: check aria-labelledby attribute, name is generated from elements pointed by aria-labelledby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-labelledby="descr1 descr2" /> if the element implements nsIDOMXULLabeledControlElement or ns...
Using the Places keywords API
keywords API The keywords API is a promise-based API available through the PlacesUtils module: Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); Setting a keyword for an URL The insert() method accepts a keyword entry object describing the keyword to insert. It has the following properties: keyword: string representing the keyword url: either a URL or spec represeting the URL to associate to postData: optional POST data string. Should be omitted if there's no POST data. PlacesUtils.keywords.insert({ keyword: "my_keyword", url: "http://www.example.com/" postData: "post+data=1&test=2" ...
... }).then(() => { /* success */ }, e => { /* failure */ }); Note that setting an already existing keyword to a different URL, will silently update the existing keyword to the new URL. Fetching an entry by keyword The fetch() method acceps a keyword string (or an object having a keywords property) and might resolve to a keyword entry with the following properties: keyword: string representing the keyword url: the URL represeted by the keyword postData: optional POST data string. Not defined if there's no POST data. If no keyword exists, will resolve to null. PlacesUtils.keywords.fetch("my_keyword").then(entry => { /* entry is either null, or a keyword entry */ }, e => { /* failure */}); Fetching e...
The Publicity Stream API
her native API support is enabled by the user's browser, if not it will shim in a pure HTML implementation. [is this still doable?] The javascript library should be included from: https://myapps.mozillalabs.com/jsapi/publicity.js All APIs related to open web applications are accessed under the navigator.apps object. Publicity Stream API (navigator.apps.publicity.*) The publicity API is exposed as properties on the navigator.apps.publicity object. publicizeActivity( <activity>, [ { [ onsuccess: <function> ], [ onerror: <function> ] } ]): Applications should call this method when an user-initiated activity deemed attractive to potential consumers occurs. This spawns a doorhanger which allows the user to specify which users can view the activity, and (following successful login and authorization...
...e error codes include: denied - if the user refuses to publicize the activity permissionDenied - if the publicizing site is not allowed to post to the publicity stream networkError - if the publicity server is unreachable activityParseError - if the activity contains syntax errors (not proper JSON) invalidActivity - if the activity contains semantic errors (i.e. missing required properties) Finally, the publicizeActivity() function will throw an exception if required arguments are missing, or if unsupported arguments are present. getPublicityStream( onsuccess: <function>, { [ onerror: <function> ], [ for_apps: <list> ], [ since: <Date> ], [ before: <Date> ], [ count: <int> ]): Provides a means for a web store to receive a list of the current user's socially relevant ap...
How to build an XPCOM component in JavaScript
If not // provided, the default factory is used, which returns // |(new MyComponent()).QueryInt...
...See XPCOM changes in Gecko 2.0 for more details. Installation For extensions: Copy HelloWorld.js, and HelloWorld.xpt (only if you defined and compiled the IDL) to {extensiondir}/components/. Delete compreg.dat and xpti.dat from your profile directory. Restart application. For Firefox: Copy HelloWorld.js, and HelloWorld.xpt (only if you defined...
XPCOM changes in Gecko 2.0
Specifying xpcnativewrappers=no in your manifest (that is, XPCNativeWrapper automation) is no longer supported. This was always intended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use XPCNativeWrappers. If your add-on depends upon XBL bindings attached to content objects--for example, the ability to call functions or get and set properties created by the XBL binding--you will need to use the XPCNativeWrapper property wrappedJSObject to access wrapped objects. If you need to be able to call functions or access properties defined by web content, you'll need to do this as well. This may be the case if, for example, you've written an extension that adds a delete button to a web mail service, and the service defines a window.delete() fu...
...d objects. If you need to be able to call functions or access properties defined by web content, you'll need to do this as well. This may be the case if, for example, you've written an extension that adds a delete button to a web mail service, and the service defines a window.delete() function that you need to call. If, on the other hand, all you're doing with content is accessing DOM methods and properties, you've never needed to be using xpcnativewrappers=no in the first place, and should simply remove it from your manifest. Miscellaneous XPCNativeWrapper changes Using the delete operator on "expando" properties of an XPCNativeWrapper no longer throws a security exception. XPCOMUtils.jsm changes The XPCOMUtils.jsm code module has been updated to let you specify the application IDs of the applica...
Components.utils
h a given object is associated (through its prototype chain at birth, for example). getJSTestingFunctions() getObjectPrincipal() Gets the nsIPrincipal for the given JavaScript object. getWeakReference() Gets a weak reference for the object passed in. import() Loads a JS module into the current script, without sharing a scope. importGlobalProperties() Specify a list of constructors to import into the scope. isXrayWrapper() Test whether a given object is an Xray or not. unload() Unloads a JS module loaded with import(). isDeadWrapper() Determines whether this object is backed by a DeadObjectProxy. lookupMethod() Looks up a native (i.e. declared in the interface) method or property of an X...
...ion 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 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 ...
inIDOMUtils
specified in Content state flags. getCSSPropertyNames() Get a list of all our supported property names void getCSSPropertyNames( in unsigned long aFlags, Optional out unsigned long aCount, Optional [retval, array, size_is(aCount)] out wstring aProps ); Parameters aFlags Optional Shorthands can be excluded or property aliases included. See constants. aCount Optional Count aProps Properties getCSSStyleRules() Returns an array of the CSS style rules on the specified element. nsISupportsArray getCSSStyleRules( in nsIDOMElement aElement, in DOMString aPseudo Optional ); Parameters aElement A DOM element to retrieve the style rules of. aPseudo Optional A pseudo element, such as before. Return value An nsISupportsArray containing all the style rules that currently app...
...nsigned long aSelectorIndex, in DOMString aPseudo Optional ) Parameters aElement The element to check the selector against. aRule The style rule containing the selector. aSelectorIndex The index of the selector. aPseudo Optional A string specifying the pseudo-element to match. May be omitted when checking the regular elements. addPseudoClassLock() Makes the element take on style properties that would apply if the element had the given pseudo-classes. void addPseudoClassLock( in nsIDOMElement aElement, in DOMString aPseudoClass ); Parameters aElement The element to set the pseudo-class lock on. aPseudoClass The pseudo-class to set. e.g. ":hover". removePseudoClassLock() Removes a pseudo-class lock from the element. void removePseudoClassLock( in nsIDOMElement aEle...
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. ...
... 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. ...
nsIAccessible
nterface nsIAccessible : nsISupports { ... }; accessible/public/nsIAccessible.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 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 nsIA...
...ble.getAccessibleToRight(), nsIAccessible.getAccessibleAbove() or nsIAccessible.getAccessibleBelow() to get left, right, top or below placed accessible Methods getKeyBindings Provides array of localized string of global keyboard accelerator for the given action index supported by accessible. getState Provides a bit fields of accessible states which describe boolean properties of accessible. groupPosition This method returns grouping information. Used for tree items, list items, tab panel labels, radio buttons, etc. Also used for collectons of non-text objects. getChildAtPoint This method returns an accessible child which contains the coordinate at (x, y) in screen pixels. getChildAt This method returns Nth accessible ch...
nsIDOMGlobalPropertyInitializer
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. ...
...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. ...
nsIDOMWindowUtils
aFlushLayout Flushes layout if true. Otherwise, no flush occurs. aScrollX aScrollY getVisitedDependentComputedStyle() Perform the equivalent of: window.getComputedStyle(aElement, aPseudoElement). getPropertyValue(aPropertyName) except that, when the link whose presence in history is allowed to influence aElement's style is visited, get the value the property would have if allowed all properties to change as a result of :visited selectors (except for cases where getComputedStyle uses data from the frame). This is easier to implement than adding our property restrictions to this API, and is sufficient for the present testing requirements (which are essentially testing 'color'). AString getVisitedDependentComputedStyle( in nsIDOMElement aElement, in AString aPseudoElement, in AStri...
...eventDefault(), indicating that default processing of the event should not occur. setCSSViewport() Sets the dimensions of the CSS viewport to the specified size in CSS pixels, regardless of the size of the enclosing widget/view. This triggers reflow. The caller of this method must have UniversalXPConnect privileges. Note: After calling this method, the window.innerWidth and window.innerHeight properties return the size of the viewport you've specified instead of the size of the browser widget. void setCSSViewport( in float aWidthPx, in float aHeightPx ); Parameters aWidthPx The width of the viewport in CSS pixels. aHeightPx The height of the viewport in CSS pixels. setDisplayPort() Set the "displayport" to be <xPx, yPx, widthPx, heightPx> in units of CSS pixels, regardless of the...
nsIDOMXULElement
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 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 ...
...ets/sets the value of the element's ref attribute. resource nsIRDFResource Read only. Returns the nsIRDFResource corresponding to the element's ref or id attribute, if any. statusText DOMString Gets/sets the value of the element's statustext attribute. style nsIDOMCSSStyleDeclaration Read only. Obsolete since Gecko 1.9 Returns an object that may be used to read or write individual CSS style properties for the element. tooltip DOMString Gets/sets the value of the element's tooltip attribute. tooltipText DOMString Gets/sets the value of the element's tooltiptext attribute. top DOMString Gets/sets the value of the element's top attribute. width DOMString Gets/sets the value of the element's width attribute. Methods blur() Attempts to remove focus from the element. void blur(); Paramet...
nsIFeedResult
aPrefix); Attributes Attribute Type Description bozo boolean The feed processor sets the bozo bit when a feed triggers a fatal error during XML parsing. There may still be feed metadata and entries that were parsed before the error occurred. doc nsIFeedContainer The parsed feed or entry. null if a non-feed was processed. headers nsIProperties The HTTP response headers that accompanied the feed. stylesheet 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...
...ix() 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 aNamespace The namespace for the extension. aPrefix The prefix used to access the extension. See also nsISupports nsIFeedContainer nsIURI nsIProperties Interwiki link ...
nsIFile
te: If this method succeeds, this instance will be updated to point to the new file. If the current file path corresponds to a regular file (for storage of bytes), and if the new leaf name identifies a regular file that already exists, then this method will overwrite the destination file. Usually, "move" means to relocate the file to a different directory without changing the file's contents or properties, or in fact the file's serial number (inode). That is a very fast operation because it just changes directory information. The actual data doesn't move. Unfortunately, an actual "move" is impossible between different volumes (disks or partitions). This method attempts to do the "right thing" when moving files across volumes. That is, it will copy the old file to the new location, try to assign t...
...te: If this method succeeds, this instance will be updated to point to the new file. If the current file path corresponds to a regular file (for storage of bytes), and if the new leaf name identifies a regular file that already exists, then this method will overwrite the destination file. Usually, "move" means to relocate the file to a different directory without changing the file's contents or properties, or in fact the file's serial number (inode). That is a very fast operation because it just changes directory information. The actual data doesn't move. Unfortunately, an actual "move" is impossible between different volumes (disks or partitions). This method attempts to do the "right thing" when moving files across volumes. That is, it will copy the old file to the new location, try to assign t...
nsIMessageListener
nder interfaces. Listeners are attached using the nsIMessageListenerManager interface. Methods void receiveMessage(); receiveMessage() This is for JS only. This function receives a message from one of the three message-sending functions in the message manager framework: broadcastAsyncMessage sendAsyncMessage sendSyncMessage. The received message is an object with the following properties: target The target of the message. Either an element owning the message manager, or the message manager itself if no element owns it. If the message was sent from a frame script using a nsIContentFrameMessageManager, then this property is the XUL <browser> element for the frame from which the message was sent. name The message name. This is the first argument ...
...ent. name The message name. This is the first argument passed into the message-sending function. sync True if the message was sent using sendSyncMessage, false otherwise. data A structured clone of the message payload: the second argument passed into 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...
nsIMsgAccountManagerExtension
A Panel consists of a XUL file with a Page Element as root element and the Property File containing the localized name. Note: The Account Manager relies on a very strong naming scheme to load and unload a panel. ...
...count Manager relies on a very strong naming scheme to load and unload a panel. An Account Manager Extension with a "name" attribute of "devmo" and the "chromePackageName" attribute set to "extension@example.org" means, that the Account Manager expects to find a XUL file in "chrome://extension@example.org/content/am-devmo.xul" and a property file in "chrome://extension@example.org/locale/am-devmo.properties" containing a property named "prefPanel-devmo". You have to register any new Account Manager Extensions via the the category manager at start up. Simply add a new Entry with the Contact ID of the component to the "mailnews-accountmanager-extensions" category. //github.com/RealityRipple/UXP/blob/master/mailnews/base/public/nsIMsgAccountManager.idlScriptable Please add a summary to this article...
nsIMsgCompFields
<< XPCOM API Reference Summary The nsIMsgCompFields interface provides properties for an composition of an outgoing message. Properties Attribute Type Description attachments char * obsolete attachments OBSOLETE, DO NOT USE ANYMORE attachmentsArray nsISupportsArray readonly attachVCard PRBool bcc AString body AString bodyIsAsciiOnly PRBool cc AString characterSet char * defaultCharacterSet char * readonly drafId char * DSN PRBool fcc AString fcc2 AString followupTo char * forceMsgEncoding PRBool forcePlainText PR...
...ddressOnly ); 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, nsISMimeJSHelper.getRecipientCertsInfo ...
nsIMsgDBHdr
w code should use keywords instead. accountKey string Indicates the account that was originally used to fetch the message. May be blank if the message has not been moved or copied. folder nsIMsgFolder Readonly: Indicates the folder in which this message is stored. propertyEnumerator nsIUTF8StringEnumerator Readonly: Enumerator for names of all database properties in the header. (new in 3.1?) Methods getProperty() AString getProperty(in string propertyName); Parameters propertyName The name of the property to retrieve. Return Value The value of the property. setProperty() Sets a property on the header. For the currently selected message, Thunderbird provides a utility function: setMsgHdrPropertyAndReload(aProperty, aValue); which dupli...
... propertyValue); Parameters propertyName The name of the property to set. propertyValue The value of the property. getStringProperty() string getStringProperty(in string propertyName); Parameters propertyName The name of the property to retrieve. Return Value The value of the property. getUint32Property() Get an integer property. Usually you would use this to store your 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. setUint32Property()...
nsIParserUtils
sanitize(in AString src, in unsigned long flags); Constants Constant Value Description SanitizerAllowComments (1 << 0) Flag for sanitizer: Allow comment nodes. 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! SanitizerCidEmbedsOnly (1 << 2) Flag for sanitizer: Only allow cid: URLs for embedded content. At present, sanitizing CSS backgrounds, and so on., is not supported, so setting this together with SanitizerAllowStyle doesn't make sense. At present, sanitizing CSS syntax in SVG presentational attributes is not...
...and attributes or forms are not removed. To remove these, use SanitizerDropNonCSSPresentation and/or SanitizerDropForms. By default, comments and CSS is removed. To preserve comments, use SanitizerAllowComments. To preserve <style> elements and style attributes on other elements, use SanitizerAllowStyle. -moz-binding is removed from <style> elements and style attributes if present. In this case, properties that Gecko doesn't recognize can get removed as a side effect. 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 a...
nsIPrinterEnumerator
widget/nsIPrintOptions.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Method overview void displayPropertiesDlg(in wstring aPrinter, in nsIPrintSettings aPrintSettings); void enumeratePrinters(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult); Obsolete since Gecko 1.9 void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); Attributes Attribute Type Description defaultPrinterName wstring The name of the system default printer. This name should also be present in printerNameList. This is not necessarily gecko's default printer; see nsIPrintSettin...
...ription defaultPrinterName wstring The name of the system default printer. This name should also be present in printerNameList. This is not necessarily gecko's default printer; see nsIPrintSettingsService.defaultPrinterName for that. Read only. printerNameList nsIStringEnumerator The list of printer names. Read only. Methods displayPropertiesDlg() void displayPropertiesDlg( in wstring aPrinter, in nsIPrintSettings aPrintSettings ); Parameters aPrinter aPrintSettings enumeratePrinters() Obsolete since Gecko 1.9 (Firefox 3) Returns an array of the names of all installed printers. void enumeratePrinters( out PRUint32 aCount, [retval, array, size_is(aCount)] out wstring ...
nsIPropertyBag
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. ...
...Also pay attention to their platform-specific meaning (e.g. on Android there is version and kernel_version). ...
nsISHistory
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) In an embedded browser environment, the nsIWebBrowser object creates an instance of session history for each open window. A handle to the session history object can be obtained from nsIWebNavigation. In a non-embedded situation, the owner of the session history component must create a instance of it and set it in the nsIWebNavigation object. Implemented by: @mozilla.org/browser/shistory;1. ...
...rm the following steps: Call GetSHistoryEnumerator() to obtain handle the nsISimpleEnumerator object. Use nsISimpleEnumerator.GetNext() on the object returned by step #1 to obtain handle to the next object in the list. The object returned by this step is of type nsISupports. Perform a QueryInterface on the object returned by step #2 to nsISHEntry. Use nsISHEntry to access properties of each history entry. Read only. Methods addSHistoryListener() Called to register a listener for the session history component. Listeners are notified when pages are loaded or purged from history. Note: A listener object must implement nsISHistoryListener and nsSupportsWeakReference. void addSHistoryListener( in nsISHistoryListener aListener ); Parameters aListener Lis...
nsISecurityCheckedComponent
otentially unprivileged code. Inherits from: nsISupports Last changed in Gecko 1.7 Capability strings In Gecko, a "capability" is a string identifying a set of actions that code is allowed to perform. Two examples: 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 o...
... 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 creation is prevented, the properties and methods will not be defined on the JavaScript object, whereas if wrapper creation succeeds but methods/properties are prevented, the properties and methods 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 propertyNam...
nsISyncMessageSender
s crashed. Parameters Name Type Description messageName String The name of the message. Optional. This becomes the name property of the received message. obj Object. The message payload. A structured clone of this becomes the data property of the received message. objects Object. An object each of whose properties is an object. This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. principal nsIPrincipal Returns Array: an array of structured clones of the objects returned by all the listeners to this message, one element for each listener. If there was only one listener, it is an array with a s...
.... Parameters Name Type Description messageName String The name of the message. Optional. This becomes the name property of the received message. obj JSONable object. The message payload. A structured clone of this becomes the data property of the received message. objects Object. An object each of whose properties is an object. This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. principal nsIPrincipal Returns Array: an array of structured clones of the objects returned by all the listeners to this message, one element for each listener. If there was only one listener, it is an array with a s...
nsIXPCScriptable
inter to the JSObject being enumerated. enum_op Indicates what statep and idp represent, as well as indicates how the function should behave. This will always be one of three values: JSENUMERATE_INIT A new, opaque iterator state should be allocated and stored in statep. You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored. If idp is non-null, and provided the number of enumerable properties is known, the number of properties that will be enumerated should be returned as an integer jsval in idp. If idp is non-null and the number of enumerable properties cannot be computed in advance, idp should be set to JSVAL_ZERO. Your function might be passed a null pointer for idp. JSENUMERATE_NEXT A previously allocated opaque iterator state is passed in via statep. Return the next jsid in the...
... JSENUMERATE_DESTROY This function should destroy the opaque iterator state previously allocated in statep by this function when enum_op was JSENUMERATE_INIT. statep An in/out pointer to a jsval whose meaning depends on the value of enum_op. idp An in/out pointer to a jsid whose meaning depends on the value of enum_op. ...
MailNews fakeserver
xpcshell tests: <caption> nsMailServer xpcshell API </caption> Name Arguments Returns Description performTest none nothing Runs until the test is forcibly aborted or stopped normally isStopped none if the server is stopped helper for performTest isTestFinished none if the test is finished helper for performTest playTransaction none the transaction The transaction is an object with two properties: us, and them; us is an array of responses we sent, them an array of commands received resetTest none nothing prepares the server for the next test without closing the connection start port number nothing Starts the server listening stop none nothing Stops the server and closes the connection Using fakeserver in QA testing Debug output from fakeservers It is possible to get the fakes...
... 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 (p...
Mail event system
nged. This document describes the system that events are passed amongst the mail objects. For example, when a folder gets a new message, its total message count increases. The folder pane needs to know that this changed so that it can update the message count so the user can see it. Interfaces The key interfaces here are: nsIFolder.idl is an interface for storing a hierarchy of objects with properties. This interface is not (should not be) mail-related. nsIFolders each store individual lists of folder listeners which are maintained with addListener() and removeListener(). When a notification is fired on a folder, all of the folder's folder listeners and the mail session itself is notified. nsIFolderListener.idl is an interface that an object can implement if it is interested in listening to c...
...interface, and nsIMsgMailSession interface. OnItem*<event> - in the nsIFolderListener interface. The mail session implements this interface. Where <event> is the type of event, such as BoolPropertyChanged or the generic Event . Sample control flow Here is an example of a possible flow of control when a new message is added to a folder. In this example, there is a dialog open that shows properties for this folder including the message count. This dialog is a listener on this particular folder. A message is added to an nsImapMailFolder containing 4 messages. Because the number of messages in the folder have increased, this change in total message count needs to be broadcast to the world. The folder calls NotifyIntPropertyChanged on itself with the atom that represents "TotalMessages": ...
Access StringBundle from Overlay
ing your project by removing all of your strings into a separate, easy to access text file. Unfortunately adding the bundles into Thunderbird isn't as easy as adding them to your XUL overlay. ...
...ment.getElementById("your-extension-strings"); //get the stringbundle object itself str.getString("propertyName"); //get a string (and do something with it) Alternative way let stringBundleService = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService); let bundle = stringBundleService.createBundle("chrome://your_extension/locale/overlay.properties"); let str = bundle.GetStringFromName("propertyName"); see nsIStringBundleService ...
Theme Packaging
PNG (may contain alpha transparency) which will show up in the Appearance section of the Add-ons Manager. install.rdf Your install.rdf manifest will look something like this: <?xml version="1.0"?> <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"> <em:type>4</em:type> more properties </Description> </RDF> Required install.rdf Properties Your install.rdf file must have the following properties. See the install.rdf Reference for more information: em:id em:version em:type em:targetApplication em:name em:internalName Optional install.rdf Properties em:description em:creator em:contributor em:homepageURL em:updateURL Note that if your theme will be made ava...
...Do not add to this list without contacting Benjamin Smedberg. Note that this page is included from the pages listed below. So: Don't Add Breadcrumbs! Structure of an Installable B...
ArrayType
n't specify this parameter, the array's length is unspecified. Return value A CType represents the newly declared array type. Exceptions thrown TypeError type is not a CType, or type.size is undefined.If the length is specifed but if it is not a valid one,then it is also thrown RangeError The size of the resulting array can't be represented as both a size_t and as a JavaScript number. Properties Property Type Description elementType CType The data type of the elements in an array type. Read only. length Number The number of elements in the array, or undefined if the array type doesn't have a specified length. Read only. Properties inherited from CType These properties are available on all CType objects. Property Type ...
...; 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, such as myArray[index]. Properties inherited from CData Property Type Description constructor CType The data type of the CData object, as a CType. Re...
CData
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. ...
...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. ...
CType
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. ...
...t 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 Properties of all CType objects These properties are available on all CType objects. Property Type Description name String The type's name. Read only. For primitive types, this is just the name of the corresponding C type. For structure and opaque pointer types, this is simply the string that was passed to the constructor. For other function, pointer, an...
StructType
cannot be represented both as a size_t and as a JavaScript Number. Describing fields The fields array is comprised of field descriptors, one for each field in the structure. Each field descriptor contains the field's name and its type, such as {'serialNumber': ctypes.int}. A complete field descriptor list might look like this: [ {'serialNumber': ctypes.int}, {'userName': ctypes.char.ptr} ] Properties Property Type Description fields CType[] A sealed array of field descriptors. Read only. Properties inherited from CType These properties are available on all CType objects. Property Type Description name String The type's name. Read only. For primitive types, this is just the name of the corresponding C type. For str...
...pe's fields. This lets you convert an opaque structure type into a defined structure type. define( fields ); Parameters fields A field specification, as described above. StructType CData Syntax CData structtype(); structtype is StructType CType. Return value A CData representing the newly allocated struct. Exceptions thrown Error Fields are not yet defined. StructType CData Properties Every struct object has a getter and a setter for each member field of the structure. Properties inherited from CData Property Type Description constructor CType The data type of the CData object, as a CType. Read only. Note: This is never ctypes.void_t or an array type with an unspecified length. value object The JavaScript equivalent...
Mozilla
avaScript as the JavaScript representation of the DOM node. When XPConnect wraps a C++ object it will create a JSObject that is unique to this C++ object. In the case where the C++ object has class info (nsIClassInfo), the JSObject is a more or less empty JSObject which is not really that special. All the methods that are supposed to show up on this JSObject are actually not properties of the object itself, but rather properties of the prototype of the JSObject for the wrapper (unless the C++ object's class info has the flag nsIXPCScriptable::DONT_SHARE_PROTOTYPE set, but lets assume that's not the case here). js-ctypes js-ctypes allows application and extension code to call back and forth to native code written in C. C++ su...
... 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 for Scalable Vector Graphics, and th...
Scripting plugins - Plugins
API might provide a mechanism for proxying calls from one thread to another to aid in using this API from other threads. Security model The security model for making calls through this API is much like the general same-origin security model enforced by the browser. That means that a script from an origin other than the origin of the page that loaded the plugin is not able to access methods and properties on the plugin. The same thing applies the other way too; the plugin can reach only JavaScript objects in the same origin as the page that loaded the plugin. In addition to this, a further extension to this API is being discussed that would give a plugin greater flexibility by letting the plugin control the origin of the calling code, so that the plugin can specify the origin of calls that come f...
... 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 NPNVariable enumerations are defined in npapi.h as: NPNVWindowNPObject = 15, NPNVPluginElementNPObject = 16 How to call plugin native methods The following HTML code will do the job:...
DOM Property Viewer - Firefox Developer Tools
Enabling the DOM Property Viewer The DOM Property Viewer is not enabled by default. To enable it, open the developer tool settings and check the "DOM" box under "Default Firefox Developer Tools". ...
...iewer by selecting "DOM" from the Web Developer submenu in the Firefox Menu Panel (or Tools menu if you display the menu bar or are on macOS), 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. ...
All keyboard shortcuts - Firefox Developer Tools
us the CSS pane Tab Tab Tab CSS pane These shortcuts work when you're in the Inspector's CSS pane. ...
... when you're in the Inspector's CSS pane. ...
Network request list - Firefox Developer Tools
ow when you refresh the page, the item will once enabled. Note: (Starting in Firefox 80) You can also block and unblock URLs from the Web Console, using the :block and :unblock helper commands. These accept any string, and affect any URL containing the string. Filtering requests You can filter requests by content type, by whether they are XMLHttpRequests or WebSocket requests, or by request properties. Filter type How to apply Content type Use the buttons in the toolbar (HTML, CSS, JS). XHR requests Use the XHR button in the toolbar. WebSocket connections Use the WS button in the toolbar. You can filter by plain text (in which case the text is used to find partial matches; entering "for" will match any message that contains the word "for") o...
...); then start typing. The list of network requests is filtered to include only requests that contain your filter string, in either the Domain or the File portions. You can filter requests that don't contain your filter string by prefixing your query with the "-" operator. 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 t...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
CSS pane's Rules view, any instance of a display: flex declaration gets a small Flexbox icon next to the word flex. Clicking the icon toggles the display of an overlay on the page, which appears over the selected flex container that displays an outline around each flex item: The overlay will still be shown when you select other elements from the Inspector panel, so you can edit related CSS properties and see how the flex items are affected by your changes. The Layout Flex Container section The CSS pane's Layout view includes a collapsible "Flex Container" section. If you expand the section without selecting a flexbox container, it will only display the message, "Select a Flex container or item to continue". Once you select an element whose display is defined as flex, the panel will include ...
...yout view looks like this: There are two settings you can change in the Flex Container section: You can control the color of the overlay by clicking on the small circle next to the selector. This will toggle a color picker so you can select a different color for the overlay. The switch on the right-hand side of the Flex Container section will also toggle the overlay on and off. Flex item properties The flex items within the flex container are displayed as a numbered list in the Flex Items section. Each entry displays the item's selector. Hover over an element to highlight it on the page. If you click on the item, the display shifts to show details about that element: This view shows information about the calculations for the size of the selected flex item: A diagram visualizing th...
Page inspector keyboard shortcuts - Firefox Developer Tools
us the CSS pane Tab Tab Tab CSS pane These shortcuts work when you're in the Inspector's CSS pane. ...
... when you're in the Inspector's CSS pane. ...
Waterfall - Firefox Developer Tools
t 60 frames per second is the rate at which animations will appear smooth. For a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow. Importantly for responsiveness, the browser doesn't always have to go through every step: CSS animations update the page without having to run any JavaScript. Not all CSS property changes cause a reflow. Changing properties that can alter an object's geometry and position, such as width, display, font-size, or top, will cause a reflow. However, changing properties that don't alter geometry or position, such as color or opacity, will not. Not all CSS property changes cause a repaint. In particular, if you animate an element using the transform property, the browser will use a separate layer for the transformed eleme...
... that don't alter geometry or position, such as color or opacity, will not. Not all CSS property changes cause a repaint. In particular, if you animate an element using the transform property, the browser will use a separate layer for the transformed element, and doesn't even have to repaint when the element is moved: the new position of the element is handled in composition. The Animating CSS properties article shows how animating different CSS properties can give different performance outcomes, and how the Waterfall can help signal that. Blocking JavaScript By default, a site's JavaScript is executed in the same thread that the browser uses for layout updates, repaints, DOM events, and so on. This means that long-running JavaScript functions can cause unresponsiveness (jank): animations may n...
Responsive Design Mode - Firefox Developer Tools
or hide the Developer Tools toolbox independently of toggling Responsive Design Mode itself: While Responsive Design Mode is enabled, you can continue browsing as you normally would in the resized content area. Device selection Just above the viewport there is a label "no device selected"; click this to see a list of device names. Select a device, and Responsive Design Mode sets the following properties to match the selected device: 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 prop...
...ociated with each device, are taken from https://github.com/mozilla/simulated-devices. 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. Each device can have its own: Name Size DevicePixelRatio User Agent String Touch Screen Also, you can preview the properties of existing devices by hovering over the name in the device modal, where they display in a tooltip. Network throttling If you do all your development and testing using a very fast network connection, users may experience problems with your site if they are using a slower connection. In Responsive Design Mode, you can instruct the browser to emulate, very approximately, the characteristics of ...
Animation - Web APIs
Web › API › Animation
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. ...
...ved (i.e., put into an active replace state). Methods Animation.cancel() Clears all keyframeEffects caused by this animation and aborts its playback. animation.commitStyles() 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. Animation.finish() Seeks either end of an animation, depending on whether the animation is playing or reversing. Animation.pause() Suspends playing of an animation. animation.persist() Explicitly persists an animation, when it would otherwise be removed due to the browser's Automatically removing filling animations behavior. Animation.play() Starts or re...
AnimationEffect.getComputedTiming() - Web APIs
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). ...
...to, 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 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...
AnimationEffect.updateTiming() - Web APIs
Return Value None. ...
... Return Value None. ...
AudioTrackList - Web APIs
length Read only The number of tracks in the list. ...
... The AudioTrackList interface is used to represent a list of the audio tracks contained within a given HTML media element, with each track represented by a separate AudioTrack object in the list. Retrieve an instance of this object with HTMLMediaElement.audioTracks. The individual tracks can be accessed using array syntax. Properties This interface also inherits properties from its parent interface, EventTarget. length Read only The number of tracks in the list. Event handlers onaddtrack An event handler to be called when the addtrack event is fired, indicating that a new audio track has been added to the media element. onchange An event handler to be called when the change event occurs. This occurs when one or more tracks have been enabled or disabled by their enabled flag being cha...
AudioWorkletGlobalScope - Web APIs
sor-derived classes. Each BaseAudioContext has a single AudioWorklet available under the audioWorklet property, which runs its code in a single AudioWorkletGlobalScope. As the global execution context is shared across the current BaseAudioContext, it's possible to define any other variables and perform any actions allowed in worklets -- apart from defining AudioWorkletProcessor-derived classes. Properties currentFrame Read only Returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. It is incremented by 128 (the size of a render quantum) after the processing of each audio block. currentTime Read only Returns a double that represents the ever-increasing context time of the audio block being processed. It is equal to the currentTime pro...
...y of the BaseAudioContext the worklet belongs to. sampleRate Read only Returns a float that represents the sample rate of the associated BaseAudioContext. Methods registerProcessor() Registers a class derived from the AudioWorkletProcessor interface. The class can then be used by creating an AudioWorkletNode, providing its registered name. Examples In this example 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. // test-processor.js class TestProcessor extends AudioWorkletProcessor { constructor () { super() // current sample-frame and time at the moment of instantiation // to see values change, you can put these t...
AudioWorkletProcessor() - Web APIs
ly from a user-supplied code. Instead, they are created only internally by the creation of an associated AudioWorkletNodes. var processor = new AudioWorkletProcessor(options); Parameters options An object that is passed as options parameter to AudioWorkletNode constructor and passed through the structured clone algorithm. The object is based on AudioWorkletNodeOptions dictionary. 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...
...rameterData 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 AudioWorkletNode constructor and observe ho...
AuthenticatorResponse.clientDataJSON - Web APIs
ed 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 party's server. The original v...
...ptions.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 communication with the relying party. It has two properties: status: A string which is either "supported" which indicates the client support token binding but did not negotiate with the relying party or "present" when token binding was used already id: A DOMString which is the base64url encoding of the token binding ID which was used for the communication. Should this property be absent, it would indicate that the client does not support token ...
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 the s...
...et.addEventListener() Registers an event handler of a specific event type on the EventTarget. EventTarget.removeEventListener() Removes an event listener from the EventTarget. EventTarget.dispatchEvent() Dispatches an event to this EventTarget. Additional methods in Mozilla chrome codebase Mozilla includes a couple of extensions for use by JS-implemented event targets to implement onevent properties. See also WebIDL bindings. void setEventHandler(DOMString type, EventHandler handler) EventHandler getEventHandler(DOMString type) Specifications Specification Status Comment Battery Status API Candidate Recommendation Initial definition ...
BlobEvent - Web APIs
Web › API › BlobEvent
BlobEvent.data Read only A Blob representing the data associated with the event. The event was fired on the EventTarget because of something happening on that specific Blob. ...
... BlobEvent.data Read only A Blob representing the data associated with the event. The event was fired on the EventTarget because of something happening on that specific Blob. ...
Bluetooth - Web APIs
Web › API › Bluetooth
Bluetooth.referringDevice Read only Returns a reference to the device, if any, from which the user opened the current page. For example, an Eddystone beacon might advertise a URL, which the user agent allows the user to open. A BluetoothDevice representing the beacon would be available through navigator.bluetooth.referringDevice. Events ...
... Bluetooth.referringDevice Read only Returns a reference to the device, if any, from which the user opened the current page. For example, an Eddystone beacon might advertise a URL, which the user agent allows the user to open. A BluetoothDevice representing the beacon would be available through navigator.bluetooth.referringDevice. Events Bluetooth.onavailabil...
BluetoothDevice - Web APIs
BluetoothDevice.name Read only A DOMString that provices a human-readable name for the device. BluetoothDevice.gatt Read only A reference to the device's BluetoothRemoteGATTServer. BluetoothDevice.uuids Read only Lists the UUID's of GATT services provided by the device, that the current origin is allowed...
...or the device. BluetoothDevice.gatt Read only A reference to the device's BluetoothRemoteGATTServer. BluetoothDevice.uuids Read only Lists the UUID's of GATT services provided by the device, that the current origin is allowed to access. BluetoothDevice.watchingAdvertisements Read only If advertisments were activated using BluetoothDevice.watchAdvertisements(). Non-standard Chrome OS properties These properties were only implemented on Google's Chrome OS 45 and removed from Chrome 52. BluetoothDevice.adData Read only An instance of BluetoothAdvertisingData containing the most recent advertising data received for the device. BluetoothDevice.deviceClass Read only A number representing the Bluetooth devices "Class of Device". BluetoothDevice.vendorIDSource Read only ...
CDATASection - Web APIs
Methods This interface has no specific methods and implements those of its parent Text. Specifications Specification Status Comment DOMThe definition of 'CDATASection' in that specification. Living Standard Re-added in issue #295 due to web breakage DOM4The definition...
... Methods This interface has no specific methods and implements those of its parent Text. Specifications Specification Status Comment DOMThe definition of 'CDATASection' in that specification. Living Standard Re-added in issue #295 due to web breakage DOM4The definition of 'CDATASection' in that specification. ...
CSS.registerProperty() - Web APIs
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. syntax Optional A DOMString representing the expected syntax of the defined property. Defaults to "*". ...
... Working Draft Initial definition. ...
CSS - Web APIs
Web › API › CSS
Static properties 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. ...
... The CSS interface holds useful CSS-related methods. No objects with this interface are implemented: it contains only static methods and is therefore a utilitarian interface. Properties The CSS interface is a utility interface and no object of this type can be created: only static properties are defined on it. Static properties 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. CSS.registerProperty() Registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. CSS.supports...
CSSCounterStyleRule - Web APIs
CSSCounterStyleRule.name Is a DOMString object that contains the serialization of the <counter-style-name> defined for the associated rule. CSSCounterStyleRule.system Is a DOMString object that contains the serialization of the system descriptor defined for the associated rule. If the descriptor was not specified in the assoc...
... CSSCounterStyleRule.name Is a DOMString object that contains the serialization of the <counter-style-name> defined for the associated rule. CSSCounterStyleRule.system Is a DOMString object that contains the serialization of the system descriptor defined for the associated rule. If the descriptor was not specified in the associated rule, the attribute returns an empt...
CSSKeyframeRule - Web APIs
It has two specific properties: CSSKeyframe.keyText Represents the key of the keyframe, like '10%', '75%'. ...
... The CSSKeyframeRule interface describes an object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). 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%'. CSSKeyframe.style Read only Returns a CSSStyleDeclaration of the CSS style associated with the keyframe. Methods As a CSSRule, CSSKeyframeRule also implements the methods of that interface. It has no specific methods. Specification Specification ...
CSSKeyframesRule - Web APIs
It has two properties : CSSKeyframesRule.name Represents the name of the animation, used by the animation-name property. ...
... The CSSKeyframesRule interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contents of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). 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. CSSKeyframesRule.cssRules Read only Returns a CSSRuleList of the CSS rules in the media rule. Methods As a CSSRule, CSSKeyframesRule also implements the methods of that interface. It has three specific methods: CSSKeyframesRule.appendRule() Inserts a new keyframe rule into the current CSSKeyframesRule. The ...
CSSPrimitiveValue - Web APIs
CSSPrimitiveValue.primitiveType Read only An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. The value can be obtained by using the getStringValue() method. CSS_CM The value is a <length> in centimeters. The va...
... CSSPrimitiveValue.primitiveType Read only An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. The value can be obtained by using the getStringValue() method. CSS_CM The value is a <length> in centimeters. The value can be obtained b...
CSSPseudoElement - Web APIs
CSSPseudoElement.type Read only Returns the pseudo-element selector as a CSSOMString. ...
...es an event to this pseudo-element. EventTarget.removeEventListener() Removes an event listener from the pseudo-element. Examples Basic example using Element.pseudo Using pseudo-elements, 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.) The example below demonstrates the basic properties of the CSSPseudoElement object representing the opening quotation mark. const element = document.querySelector('q'); const cssPseudoElement = element.pseudo('::before'); console.log(cssPseudoElement.element); // Outputs [object HTMLQuoteElement] console.log(cssPseudoElement.type); // Outputs '::before' Specifications Specification Status Comment CSS Pseudo-Elements Lev...
CSSStyleSheet - Web APIs
The CSSStyleSheet interface represents a single CSS stylesheet, and lets you inspect and modify the list of rules contained in the stylesheet. It inherits properties and methods from its parent, StyleSheet. A stylesheet consists of a collection of CSSRule objects representing each of the rules in the stylesheet. The rules are contained in a CSSRuleList, which can be obtained from the stylesheet's cssRules property. For example, one rule might be a CSSStyleRule object containing a style such as: h1, h2 { font-size: 16pt; } Another rule might be an at-rule such as @import or @media, and so forth. See the Notes section for the various ways a CSSStyleSheet object can be obtained. Properties Inherits properties from its parent, StyleSheet. cssRules Read only Returns a live CSSRuleList w...
...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 used but are not likely to be removed anytime soon. rules Read only The rules property is functionally identical to the standard cssRules property; it returns a live CSSRuleList which maintains an up-to-date list of all of the rules in the style sheet. Legacy methods These methods are legacy ...
Determining the dimensions of elements - Web APIs
There are several properties you can look at in order to determine the width and height of elements, and it can be tricky to determine which is the right one for your needs. This article is designed to help you make that decision. Note that all these properties are read-only. If you want to set the width and height of an element, use width and height or the overriding min-width and max-width, and min-height and max-height properties. How much room does it use up? If you need to know the total amount of space an element occupies, including the width of the visible content, scrollbars (if any), padding, and border, you want to use the HTMLElement.offsetWidth and HTMLElement.offsetHeight properties. Most of the time these are the same as width and height of Element.getBoundingClientRect(), when ther...
...ement has width: 100px; and transform: scale(0.5); the getBoundingClientRect() will return 50 as the width, while offsetWidth will return 100. What's the size of the displayed content? If you need to know how much space the actual displayed content takes up, including padding but not including the border, margins, or scrollbars, you want to use the Element.clientWidth and Element.clientHeight properties: How big is the content? If you need to know the actual size of the content, regardless of how much of it is currently visible, you need to use the Element.scrollWidth and Element.scrollHeight properties. These return the width and height of the entire content of an element, even if only part of it is presently visible due to the use of scroll bars. For example, if a 600x400 pixel element is...
CanvasCaptureMediaStreamTrack - Web APIs
CanvasCaptureMediaStreamTrack.canvas Read only Returns the HTMLCanvasElement object whose surface is captured in real-time. Methods This interface inherits the methods of its parent, MediaStreamTrack. ...
... CanvasCaptureMediaStreamTrack.canvas Read only Returns the HTMLCanvasElement object whose surface is captured in real-time. Methods This interface inherits the methods of its parent, MediaStreamTrack. ...
CanvasRenderingContext2D.drawImage() - Web APIs
rce'); image.addEventListener('load', e => { ctx.drawImage(image, 33, 71, 104, 124, 21, 20, 87, 104); }); Result Understanding source element size The drawImage() method uses the source element's intrinsic size in CSS pixels when drawing. For example, if you load an Image and specify the optional size parameters in its constructor, you will have to use the naturalWidth and naturalHeight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height. The same goes for videoWidth and videoHeight if the element is a <video> element, and so on. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const image = new Image(60, 45); // Usin...
... Living Standard ...
Drawing text - Web APIs
current strokeStyle. function draw() { var ctx = document.getElementById('canvas').getContext('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...
...ns-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. The default value is alphabetic. direction = value Directionality. Possible values: ltr, rtl, inherit. The default value is inherit. 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. A textBaseline example Edit the code below and see your changes update live in the canvas: ctx.font = '48px serif'; ctx.textBaseline = 'hanging'; ctx.strokeText('Hello world', 0, 100); Playable code <canvas id="canva...
CaretPosition - Web APIs
CaretPosition.offsetNode Read only Returns a Node containing the found node at the caret's position. CaretPosition.offset Read only Returns a long representing the character offset in the caret position node. ...
... CaretPosition.offsetNode Read only Returns a Node containing the found node at the caret's position. CaretPosition.offset Read only Returns a long representing the character offset in the caret position node. ...
CharacterData - Web APIs
CharacterData.data Is a DOMString representing the textual data contained in this object. CharacterData.length Read only Returns an unsigned long representing the size of the string contained in CharacterData.data. NonDocumentTypeChildNode.nextElementSibling Read only Returns...
... CharacterData.data Is a DOMString representing the textual data contained in this object. CharacterData.length Read only Returns an unsigned long representing the size of the string contained in CharacterData.data. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediat...
ChildNode - Web APIs
Web › API › ChildNode
Methods There are no inherited methods. ChildNode.remove() Removes this ChildNode from the children list of its parent. ChildNode.before() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes. ChildNode.after() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. ...
... interface in ParentNode and ChildNode. previousElementSibling and nextElementSibling are now defined on the latter. The CharacterData and DocumentType implemented the new interfaces. Added the remove(), before(), after() and replaceWith() methods. Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element. Polyfill External on GitHub: childNode.js ...
ClipboardEvent - Web APIs
ClipboardEvent.clipboardData Read only Is a DataTransfer object containing the data affected by the user-initiated cut, copy, or paste operation, along with its MIME type. ...
... ClipboardEvent.clipboardData Read only Is a DataTransfer object containing the data affected by the user-initiated cut, copy, or paste operation, along with its MIME type. ...
CloseEvent - Web APIs
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]. ...
... 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]. ...
console - Web APIs
Web › API › Console
sage 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 possible or the JavaScript Object view if it is not possible. console.error() Outputs an error message. You may use string substitution and additional arguments with this method. cons...
... Bob. You've called me 5 times. Styling console output You can use the %c directive to apply a CSS style to console output: console.log("This is %cMy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px"); The text before the directive will not be affected, but the text after the directive will be styled using the CSS declarations in the parameter. The properties usable along with the %c syntax are as follows (at least, in Firefox -- they may differ in other browsers): background and its longhand equivalents. border and its longhand equivalents border-radius box-decoration-break box-shadow clear and float color cursor display font and its longhand equivalents line-height margin outline and its longhand equivalents padding text-* propertie...
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. 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 be...
...alue 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 Technically, ConstrainBoolean is actually based on an intermediary dictionary named ConstrainBooleanParameters, which adds exact and ideal to the simple Boolean type. However, for the s...
DOMMatrix - Web APIs
Web › API › DOMMatrix
The DOMMatrix interface represents 4x4 matrices, suitable for 2D and 3D operations including rotation and translation. It is a mutable 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...
...tes a new mutable DOMMatrix object given an array of double-precision (64-bit) floating-point values. If the array has six values, the result is a 2D matrix; if the array has 16 values, the result is a 3D matrix. Otherwise, a TypeError exception is thrown. fromMatrix() Creates a new mutable DOMMatrix object given an existing matrix or a DOMMatrixInit dictionary which provides the values for its properties. Usage notes The matrix defined by the DOMMatrix interface is comprised of four rows of four columns each. While it's beyond the scope of this article to explain the mathematics involved, this 4x4 size is enough to describe any transformation you might apply to either 2D or 3D geometries. [m11m21m31m41m12m22m32m42m13m23m33m43m14m24m34m44]\left [ \begin{matrix} m_{11} & m_{21} & m_{31} & m_{...
DOMMatrixReadOnly - Web APIs
dOnly interface represents a read-only 4x4 matrix, suitable for 2D and 3D operations. The DOMMatrix interrface--which is based upon DOMMatrixReadOnly--adds mutability, allowing you to alter the matrix after creating it. A 4x4 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 ot...
...tes a new mutable DOMMatrix object given an array of double-precision (64-bit) floating-point values. If the array has six values, the result is a 2D matrix; if the array has 16 values, the result is a 3D matrix. Otherwise, a TypeError exception is thrown. fromMatrix() Creates a new mutable DOMMatrix object given an existing matrix or a DOMMatrixInit dictionary which provides the values for its properties. If no matrix is specified, the matrix is initialized with every element set to 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. Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'DOMMatrixReadOnly' in that specification. Candidate Reco...
DOMPoint - Web APIs
Web › API › DOMPoint
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). ...
...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. Examples In the WebXR Device API, DOMPointReadOnly values are used to represent positions and orientations. In the followi...
DOMRectReadOnly.fromRect() - Web APIs
y: The coordinate of the top side of the rectangle. width: The width of the rectangle. ...
... y: The coordinate of the top side of the rectangle. width: The width of the rectangle. ...
DataTransferItem - Web APIs
DataTransferItem.type Read only The drag data item's type, typically a MIME type. ...
...t a file). DataTransferItem.getAsString() Invokes the specified callback with the drag data item string as its argument. DataTransferItem.webkitGetAsEntry() Returns an object based on FileSystemEntry representing the selected file's entry in its file system. This will generally be either a FileSystemFileEntry or FileSystemDirectoryEntry object. Example All of this interface's methods and properties have their own reference page, and each reference page has an example of its usage. Specifications Specification Status Comment HTML Living StandardThe definition of 'DataTransferItem' in that specification. Living Standard Initial definition. HTML 5.1The definition of 'DataTransferItem' in that specification. Recommendation W3C snapshot of WHATWG ...
DataTransferItemList - Web APIs
Methods DataTransferItemList.add() Adds an item (either a File object or a string) to the drag item list and returns a DataTransferItem object for the new item. ...
... string) to the drag item list and returns a DataTransferItem object for the new item. DataTransferItemList.remove() Removes the drag item from the list at the given index. DataTransferItemList.clear() Removes all of the drag items from the list. DataTransferItemList.DataTransferItem() Getter that returns a DataTransferItem at the given index. Example Each of this interface's methods and properties has a reference page, and each reference page has an example of its usage. Specifications Specification Status Comment HTML Living StandardThe definition of 'DataTransferItemList' in that specification. Living Standard HTML 5.1The definition of 'DataTransferItemList' in that specification. Recommendation Not included in W3C HTML5 Recommendation ...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
his list will have only one item, which we retrieve by selecting the first element in that list using [0]. Next, we get all the p elements that are descendants of the body: myBodyElements = myBody.getElementsByTagName("p"); Finally, we get the second item from the list of p elements via myP = myBodyElements[1]; Once you have gotten the DOM object for an HTML element, you can set its properties. For example, if you want to set the style background color property, you just add: myP.style.background = "rgb(255,0,0)"; // setting inline STYLE attribute Creating TextNodes with document.createTextNode("..") Use the document object to invoke the createTextNode method and create your text node. You just need to pass the text content. The return value is an object that represents the text no...
...myceltext currenttext=document.createTextNode(myceltext.data); mybody.appendChild(currenttext); Getting an attribute value At the end of sample1 there is a call to setAttribute on the mytable object. This call was used to set the border property of the table. To retrieve the value of the attribute, use the getAttribute method: mytable.getAttribute("border"); Hiding a column by changing style properties Once you have the object in your JavaScript variable, you can set style properties directly. The following code is a modified version of sample1.html in which each cell of the second column is hidden and each cell of the first column is changed to have a red background. Note that the style property was set directly. <html> <body onload="start()"> </body> <script> function start() { v...
EffectTiming.delay - Web APIs
The value of delay corresponds directly to EffectTiming.delay in timing objects returned by AnimationEffectReadOnly, KeyframeEffectReadOnly, and KeyframeEffect. ...
...b Animations API represents the number of milliseconds to delay the start of the animation. Element.animate(), KeyframeEffectReadOnly(), and KeyframeEffect() all accept an object of timing properties including delay. The value of delay corresponds directly to EffectTiming.delay in timing objects returned by AnimationEffectReadOnly, KeyframeEffectReadOnly, and KeyframeEffect. Syntax var timingProperties = { delay: delayInMilliseconds }; timingProperties.delay = delayInMilliseconds; Value A number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). Defaults to 0. Examples In the Pool of Tears example, each tear is passed a random delay via its timing object: // Rando...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
on's end time has been passed, the element will continue to be drawn in the state it was in at its last rendered frame. Note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. See the alternatives to fill modes section below for approaches that are simpler and more performant. Element.animate(), and KeyframeEffect() accept an object of timing properties including fill. The value of fill corresponds directly to fill in EffectTiming objects returned by getTiming() in AnimationEffect and KeyframeEffect. Syntax var timingProperties = { fill: "none" | "forwards" | "backwards" | "both" | "auto" } Value A DOMString indicating the fill type to use in order to properly render an affected element when outside the animation's active interval (that ...
...eyframe in the animation sequence). Then, when the animation finishes running, the box instantaneously leaps back to its original state and is upright once again. Give it a try below! Follow the White Rabbit example In the Follow the White Rabbit example, the White Rabbit's animation is formed by coupling a KeyframeEffect with an Animation object. The keyframeEffect takes an object of timing properties, which is where we pass in fill. Forwards makes the rabbit retain its last keyframe rather than reverting to its unanimated state: // Create a set of keyframes to slide the rabbit down the hole--and keep him down with 'fill'! var rabbitDownKeyframes = new KeyframeEffect( whiteRabbit, [ { transform: 'translateY(0%)' }, { transform: 'translateY(100%)' } ], { duration: 3000, ...
EffectTiming.iterationStart - Web APIs
Web Animations API's EffectTiming dictionary's iterationStart property specifies the repetition number which repetition the animation begins at and its progress through it. Element.animate(), KeyframeEffectReadOnly.KeyframeEffectReadOnly(), and KeyframeEffect.KeyframeEffect() all accept an object of timing properties including iterationStart. The value of iterationStart corresponds directly to AnimationEffectTimingReadOnly.iterationStart in timing objects returned by AnimationEffectReadOnly, KeyframeEffectReadOnly, and KeyframeEffect. 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 iteration...
...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 this regard. Specifications Specification Status Comment Web AnimationsThe definition of 'iterationStart' in that specification. Working Draft Editor's draft. ...
Element.classList - Web APIs
Web › API › Element › classList
dd/remove/toggle methods. See https://bugzilla.mozilla.org/show_bug.cgi?id=814014 Polyfill The legacy onpropertychange event can be used to create a living classList mockup thanks to a Element.prototype.className property that fires the specified event once it is changed. The following polyfill for both classList and DOMTokenList ensures full compliance (coverage) for all standard methods and properties of Element.prototype.classList for IE10-IE11 browsers plus nearly compliant behavior for IE 6-9. Check it out: // 1. String.prototype.trim polyfill if (!"".trim) String.prototype.trim = function(){ return this.replace(/^[\s]+|[\s]+$/g, ''); }; (function(window){"use strict"; // prevent global namespace pollution if(!window.DOMException) (DOMException = function(reason){this.message = reason}).pr...
...ill is limited in functionality. It's currently unable to polyfill out-of-document-elements (e.g. elements created by document.createElement before they are appended to a parent node) in IE6-7. However, it should work just fine in IE9. A major discrepancy between the polyfilled version of classList and the W3 specs is that for IE6-8, there is no way to create an immutable object (an object whose properties cannot be directly modified). In IE9, however, it is possible through extending the prototype, freezing the visible object, and overwritting native property methods. However, such actions would not work in IE6-IE8 and, in IE9, slow the performance of the entire webpage to a snail's crawl, making these modifications completely impractical for this polyfill. A minor note is that in IE6-7, this pol...
Element.getClientRects() - Web APIs
s() method of the Element interface returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client. Syntax let rectCollection = object.getClientRects(); Return value The returned value is a collection of DOMRect objects, one for each CSS border box associated with the element. 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. For tables with captions, the caption is included even though it's outside the border box of the table. When called on SVG elements other than an outer-<svg>, the "viewport" that the resulting rectangles are relative to is the viewport that the element's outer-<svg> establishes (and to be clear, the ...
...x transform, if any). Originally, Microsoft intended this method to return a TextRectangle object for each line of text. However, the CSSOM working draft specifies that it returns a DOMRect for each border box. For an inline element, the two definitions are the same. But for a block element, Mozilla will return only a single rectangle. Firefox 3.5 note Firefox 3.5 adds width and height properties to the TextRectangle object. The amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the rectangles. The returned rectangles do not include the bounds of any child elements that might happen to overflow. For HTML <area> elements, SVG elements that do not render anything themselves, display:none elements, and genera...
ElementTraversal - Web APIs
Specifications Specification Status Comment DOMThe definition of 'ChildNode' in that specification. ...
... Specifications Specification Status Comment DOMThe definition of 'ChildNode' in that specification. ...
ErrorEvent - Web APIs
ErrorEvent.message Read only Is a DOMString containing a human-readable error message describing the problem. ErrorEvent.filename Read only Is a DOMString containing the name of the script file in which the error occurred. ErrorEvent.lineno Read only Is an integer containing the line number of the script file on which the error occurred.
... ErrorEvent.message Read only Is a DOMString containing a human-readable error message describing the problem. ErrorEvent.filename Read only Is a DOMString containing the name of the script file in which the error occurred. ErrorEvent.lineno Read only Is an integer containing the line number of the script file on which the error occurred. ErrorEvent.colno Read on...
EventListener - Web APIs
Methods This interface doesn't inherit any methods. ...
... Methods This interface doesn't inherit any methods. ...
EventTarget - Web APIs
EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. Element, Document, and Window are the most common event targets, but other objects can be event targets, too. For example XMLHttpRequest, AudioNode, AudioContext, and others. Many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" wi...
...et.addEventListener() Registers an event handler of a specific event type on the EventTarget. EventTarget.removeEventListener() Removes an event listener from the EventTarget. EventTarget.dispatchEvent() Dispatches an event to this EventTarget. Additional methods in Mozilla chrome codebase Mozilla includes a couple of extensions for use by JS-implemented event targets to implement onevent properties. See also WebIDL bindings. void setEventHandler(DOMString type, EventHandler handler) EventHandler getEventHandler(DOMString type) Example Simple implementation of EventTarget var EventTarget = function() { this.listeners = {}; }; EventTarget.prototype.listeners = null; EventTarget.prototype.addEventListener = function(type, callback) { if (!(type in this.listeners)) { this.
File - Web APIs
Web › API › File
6" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">File</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor File() Returns a newly constructed File. Instance properties File.prototype.lastModified Read only Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight). File.prototype.lastModifiedDate Read only Returns the last modified Date of the file referenced by the File object. File.prototype.nameRead only Returns the name of the file referenced by the File object. File.prototype.webkitRelative...
...January 1st, 1970 at Midnight). File.prototype.lastModifiedDate Read only Returns the last modified Date of the file referenced by the File object. File.prototype.nameRead only Returns the name of the file referenced by the File object. File.prototype.webkitRelativePath Read only Returns the path the URL of the File is relative to. File implements Blob, so it also has the following properties available to it: File.prototype.size Read only Returns the size of the file in bytes. File.prototype.type Read only Returns the MIME type of the file. Instance methods The File interface doesn't define any methods, but inherits methods from the Blob interface: Blob.prototype.slice([start[, end[, contentType]]]) Returns a new Blob object containing the data in the specified range of...
FontFace - Web APIs
Web › API › FontFace
The FontFace interface represents a single usable font face. It allows control of the source of the font face, being a URL to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status. Constructor FontFace() Constructs and returns a new FontFace object, built from an external resource described by an URL or from an ArrayBuffer. Properties This interface doesn't inherit any property. FontFace.display A CSSOMString that determines how a font face is displayed based on whether and when it is downloaded and ready to use. FontFace.family A CSSOMString that retrieves or sets the family of the font. It is equivalent to the font-family descriptor. FontFace.featureSettings A CSSOMString that retrieves or sets infrequently used font fea...
...ce.display A CSSOMString that determines how a font face is displayed based on whether and when it is downloaded and ready to use. FontFace.family A CSSOMString that retrieves or sets the family of the font. It is equivalent to the font-family descriptor. FontFace.featureSettings A CSSOMString that 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. 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". F...
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 The fo...
...In this simple example I've just allowed either. function gameLoop() { if(navigator.webkitGetGamepads) { var gp = navigator.webkitGetGamepads()[0]; if(gp.buttons[0] == 1) { b--; } else if(gp.buttons[1] == 1) { a++; } else if(gp.buttons[2] == 1) { b++; } else if(gp.buttons[3] == 1) { ...
GamepadButton - Web APIs
ler, 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. GamepadButton.pressed Read only A Boolean value indicating whether the button is currently...
...In this simple example I've just allowed either. function gameLoop() { if(navigator.webkitGetGamepads) { var gp = navigator.webkitGetGamepads()[0]; if(gp.buttons[0] == 1) { b--; } else if(gp.buttons[1] == 1) { a++; } else if(gp.buttons[2] == 1) { b++; } else if(gp.buttons[3] == 1) { ...
GeolocationCoordinates - Web APIs
GeolocationCoordinates.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. ...
...ing 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. 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 headi...
GeolocationPosition - Web APIs
GeolocationPosition.coords Read only Secure context Returns a GeolocationCoordinates object defining the current location. ...
... The GeolocationPosition interface represents the position of the concerned device at a given time. The position, represented by a GeolocationCoordinates object, comprehends the 2D position of the device, on a spheroid representing the Earth, but also its altitude and its speed. Properties The GeolocationPosition interface doesn't inherit any properties. GeolocationPosition.coords Read only Secure context Returns a GeolocationCoordinates object defining the current location. GeolocationPosition.timestamp Read only Secure context Returns a DOMTimeStamp representing the time at which the location was retrieved. Methods The GeolocationPosition interface neither implements, nor inherits any methods. Specifications Specification Status Comment Geolocat...
Using the Geolocation API - Web APIs
tion object instance, which itself contains a GeolocationCoordinates object instance. The GeolocationPosition instance contains only two things, a coords property that contains the GeolocationCoordinates instance, and a timestamp property that contains a DOMTimeStamp instance representing the time at which the position data was retrieved. The GeolocationCoordinates instance contains a number of properties, but the two you'll use most commonly are latitude and longitude, which are what you need to draw your position on a map. Hence many Geolocation success callbacks look fairly simple: function success(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; // Do something with your latitude and longitude } You can however get a number of other ...
...ormation from a GeolocationCoordinates object, including altitude, speed, what direction the device is facing, and an accuracy measure of the altitude, longitude, and latitude data. Handling errors The error callback function, if provided when calling getCurrentPosition() or watchPosition(), expects a GeolocationPositionError object instance as its first parameter. This object type contains two properties, a code indicating what type of error has been returned, and a human-readable message that describes what the error code means. You could use it like so: function errorCallback(error) { alert(`ERROR(${error.code}): ${error.message}`); }; Examples In the following example the Geolocation API is used to retrieve the user's latitude and longitude. If sucessful, the available hyperlink is popu...
GeometryUtils - Web APIs
Methods GeometryUtils.getBoxQuads() Returns a list of DOMQuad objects representing the CSS fragments of the node. ...
... Methods GeometryUtils.getBoxQuads() Returns a list of DOMQuad objects representing the CSS fragments of the node. ...
GlobalEventHandlers - Web APIs
The GlobalEventHandlers mixin describes the event handlers common to several interfaces like HTMLElement, Document, or Window. Each of these interfaces can, of course, add more event handlers in addition to the ones listed below. Note: GlobalEventHandlers is a mixin and not an interface; you can't actually create an object of type GlobalEventHandlers. Properties This interface doesn't include any properties except for the event handlers listed below. Event handlers These event handlers are defined on the GlobalEventHandlers mixin, and implemented by HTMLElement, Document, Window, as well as by WorkerGlobalScope for Web Workers. GlobalEventHandlers.onabort Is an EventHandler representing the code to be called when the abort event is raised. GlobalEventHandlers.onanimationcancel An Ev...
... ...
HTMLBRElement - Web APIs
HTMLBRElement.clear Is a DOMString indicating the flow of text around floating objects. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLBRElement' in that specification. Living Standard No chan...
... HTMLBRElement.clear Is a DOMString indicating the flow of text around floating objects. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLBRElement' in that specification. Living Standard No change from HTML5 ...
HTMLBaseFontElement - Web APIs
HTMLBaseFontElement.color Is a DOMString representing the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. HTMLBaseFontElement.face Is a DOMString representing a list of one or more font names. ...
... The HTMLBaseFontElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <basefont> elements. The <basefont> element has been deprecated in HTML4 and removed in HTML5. This latest specification requires that this element implements HTMLUnknownElement rather than HTMLBaseFontElement. Properties Inherits properties from its parent, HTMLElement. HTMLBaseFontElement.color Is a DOMString representing the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. HTMLBaseFontElement.face Is a DOMString 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 l...
HTMLFormControlsCollection - Web APIs
Methods This interface inherits 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 HTMLCollect...
... Methods This interface inherits 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...
HTMLIsIndexElement - Web APIs
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. ...
... The HTMLIsIndexElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <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 S...
HTMLOptionElement - Web APIs
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 c...
... 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 i...
HTMLOptionsCollection - Web APIs
This object is returned only by the options property of select. ...
...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 me...
HTMLShadowElement - Web APIs
Methods This interface inherits the methods of HTMLElement. HTMLShadowElement.getDistributedNodes() Returns a static NodeList of the distributed nodes associated with this <shadow> element. Specifications This feature is no longer defined by any specifications. ...
... Methods This interface inherits the methods of HTMLElement. HTMLShadowElement.getDistributedNodes() Returns a static NodeList of the distributed nodes associated with this <shadow> element. Specifications This feature is no longer defined by any specifications. ...
HTMLTemplateElement - Web APIs
content Read only A read-only DocumentFragment which contains the DOM subtree representing the <template> element's template contents. Methods This interface inherits the methods of HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTemplateElement interface' ...
... content Read only A read-only DocumentFragment which contains the DOM subtree representing the <template> element's template contents. Methods This interface inherits the methods of HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTemplateElement interface' in that specification. Living Standar...
HTMLTrackElement - Web APIs
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. HTMLTrackEleme...
... 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 DOMS...
Drag Operations - Web APIs
, or an element that represents the dragged element in its new location. To do this, you could create an image or separator element and simply insert it into the document during the dragenter event. The dragover event will fire at the element the mouse is pointing at. Naturally, you may need to move the insertion marker around a dragover event as well. You can use the event's clientX and clientY properties as with other mouse events to determine the location of the mouse pointer. Finally, the dragleave event will fire at an element when the drag leaves the element. This is the time when you should remove any insertion markers or highlighting. You do not need to cancel this event. Any highlighting or other visual effects specified using the :-moz-drag-over pseudoclass will be removed automatically.
... dragged item from the old location. The mozUserCancelled property will be set to true if the user cancelled the drag (by pressing Escape), and false if the drag was cancelled for other reasons such as an invalid drop target, or if it was successful. A drop can occur inside the same window or over another application. The dragend event will always fire regardless. The event's screenX and screenY properties will be set to the screen coordinates where the drop occurred. After the dragend event has finished propagating, the drag and drop operation is complete. [1]: In Gecko, dragend is not dispatched if the source node is moved or removed during the drag (e.g. on drop or dragover). Bug 460801 See also HTML Drag and Drop API (Overview) Dragging and Dropping Multiple Items Recommended Drag Types...
HashChangeEvent - Web APIs
HashChangeEvent.newURL Read only The new URL to which the window is navigating. HashChangeEvent.oldURL Read only The previous URL from which the window was navigated. Methods This interface has no methods of its own, but inherits the methods of its parent, Event. Examples Syntax options for a hash change You can li...
... HashChangeEvent.newURL Read only The new URL to which the window is navigating. HashChangeEvent.oldURL Read only The previous URL from which the window was navigated. Methods This interface has no methods of its own, but inherits the methods of its parent, Event. Examples Syntax options for a hash change You can listen for the hashchange event using any of th...
IDBDatabase.createObjectStore() - Web APIs
You can use the property to uniquely identify individual objects in the store. As the property is an identifier, it should be unique to every object, and every object should have that property. This method can be called only within a versionchange transaction. Note: This feature is available in Web Workers. ...
...ature is available in Web Workers. Syntax IDBDatabase.createObjectStore(name); IDBDatabase.createObjectStore(name, options); Parameters name The name of the new object store to be created. Note that it is possible to create an object store with an empty name. optionalParameters Optional An options object whose attributes are optional parameters to the method. It includes the following properties: Attribute Description keyPath The key path to be used by the new object store. If empty or not specified, the object store is created without a key path and uses out-of-line keys. You can also pass in an array as a keyPath. autoIncrement If true, the object store has a key generator. Defaults to false. Unknown parameters are igno...
IDBIndex - Web APIs
Web › API › IDBIndex
ex interface of the 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 ...
...nserted, updated, or deleted. Each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. When the object store changes, all indexes that refers to the object store are automatically updated. You can grab a set of keys within a range. To learn more, see IDBKeyRange. Note: This feature is available in Web Workers. ...
KeyframeEffect.setKeyframes() - Web APIs
interface replaces 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 }, ...
...frame), and the browser will infer the other end of the animation if it is able to. For example, consider this simple animation -- the Keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; We have only specified the end state of the animation, and the beginning state is implied. Attributes Keyframes may specify property-value pairs for any of the animatable css properties. The property names are specified using camel-case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have no effect o...
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. KeyframeEffect.pseudoElement Gets and sets the selector of the pseudo-element being animated by this object. ...
....getKeyframes() Returns the computed keyframes that make up this effect along with their computed keyframe offsets. AnimationEffect.getTiming() The EffectTiming object associated with the animation containing all the animation's timing values. KeyframeEffect.setKeyframes() Replaces the set of keyframes that make up this effect. AnimationEffect.updateTiming() Updates the specified timing properties. Examples In the Follow the White Rabbit example, the KeyframeEffect constructor is used to create a set of keyframes that dictate how the White Rabbit should animate down the hole: var rabbitDownKeyframes = new KeyframeEffect( whiteRabbit, // element to animate [ { transform: 'translateY(0%)' }, // keyframe { transform: 'translateY(100%)' } // keyframe ], { dur...
LargestContentfulPaint - Web APIs
LargestContentfulPaint.renderTime The time the element was rendered to the screen. ...
...e The time the element was loaded. LargestContentfulPaint.size The intrinsic size of the element returned as the area (width * height). LargestContentfulPaint.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 serv...
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. LayoutShift.sources Returns an array of LayoutShiftAttribution objects with information on the elements that were shifted. ...
...fraction (distance moved as a fraction of viewport). 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. LayoutShift.sources Returns an array of LayoutShiftAttribution objects with information on the elements that were shifted. Methods LayoutShift.toJSON() Converts the properties to JSON. Examples The following example shows how to capture layout shifts and log them to the console. Note that in this example data is only sent to the server when the user leaves the tab. // Catch errors since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { let cumulativeLayoutShiftScore = 0; const observer = new Performa...
LocalFileSystem - Web APIs
m interface of the File System API gives you access to a sandboxed file system. The methods are implemented by window and worker objects. Basic concepts This section includes a few key concepts for the methods. Creating new storage You request access to a sandboxed file system by calling window.requestFileSystem(). The argument of a successful callback is the FileSystem object, which has two properties: the name and root of the file system. You can call the method more than once if you want to create two file systems: one that's temporary and one that's persistent. (To learn more about the storage types, see the Basic Concepts article.) In most cases, you need to create only one file system, but in a few cases, it might be useful to create a second one. For example, if you were to create a mai...
...ng 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 of the file system. opt_errorCallback The error callback that is called when errors happen or when the request to obtain the file system is denied. Its argument is the FileError object. Returns void Exceptions This method can raise an FileError w...
Locks.mode - Web APIs
Web › API › Lock › mode
ck was requested. The mode is either "exclusive" (the default) or "shared". Syntax var mode = Lock.mode Value One of "exclusive" or "shared". 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. ...
...e One of "exclusive" or "shared". 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. // Should show "exclusive" (the default) navigator.locks.request("my_resource", show_lock_properties); // Should show "exclusive" navigator.locks.request("my_resource", {mode: "exclusive"}, show_lock_properties); // Should show "shared" navigator.locks.request("my_resource", {mode: "shared"}, 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 Specification Status Comment Web Locks APIThe definition of 'mode' in that specification. Draft Initial d...
MSSiteModeEvent - Web APIs
This proprietary method is specific to Internet Explorer and Microsoft Edge. ...
...hat the createEvent method created. *Note that as of Microsoft Edge, the createEvent()/initEvent() constructor pattern for synthetic events is deprecated. preventDefault Cancels the default action of an event. 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. 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 Win...
MediaCapabilitiesInfo - Web APIs
The MediaCapabilitiesInfo interface of the Media Capabilities API is made available when the promise returned by the MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() methods of the MediaCapabilities interface fulfills, providing information as to whether the media type is supported, and whether encoding or decoding such media would be smooth and power efficient. Properties The MediaCapabilitiesInfo interface contains three Boolean attribues: supported: Given the properties defined in the MediaConfiguration, can the specified piece of media content be encoded (if MediaEncodingConfiguration is set) or decode (if MediaDecodingConfiguration is set) at all? If yes, supported is true. Otherwise, it is false. smooth: Given the properties defined in the MediaConfiguration, will th...
...Configuration is set) or decode (if MediaDecodingConfiguration is set) at all? If yes, supported is true. Otherwise, it is false. smooth: Given the properties defined in the MediaConfiguration, will the playback of the specified piece of media be high quality? Will it be smooth? If supported is true, and playback will be smooth, smooth is true, Otherwise, is it false. powerEfficient: Given the properties defined in the MediaConfiguration, will the playback of the specified piece of media be power efficient? If supported is true, and playback will be power efficient, powerEfficient is true, Otherwise, is it false. Browsers will report a supported media configuration as smooth and powerEfficient until stats on this device have been recorded. All supported audio codecs are reported to be power eff...
MediaDecodingConfiguration - Web APIs
This takes one of two values: file: Represents a configuration that is meant to be used for a plain file playback. ...
... The 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'...
MediaDevices - Web APIs
Events devicechange Fired when a media input or output device is attached to or removed from the user's computer. Also available via the ondevicechange property. Methods Inherits methods from its parent interface, EventTarget. ...
...to or removed from the user's computer. Also available via the ondevicechange property. Methods Inherits methods from its parent interface, EventTarget. enumerateDevices() Obtains an array of information about the media input and output devices available on the system. getSupportedConstraints() Returns an object conforming to MediaTrackSupportedConstraints indicating which constrainable properties are supported on the MediaStreamTrack interface. See Capabilities and constraints in Media Capture and Streams API (Media Stream) to learn more about constraints and how to use them. getDisplayMedia() Prompts the user to select a display or portion of a display (such as a window) to capture as a MediaStream for sharing or recording purposes. Returns a promise that resolves to a MediaStream. ge...
MediaEncodingConfiguration - Web APIs
using MediaRecorder. ...
... 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 : 'record', ...
MediaRecorder() - Web APIs
ration(s) to use by specifying the codecs parameter. Syntax var mediaRecorder = new MediaRecorder(stream[, options]); Parameters stream The MediaStream that will be recorded. This source media can come from a stream created using navigator.mediaDevices.getUserMedia() or from an <audio>, <video> or <canvas> element. options Optional A dictionary object that can contain the following properties: mimeType: A MIME type specifying the format for the resulting media; you may simply specify the container format (the browser will select its preferred codecs for audio and/or video), or you may use the codecs parameter and/or the profiles parameter to provide detailed information about which codecs to use and how to configure them. Applications can check in advance if a mimeType is support...
...can check in advance if a mimeType is supported by the user agent by calling MediaRecorder.isTypeSupported(). audioBitsPerSecond: The chosen bitrate for the audio 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 ty...
MediaStreamEvent - Web APIs
MediaStreamEvent.stream Read only Contains the MediaStream containing the stream associated with the event. Constructors MediaStreamEvent() Returns a new MediaStreamEvent. It takes two parameters, the first being a DOMString representing the type of the event; the second a dictionary containing the MediaStream it refers to. ...
...ent.stream Read only Contains the MediaStream containing the stream associated with the event. Constructors MediaStreamEvent() Returns a new MediaStreamEvent. It takes two parameters, the first being a DOMString representing the type of the event; the second a dictionary containing the MediaStream it refers to. Methods A MediaStreamEvent being an Event, this event also implements these properties. There is no specific MediaStreamEvent method. Examples pc.onaddstream = function( ev ) { alert("A stream (id: '" + ev.stream.id + "') has been added to this connection."); }; ...
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. ...
...can also specify ideal and/or acceptable sizes or ranges of sizes. See Applying constraints in Capabilities, constraints, and settings for more information on how to apply your preferred constraints. Syntax const appliedPromise = 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 ...
MediaStreamTrackEvent - Web APIs
track Read only A MediaStreamTrack object representing the track which was added to the stream. Constructor MediaStreamTrackEvent() Constructs a new MediaStreamTrackEvent with the specified configuration. Methods Also inherits methods from its parent Event. Specifications Specification Status Comment ...
... track Read only A MediaStreamTrack object representing the track which was added to the stream. Constructor MediaStreamTrackEvent() Constructs a new MediaStreamTrackEvent with the specified configuration. Methods Also inherits methods from its parent Event. Specifications Specification Status Comment Media Capture and Strea...
Media Capabilities API - Web APIs
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(). Consists of a media encoding type and a VideoConfiguration or AudioConfiguration dictionary. ...
...sts of a media encoding type and a VideoConfiguration or AudioConfiguration dictionary. VideoConfiguration Describes the required video properties that must be configured when querying a video configuration to be passed as part of a MediaConfiguration parameter to the MediaCapabilities.encodingInfo() and MediaCapabilities.decodingInfo() methods. AudioConfiguration Describes the required audio properties that must be configured when querying an audio configuration to be passed as part of a MediaConfiguration parameter to the MediaCapabilities.encodingInfo() and MediaCapabilities.decodingInfo() methods. Specifications Specification Status Comment Media Capabilities Draft Initial definition ...
MouseEvent - Web APIs
"231" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="281" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">MouseEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MouseEvent() Creates a MouseEvent object. Properties This interface also inherits properties of its parents, UIEvent and Event. MouseEvent.altKey Read only Returns true if the alt key was down when the mouse event was fired. MouseEvent.button Read only The button number that was pressed (if applicable) when the mouse event was fired. MouseEvent.buttons Read only The buttons being depressed (if any) when the mouse event was fired. Mous...
...ew ModuleThe definition of 'MouseEvent' in that specification. Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added movementX and movementY properties. CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft From Document Object Model (DOM) Level 3 Events Specification, added offsetX and offsetY, pageX and pageY, x, and y properties. Redefined screen, page, client, and coordinate (x and y) properties as double from long. UI EventsThe definition of 'MouseEvent' in that speci...
MutationObserverInit - Web APIs
Otherwise, a TypeError exception will be thrown. subtree Optional Set to true to extend monitoring to the entire subtree of nodes rooted at target. 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. ...
...primarily used as the type of the options parameter on the MutationObserver.observe() method. Properties At a minimum, one 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. 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 ...
NDEFReadingEvent - Web APIs
NDEFReadingEvent.serialNumber Read only Represents the serial number of the device used for anti-collision and identification, or empty string in case none is available. ...
... NDEFReadingEvent.serialNumber Read only Represents the serial number of the device used for anti-collision and identification, or empty string in case none is available. ...
Navigator - Web APIs
Web › API › Navigator
The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. A Navigator object can be retrieved using the read-only window.navigator property. Properties Doesn'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 ...
...ividing that number by 1024. Navigator.doNotTrack Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user. Navigator.mediaDevices Returns a reference to a MediaDevices object which can then be used to get information about available media devices (MediaDevices.enumerateDevices()), find out what constrainable properties are supported for media on the user's computer and user agent (MediaDevices.getSupportedConstraints()), and to request access to media using MediaDevices.getUserMedia(). Navigator.mediaSession Returns MediaSession object which can be used to provide metadata that can be used by the browser to present information about the currently-playing media to the user, such as in a global media controls U...
NodeIterator - Web APIs
The NodeIterator interface represents an iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order. Syntax A NodeIterator can be created using the Document.createNodeIterator() method, as follows: const nodeIterator = document.createNodeIterator(root, whatToShow, filter); Properties This interface doesn'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 Nu...
...deIterator.previousNode() Returns the previous Node in the document, or null if there are none. NodeIterator.nextNode() Returns the next Node in the document, or null if there are none. Specifications Specification Status Comment DOMThe definition of 'NodeIterator' in that specification. Living Standard Added the referenceNode and pointerBeforeReferenceNode properties. Removed the expandEntityReferences property. The method detach() has been changed to be a no-op. The methods previousNode() and nextNode() don't raise an exception any more. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'NodeIterator' in that specification. Obsolete Initial definition. ...
NonDocumentTypeChildNode - Web APIs
The NonDocumentTypeChildNode interface contains methods that are particular to Node objects that can have a parent, but not suitable for DocumentType. NonDocumentTypeChildNode is a raw interface and no object of this type can be created; it is implemented by Element, and CharacterData objects. Properties There are no inherited properties. NonDocumentTypeChildNode.previousElementSibling Read only Returns the Element immediately prior to this node in its parent's children list, or null if there is no Element in the list prior to this node. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediately following this node in its parent's children list, or null if there is no Element in the list following this node. Methods There are neither inherited nor specific m...
... ...
OrientationSensor - Web APIs
If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Interfaces based on OrientationSensor Below is a list of interfaces based on the OrientationSensor interface. ...
... 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. Interfaces based on OrientationSensor Below is a list of interfaces based on the OrientationSensor interface. AbsoluteOrientationSensor RelativeOrientationSensor Properties OrientationSensor.quaternion Returns a four element Array whose elements contain the components of the unit quaternion representing the device's orientation. Methods OrientationSensor.populateMatrix() Populates the given object with the rotation matrix based on the latest sensor reading. The rotation maxtrix is shown below. Examples Basic Example The following example, which is loos...
OscillatorNode - Web APIs
oNode for definitions) are: Number of inputs 0 Number of outputs 1 Channel count mode max Channel count 2 (not used in the default count mode) Channel interpretation speakers Constructor OscillatorNode() Creates a new instance of an OscillatorNode object, optionally providing an object specifying default values for the node's properties. ...
... 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 value is 440 Hz (a standard middle-A note). OscillatorNode.detune An a-rate AudioParam representing det...
PageTransitionEvent - Web APIs
PageTransitionEvent.persisted Read only Indicates if the document is loading from a cache. Example HTML <!DOCTYPE html> <html> <body> </body> </html> JavaScript window.addEventListener('pageshow', myFunction); function myFunction(event) { if (event.persisted) { alert("The page was cached by the browser"); } else...
... PageTransitionEvent.persisted Read only Indicates if the document is loading from a cache. Example HTML <!DOCTYPE html> <html> <body> </body> </html> JavaScript window.addEventListener('pageshow', myFunction); function myFunction(event) { if (event.persisted) { alert("The page was cached by the browser"); } else { alert("The page was NOT cached by ...
Page Visibility API - Web APIs
the video when the user puts the tab into the background, and resume playback when the user returns to the tab. The user doesn't lose their place in the video, the video's soundtrack doesn't interfere with audio in the new foreground tab, and the user doesn't miss any of the video in the meantime. Visibility states of an <iframe> are the same as the parent document. Hiding an <iframe> using CSS properties (such as display: none;) doesn't trigger visibility events or change the state of the document contained within the frame. Use cases Let's consider a few use cases for the Page Visibility API. A site has an image carousel that shouldn't advance to the next slide unless the user is viewing the page An application showing a dashboard of information doesn't want to poll the server for updates ...
...y change document.addEventListener(visibilityChange, handleVisibilityChange, false); // When the video pauses, set the title. // This shows the paused videoElement.addEventListener("pause", function(){ document.title = 'Paused'; }, false); // When the video plays, set the title. videoElement.addEventListener("play", function(){ document.title = '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...
PaintWorklet - Web APIs
Event handlers None. Methods This interface inherits methods from Worklet. PaintWorklet.registerPaint() Registers a class programmatically generate an image where a CSS property expects a file. ...
... given JavaScript file and adds it to the current PaintWorklet. Examples The following three examples go together to show creating, loading, and using a PaintWorklet. Create a PaintWorklet The following shows an example worklet module. This should be in a separate js file. Note that registerPaint() is called without a reference to PaintWorklet. ...
PannerNode.PannerNode() - Web APIs
The PannerNode() constructor of the Web Audio API creates a new PannerNode object instance. Syntax var myPanner = new PannerNode(context, options); Parameters Inherits parameters from the AudioNodeOptions dictionary. context A BaseAudioContext representing the audio context you want the node to be associated with. ...
...ode to have (the default is 360.) coneOuterAngle: The PannerNode.coneOuterAngle you want the PannerNode to have (the default is 360.) coneOuterGain: The PannerNode.coneOuterGain you want the PannerNode to have. The default is 0, and its value can be in the range 0-1. Return value A new PannerNode object instance. Exceptions RangeError The refDistance, maxDistance, or rolloffFactor properties have been given a value that is outside the accepted range. InvalidStateError The coneOuterGain property has been given a value outside the accepted range (0-1). Example var ctx = new AudioContext(); var options = { positionX : 1, maxDistance: 5000 } var myPanner = new PannerNode(ctx, options); Specifications Specification Status Comment Web Audio APIThe defin...
PannerNode - Web APIs
o or stereo but the output is always stereo (2 channels); you can't have panning effects without at least two audio channels! Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 2 Channel interpretation "speakers" Constructor PannerNode.PannerNode Creates a new PannerNode object instance. Properties Inherits properties from its parent, AudioNode. The orientation and position value are set and retrieved using different syntaxes, 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...
...D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PaymentAddress.addressLine - Web APIs
These lines may include the street name, house number, apartment number, rural delivery 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. ...
...ining 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 definition. ...
PaymentCurrencyAmount - Web APIs
The PaymentCurrencyAmount dictionary describes an amount of money in terms of both a number of units and the currency (US dollars, Euro, 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 d...
...sed 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 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 ...
PerformanceEntry.duration - Web APIs
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. "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. No...
...ed"); return; } // Create some performance entries via the mark() method performance.mark("Begin"); do_work(50000); performance.mark("End"); // Use getEntries() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not supported"); } for (var i=0; i < methods.length; i++) { // check...
PerformanceNavigationTiming.domComplete - Web APIs
e current document to complete. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.domContentLoadedEventEnd - Web APIs
MContentLoaded event completes. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.domContentLoadedEventStart - Web APIs
event at the current document. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.domInteractive - Web APIs
urrent document to interactive. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.loadEventEnd - Web APIs
current document is completed. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.loadEventStart - Web APIs
the current document is fired. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.redirectCount - Web APIs
r the current browsing context. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.type - Web APIs
one of the values listed above. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.unloadEventEnd - Web APIs
event of the previous document. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceNavigationTiming.unloadEventStart - Web APIs
event of the previous document. Example The following example illustrates this property's usage. ...
... Working Draft Initial definition. ...
PerformanceTiming - Web APIs
This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. The PerformanceTiming interface is a legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. Properties The PerformanceTiming interface doesn't inherit any properties. These properties each describe the time at which a particular point in the page loading process was reached. Some correspond to DOM events; others describe the time at which internal browser operations of interest took place. Each time is provided as an ...
... 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. ...
ProcessingInstruction - Web APIs
pplications which don't recognize the instruction. A processing instruction is different from the XML declaration. User-defined processing instructions cannot begin with "xml", as xml-prefixed processing-instruction target names are reserved by the XML specification for particular, standard uses (see, for example, <?xml-stylesheet ?>). The ProcessingInstruction interface inherits methods and properties from Node. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 10%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 700 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50"...
... Living Standard XML specification ...
PublicKeyCredentialCreationOptions - Web APIs
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. ...
...ation operation to complete. This hint may be overridden by the browser. PublicKeyCredentialCreationOptions.excludeCredentials Optional An Array of descriptors for existing credentials. This is provided by the relying party to avoid creating new public key credentials for an existing user who already have some. PublicKeyCredentialCreationOptions.authenticatorSelection Optional An object whose properties are criteria used to filter out the potential authenticators for the creation operation. PublicKeyCredentialCreationOptions.attestation Optional A String which indicates how the attestation (for the authenticator's origin) should be transported. PublicKeyCredentialCreationOptions.extensions Optional An object with several client extensions' inputs. Those extensions are used to request additio...
PushManager.unregister() - Web APIs
Return A DOMRequest object to handle the success or failure of the method call. ...
...register(pushEndpoint); Properties pushEndpoint A pushEndpoint to be unregistered. Return A DOMRequest object to handle the success or failure of the method call. If the method call is successful, the request's result will be a PushRegistration object representing the endpoint that has been unregistered. PushRegistration Those objects are anonymous JavaScript objects with the following properties: pushEndpoint A string representing the URL of the unregistered endpoint. version Undefined when unregister.onsuccess is called. Example var req = navigator.push.unregister(pushEndpoint); req.onsuccess = function(e) { var endpoint = req.result; debug("Unregistered endpoint: " + endpoint ); } req.onerror = function(e) { debug("Error unregistering the endpoint: " + JSON.stringify(e...
PushSubscription - Web APIs
PushSubscription.expirationTime Read only A DOMHighResTimeStamp of the subscription expiration time associated with the push subscription, if there is one, or null otherwise. PushSubscription.options Read only An object containing the options used to create the subscription. ...
...ription.subscriptionId Read only A DOMString containing the subscription ID associated with the push subscription. Methods PushSubscription.getKey() Returns an ArrayBuffer which contains the client's public key, which can then be sent to a server and used in encrypting push message data. PushSubscription.toJSON() Standard serializer -- returns a JSON representation of the subscription properties. PushSubscription.unsubscribe() Starts the asynchronous process of unsubscribing from the push service, returning a Promise that resolves to a Boolean when the current subscription is successfully unregistered. Example navigator.serviceWorker.ready.then(function(reg) { reg.pushManager.getSubscription().then(function(subscription) { subscription.unsubscribe().then(function(successful) {...
RTCAnswerOptions - Web APIs
Note: At this time, RTCAnswerOptions does not have any additional properties defined beyond those included in RTCOfferAnswerOptions. ...
... The RTCAnswerOptions dictionary is used to provide optional settings when creating an SDP answer using RTCPeerConnection.createOffer() after receiving an offer from a remote peer. The createOffer() method's options parameter is of this type. Properties This dictionary inherits properties from the RTCOfferAnswerOptions dictionary, on which it's based. Note: At this time, RTCAnswerOptions does not have any additional properties defined beyond those included in RTCOfferAnswerOptions. However, this is likely to change in the future, so the type has been defined in preparation for that eventuality. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCAnswerOptions' in that specification. Candidate Recommen...
RTCDTMFToneChangeEvent - Web APIs
Constructors RTCDTMFToneChangeEvent() Returns a new RTCDTMFToneChangeEvent. ...
... The RTCDTMFToneChangeEvent interface represents events sent to indicate that DTMF tones have started or finished playing. This interface is used by the tonechange event. Properties In addition to the properties of Event, this interface offers the following: RTCDTMFToneChangeEvent.tone Read only A DOMString specifying the tone which has begun playing, or an empty string ("") if the previous tone has finished playing. Constructors RTCDTMFToneChangeEvent() Returns a new RTCDTMFToneChangeEvent. It takes two parameters, the first being a DOMString representing the type of the event (always "tonechange"); the second a dictionary containing the initial state of the properties of the event. Methods Supports the methods defined in Event. There are no additional methods. Examples This snipp...
RTCDtlsTransport - Web APIs
Description Allocation of DTLS transports RTCDtlsTr...
...erty. You can, in 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 = se...
RTCIceCandidate.RTCIceCandidate() - Web APIs
ate 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, sdpMLineIndex, and usernameFragment properties. The candidate string (which is SDP text) is parsed; each property found is stored in the corresponding field in the RTCIceCandidate. If any of the fields is invalid, parsing of the string silently aborts without throwing an exception. The default value of candidate is the empty string, which indicates that the candidate is an "end-of-candidates" message. The following fields are initialized to...
...e 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 definition. ...
RTCIceCandidate.candidate - Web APIs
The candidate string specifies the network connectivity information for the 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. ...
RTCIceServer - Web APIs
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. ...
...perty; the startup time for your connection will go up substantially. Every server in the list will be contacted and tried out before one is selected to be used for negotiation. Older versions of the WebRTC specification included an url property instead of urls; this was changed in order to let you specify multiple addresses for each server in the list, as shown in the example below. Obsolete properties The following properties have been removed from the specification and should not be used. url This obsolete property is a string specifies a single ICE server's URL. Do not use this property; use urls instead. Because many older books and examples still use this, we include it to help developers update their code or make sense of older examples. Example The configuration below establish...
RTCIdentityErrorEvent - Web APIs
ted with the identity provider (idP). This is usually for an RTCPeerConnection. Two events are sent with this type: idpassertionerror and idpvalidationerror. Firefox implements this interface under the following name: RTCPeerConnectionIdentityErrorEvent. It is likely that it will correct this name when it will unprefix RTCPeerConnection, once spec and implementation will have been stabilized. Properties A RTCIdentityErrorEvent being an Event, this event also implements these properties. RTCIdentityErrorEvent.idp Read only Is a DOMString describing the domain name of the identity provider (idp) generating the error response. RTCIdentityErrorEvent.loginUrl Read only Is a DOMString giving the URL where the user can complete the authentication. It can be null and is provided by the identity...
...idp) generating the error response. RTCIdentityErrorEvent.loginUrl Read only Is a DOMString giving the URL where the user can complete the authentication. It can be null and is provided by the identity provider (idp). RTCIdentityErrorEvent.protocol Read only Is a DOMString describing the Idp protocol in use. Methods A RTCIdentityErrorEvent being an Event, this event also implements these properties. There is no specific RTCIdentityErrorEvent method. Examples pc.onidpassertionerror = function( ev ) { alert("The idp named '" + ev.idp + "' encountered an error " + "while generating an assertion."); } ...
RTCInboundRtpStreamStats - Web APIs
averageRtcpInterval A floating-point value indicating the average RTCP interval between two consecutive compound RTCP packets. ...
... 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. 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 d...
RTCOfferOptions - Web APIs
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. ...
... 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 specificati...
RTCOutboundRtpStreamStats - Web APIs
averageRtcpInterval A floating-point value indicating the average RTCP interval between two consecutive compound RTCP packets. ...
... averageRtcpInterval A floating-point value indicating the average RTCP interval between two consecutive compound RTCP packets. ...
RTCPeerConnectionIceErrorEvent - Web APIs
The RTCPeerConnectionIceErrorEvent interface--based upon the Event interface--provides details pertaining to an ICE error announced by sending an icecandidateerror event to the RTCPeerConnection object. Constructor RTCPeerConnectionIceErrorEvent() Creates and returns a new RTCPeerConnectionIceErrorEvent object, with its type and other properties initialized as specified in the parameters. You will not normally create an object of this type yourself. ...
...Event interface--provides details pertaining to an ICE error announced by sending an icecandidateerror event to the RTCPeerConnection object. Constructor RTCPeerConnectionIceErrorEvent() Creates and returns a new RTCPeerConnectionIceErrorEvent object, with its type and other properties initialized as specified in the parameters. You will not normally create an object of this type yourself. Properties The RTCPeerConnectionIceErrorEvent 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 ...
RTCPeerConnectionIceEvent - Web APIs
RTCPeerConnectionIceEvent.candidate Read only Contains the RTCIceCandidate containing the candidate associated with the event, or null if this event indicates that there are no further candidates to come. Constructors RTCPeerConnectionIceEvent() Returns a new RTCPeerConnectionIceEvent. ...
...his event indicates that there are no further candidates to come. Constructors RTCPeerConnectionIceEvent() Returns a new RTCPeerConnectionIceEvent. It takes two parameters, the first being a DOMString representing the type of the event; the second a dictionary containing the RTCIceCandidate it refers to. Methods A RTCPeerConnectionIceEvent being an Event, this event also implements these properties. There is no specific RTCDataChannelEvent method. Examples 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' in...
RTCRtpCapabilities - Web APIs
CRtpReceiver in response to a call to the RTCRtpSender.getCapabilities() or RTCRtpReceiver.getCapabilities() static functions, both of which return an array of RTCRtpCapabilities objects. An RTCRtpCapabilities object contains an array of objects conforming to RTCRtpCodecCapability (each describing the capabilities of one codec) and an array of the supported RTP header extensions for that codec. Properties codecs An array of RTCRtpCodecCapability objects, each describing one of the codecs supported by the RTCRtpSender or RTCRtpReceiver. There are some special entries in this array, described below in the section The codecs array. headerExtensions An array of objects conforming to the RTCRtpHeaderExtensionCapability dictionary. Each object contains a single DOMString, uri, specifying the URI o...
... array of objects conforming to the RTCRtpHeaderExtensionCapability dictionary. Each object contains a single DOMString, uri, specifying the URI of the header extension, as described in RFC 5285. Description The codecs array The codecs array is an array of objects conforming to the dictionary RTCRtpCodecCapability. 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 u...
RTCRtpReceiver - Web APIs
RTCRtpReceiver.transport Read only Returns the RTCDtlsTransport instance over which the media for the receiver's track is received. 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. ...
...ver interface of the WebRTC API manages the reception and decoding of data for a MediaStreamTrack on an RTCPeerConnection. Properties RTCRtpReceiver.track Read only Returns the MediaStreamTrack associated with the current RTCRtpReceiver instance. RTCRtpReceiver.transport Read only Returns the RTCDtlsTransport instance over which the media for the receiver's track is received. 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 RTCRtpReceiver.getContributingSources() Returns an array of RTCRtpContributingSource instances for each unique CSRC (contributing source) identifier received by the current RTCRtpReceiver in the last ten seconds. RTCRtpRecei...
RTCRtpSender - Web APIs
etails about how a particular MediaStreamTrack is encoded and sent to a remote peer. With it, you can configure the encoding used for the corresponding track, get information about the device's media capabilities, and so forth. You can also obtain access to an RTCDTMFSender which can be used to send DTMF codes (to simulate the user pressing buttons on a telephone's dial pad) to the remote peer. Properties RTCRtpSender.dtmf Read only An RTCDTMFSender which can be used to send DTMF tones using telephone-event payloads on the RTP session represented by the RTCRtpSender object. If null, the track and/or the connection 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 RTCR...
...tpSender. 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 describing the current configuration for the encoding and transmission of media on the track. RTCRtpSender.getStats() Returns a Promise which is fulfilled wit...
RTCSessionDescription - Web APIs
describes and of the SDP descriptor of the session. The process of negotiating a connection between two peers involves exchanging RTCSessionDescription objects back and forth, with each description suggesting one combination of connection configuration options that the sender of the description supports. Once the two peers agree upon a configuration for the connection, negotiation is complete. Properties The RTCSessionDescription interface doesn't inherit any properties. RTCSessionDescription.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...
...oyed 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 RTCSessionDescription(message), function () { ...
RTCTrackEventInit - Web APIs
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. ...
... 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. ...
RadioNodeList - Web APIs
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 ...
... 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 ...
ReportingObserver - Web APIs
Methods ReportingObserver.disconnect() Stops a reporting observer that had previously started observing from collecting reports. ReportingObserver.observe() Instructs a reporting observer to start collecting reports in its report queue. ...
... Methods ReportingObserver.disconnect() Stops a reporting observer that had previously started observing from collecting reports. ...
Request.mode - Web APIs
Web › API › Request › mode
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. ...
...ou 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 any headers except for those that are simple headers. In addition, JavaScript may not access any properties of the resulting Response. This ensures that ServiceWorkers do not affect the semantics 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, bu...
Request - Web APIs
Web › API › Request
The Request interface of the Fetch API represents a resource request. You can create a new Request object using the Request() constructor, but you are more likely to encounter a Request object being returned as the result of another API operation, such as a service worker FetchEvent.request. Constructor Request() Creates a new Request object. Properties Request.cache Read only Contains the cache mode of the request (e.g., default, reload, no-cache). Request.context Read only Contains the context of the request (e.g., audio, image, iframe, etc.) Request.credentials Read only Contains the credentials of the 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 reque...
...ly Contains the mode for how redirects are handled. It may be one of follow, error, or manual. Request.referrer Read only Contains the referrer of the request (e.g., client). Request.referrerPolicy Read only Contains the referrer policy of the request (e.g., no-referrer). Request.url Read only Contains the URL of the request. Request implements Body, so it also inherits the following properties: body Read only A simple getter used to expose a ReadableStream of the body contents. bodyUsed Read only Stores a Boolean that declares whether the body has been used in a response yet. Methods Request.clone() Creates a copy of the current Request object. Request implements Body, so it also has the following methods available to it: Body.arrayBuffer() Returns a promise that re...
ResizeObserverEntry - Web APIs
ResizeObserverEntry.contentBoxSize Read only An object containing the new content box size of the observed element when the callback is run. ...
...ox size of the observed element when the callback is run. ResizeObserverEntry.contentBoxSize Read only An object containing the new content box size of the observed element when the callback is run. ResizeObserverEntry.contentRect Read only A DOMRectReadOnly object containing the new size of the observed element when the callback is run. Note that this is better supported than the above two properties, 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. ResizeObserverEntry.target Read only A reference to the Element or SVGElement being observed. Note: The content box is the box in which content can be placed, meaning the border box minus the padding and border width.
Response - Web APIs
Web › API › Response
etch API represents the response to a request. You can create a new Response object using the Response.Response() constructor, but you are more likely to encounter a Response object being returned as the result of another API operation--for example, a service worker FetchEvent.respondWith, or a simple WindowOrWorkerGlobalScope.fetch(). Constructor Response() Creates a new Response object. Properties Response.headers Read only The Headers object associated with the response. Response.ok Read only A boolean indicating whether the response was successful (status in the range 200-299) or not. Response.redirected Read only Indicates whether or not the response is the result of a redirect (that is, its URL list has more than one entry). Response.status Read only The status code of th...
...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 exposing a ReadableStream of the body contents. Body.bodyUsed Read only Stores a Boolean that declares whether the body has been used in a response yet. Methods Response.clone() Creates a clone of a Response object. Response.error() Returns a new Response object ...
SVGAnimatedPathData - Web APIs
SVG animated path data interface The SVGAnimatedPathData interface supports elements which have a 'd' attribute which holds SVG path data, and supports the ability to animate that attribute. ...
...None Properties SVGPathSegList animatedNormalizedPathSegList SVGPathSegList animatedPathSegList SVGPathSegList normalizedPathSegList SVGPathSegList pathSegList Normative document SVG 1.1 (2nd Edition) Properties This interface also inherits properties from its parent, SVGPathElement. Name Type Description animatedNormalizedPathSegList SVGPathSegList Provides access to the current animated contents of the 'd' attribute in a form where all path data commands are expressed in...
SVGAnimatedRect - Web APIs
animVal SVGRect A read only SVGRect representing the current animated value of the given attribute. ...
... animVal SVGRect A read only SVGRect representing the current animated value of the given attribute. ...
SVGAnimationElement - Web APIs
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. SVGAnima...
... 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 flo...
SVGCircleElement - Web APIs
SVGCircleElement.cx Read only This property defines the x-coordinate of the center of the <circle> element. It is denoted by the cx attribute of the element. SVGCircleElement.cy Read only This property defines the y-coordinate of the center of the <circle> element. It is denoted by the cy attribute of the ...
... SVGCircleElement.cx Read only This property defines the x-coordinate of the center of the <circle> element. It is denoted by the cx attribute of the element. SVGCircleElement.cy Read only This property defines the y-coordinate of the center of the <circle> element. It is denoted by the cy attribute of the element. SVGCircleElement.r Read only ...
SVGDescElement - Web APIs
Methods This interface has no methods but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDescElement' in that specification. Candidate Recommendation Removed the inheritance from SVG...
... Methods This interface has no methods but inherits methods from its parent, SVGGeometryElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGDescElement' in that specification. Candidate Recommendation Removed the inheritance from SVGLangSpace and SVGStylable Scalab...
SVGDocument - Web APIs
embedded inline within an XHTML document, then an SVGDocument object will not exist; instead, the root object in the document object hierarchy will be a Document object of a different type, such as an HTMLDocument object. ...
... Methods None Properties DOMString domain DOMString referrer SVGSVGElement rootElement DOMString title DOMString URL Normative document SVG 1.1 (2nd Edition) Properties 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...
SVGElement - Web APIs
These can also be defined in SVG using attributes o...
...These can also be defined in SVG using attributes of the form data-*, where *...
SVGFEDistantLightElement - Web APIs
SVGFEDistantLightElement.azimuth Read only An SVGAnimatedNumber corresponding to the azimuth attribute of the given element. SVGFEDistantLightElement.elevation Read only An SVGAnimatedNumber corresponding to the elevation attribute of the given element. Methods This interface does not provide any specific m...
... SVGFEDistantLightElement.azimuth Read only An SVGAnimatedNumber corresponding to the azimuth attribute of the given element. SVGFEDistantLightElement.elevation Read only An SVGAnimatedNumber corresponding to the elevation attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its paren...
SVGFEMergeNodeElement - Web APIs
SVGFEMergeNodeElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects Mod...
... SVGFEMergeNodeElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'SVGFEMergeN...
SVGFEPointLightElement - Web APIs
SVGFEPointLightElement.x Read only An SVGAnimatedNumber corresponding to the x attribute of the given element. SVGFEPointLightElement.y Read only An SVGAnimatedNumber corresponding to the y attribute of the given element. SVGFEPointLightElement.z Read only An SVGAnimatedNumber corresponding to the z attribu...
... SVGFEPointLightElement.x Read only An SVGAnimatedNumber corresponding to the x attribute of the given element. SVGFEPointLightElement.y Read only An SVGAnimatedNumber corresponding to the y attribute of the given element. SVGFEPointLightElement.z Read only An SVGAnimatedNumber corresponding to the z attribute of the given element. Methods This ...
SVGFESpotLightElement - Web APIs
SVGFESpotLightElement.x Read only An SVGAnimatedNumber corresponding to the x attribute of the given element. SVGFESpotLightElement.y Read only An SVGAnimatedNumber corresponding to the y attribute of the given element. SVGFESpotLightElement.z Read only An SVGAnimatedNumber corresponding to the z attribute ...
... SVGFESpotLightElement.x Read only An SVGAnimatedNumber corresponding to the x attribute of the given element. SVGFESpotLightElement.y Read only An SVGAnimatedNumber corresponding to the y attribute of the given element. SVGFESpotLightElement.z Read only An SVGAnimatedNumber corresponding to the z attribute of the given element. SVGFESpotLightElem...
SVGFilterElement - Web APIs
The SVGFilterElement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" 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="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" s...
...Takes one of the constants defined in SVGUnitTypes. SVGFilterElement.primitiveUnits Read only An SVGAnimatedEnumeration that corresponds to the primitiveUnits attribute of the given <filter> element. Takes one of the constants defined in SVGUnitType...
SVGFitToViewBox - Web APIs
SVG fit to view box interface The SVGFitToViewBox interface is used to reflect the viewBox and preserveAspectRatio attributes, and is mixed in to other interfaces for elements that support these two attributes. ...
... Also implement None Methods None Properties SVGAnimatedPreserveAspectRatio preserveAspectRatio SVGAnimatedRect viewBox Normative document SVG 1.1 (2nd Edition) Properties Name Type Description preserveAspectRatio SVGAnimatedPreserveAspectRatio Corresponds to attribute preserveAspectRatio on the given element. viewBox SVGAnimatedRect Corresponds to attribute viewBox on the given element. ...
SVGImageElement - Web APIs
SVGImageElement.crossOrigin A DOMString corresponding to the crossorigin attribute of the given <image> element. SVGImageElement.decoding Returns a DOMString representing a hint given to the browser on how it should decode the image. SVGImageElement.height Read only An SVGAnimatedLength corresponding to the hei...
... SVGImageElement.crossOrigin A DOMString corresponding to the crossorigin attribute of the given <image> element. SVGImageElement.decoding Returns a DOMString representing a hint given to the browser on how it should decode the image. SVGImageElement.height Read only An SVGAnimatedLength corresponding to the height attribute of the given <image> elemen...
SVGLength - Web APIs
Web › API › SVGLength
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. ...
...ts defined in CSS2. SVG_LENGTHTYPE_MM 7 A value was specified using the mm units defined in CSS2. SVG_LENGTHTYPE_IN 8 A value was specified using the in units defined in CSS2. SVG_LENGTHTYPE_PT 9 A value was specified using the pt units defined in CSS2. SVG_LENGTHTYPE_PC 10 A value was specified using the pc units defined in CSS2. Properties Name Type Description unitType unsigned short The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface. value float 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. ...
SVGLengthList - Web APIs
length unsigned long The number of items in the list. Methods Name & Arguments ...
...ore(in SVGLength newItem, in unsigned long index) SVGLength replaceItem(in SVGLength newItem, in unsigned long index) SVGLength removeItem(in unsigned long index) SVGLength appendItem(in SVGLength newItem) Properties readonly unsigned long numberOfItems readonly unsigned long length Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItems unsigned long The number of items in the list. length unsigned long The number of items in the list. Methods Name & Arguments Return Description clear() void Clears all existing current items from the list, with the result being an empty list. Exceptions: ...
SVGLinearGradientElement - Web APIs
SVGLinearGradientElement.x1 Read only An SVGAnimatedLength corresponding to the x1 attribute of the given <linearGradient> element. SVGLinearGradientElement.y1 Read only An SVGAnimatedLength corresponding to the y1 attribute of the given <linearGradient> element. SVGLinearGradientElement.x2 Read only An SVGAn...
... SVGLinearGradientElement.x1 Read only An SVGAnimatedLength corresponding to the x1 attribute of the given <linearGradient> element. SVGLinearGradientElement.y1 Read only An SVGAnimatedLength corresponding to the y1 attribute of the given <linearGradient> element. SVGLinearGradientElement.x2 Read only An SVGAnimatedLength corresponding to the x2 attr...
SVGNumberList - Web APIs
length unsigned long The number of items in the list. Methods Name & Argument...
...VGNumber newItem, in unsigned long index) SVGNumber replaceItem(in SVGNumber newItem, in unsigned long index) SVGNumber removeItem(in unsigned long index) SVGNumber appendItem(in SVGNumber newItem) Properties readonly unsigned long numberOfItems readonly unsigned long length Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItems unsigned long The number of items in the list. length unsigned long The number of items in the list. Methods Name & Arguments Return Description clear() void Clears all existing current items from the list, with the result being an empty list. Exceptions: ...
SVGPathSeg - Web APIs
SVG path segment interface This is a base interface that corresponds to a single command within a path data specification. ...
...curveto" (s) path data command. PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS 18 Corresponds to an "absolute smooth quadratic curveto" (T) path data command. PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL 19 Corresponds to a "relative smooth quadratic curveto" (t) path data command. Properties Name Type Description pathSegType unsigned short The type of the path segment as specified by one of the constants defined on this interface. pathSegTypeAsLetter DOMString The type of the path segment as specified by the co...
SVGPatternElement - Web APIs
SVGPatternElement.patternUnits Read only An SVGAnimatedEnumeration corresponding to the patternUnits attribute of the given <pattern> element. Takes one of the constants defined in SVGUnitTypes. SVGPatternElement.patternContentUnits Read only An SVGAnimate...
... SVGPatternElement.patternUnits Read only An SVGAnimatedEnumeration corresponding to the patternUnits attribute of the given <pattern> element. Takes one of the constants defined in SVGUnitTypes. SVGPatternElement.patternContentUnits Read only An SVGAnimatedEnumeration corresponding to the pattern...
SVGPreserveAspectRatio - Web APIs
eAspectRatio interface The SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements. An SVGPreserveAspectRatio object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...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_MEETORSLICE_MEET 1 Corresponds to value meet for attribute preserveAspectRatio. SVG_MEETORSLICE_SLICE 2 Corresponds to value slice for attribute preserveAspectRatio. Properties Name Type Description align unsigned short The type of the alignment value as specified by one of the SVG_PRESERVEASPECTRATIO_* constants defined on this interface. meetOrSlice unsigned short The type of the meet-or-slice value as specified by one of the SVG_MEETORSLICE_* constants defined on this interface. Exceptions on setting: a DOMExce...
SVGRadialGradientElement - Web APIs
SVGRadialGradientElement.cx Read only An SVGAnimatedLength corresponding to the cx attribute of the given <RadialGradient> element. SVGRadialGradientElement.cx Read only An SVGAnimatedLength corresponding to the cy attribute of the given <RadialGradient> element. SVGRadialGradientElement.r Read only An SVGAni...
... SVGRadialGradientElement.cx Read only An SVGAnimatedLength corresponding to the cx attribute of the given <RadialGradient> element. SVGRadialGradientElement.cx Read only An SVGAnimatedLength corresponding to the cy attribute of the given <RadialGradient> element. SVGRadialGradientElement.r Read only An SVGAnimatedLength corresponding to the r attrib...
SVGRect - Web APIs
Web › API › SVGRect
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 ...
...he 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, DOMRectReadOnly. Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'DOMRect' in that specification. Candidate Recommendation Changed SVGRect as a legacy alias of DOMRect. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGRect' in that specification. Recommendation I...
SVGStopElement - Web APIs
SVGStopElement.offset Read only An SVGAnimatedNumber corresponding to the offset of the given element. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment Scalable Ve...
... SVGStopElement.offset Read only An SVGAnimatedNumber corresponding to the offset of the given element. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'S...
SVGStringList - Web APIs
length unsigned long A mirror of the value in numberOfItems, for consistency with other interfaces...
...DOMString newItem, in unsigned long index) DOMString replaceItem(in DOMString newItem, in unsigned long index) DOMString removeItem(in unsigned long index) DOMString appendItem(in DOMString newItem) Properties readonly unsigned long numberOfItems readonly unsigned long length Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItems unsigned long The number of items in the list. length unsigned long A mirror of the value in numberOfItems, for consistency with other interfaces. Methods Name & Arguments Return Description clear() void Clears all existing current items from the list, with the re...
SVGTextContentElement - Web APIs
hor="middle" alignment-baseline="middle">SVGTextContentElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constants Constant Value Description LENGTHADJUST_UNKNOWN 0 Some other value. LENGTHADJUST_SPACING 1 The spacing keyword. LENGTHADJUST_SPACINGANDGLYPHS 2 The spacingAndGlyphs keyword. Properties This interface also inherits properties from its parent, SVGGraphicsElement. SVGTextContentElement.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...
...resenting the computed length for the text within the element. SVGTextContentElement.getSubStringLength() Returns a float representing the computed length of the formatted text advance distance for a substring of text within the element. Note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the CSS 'letter-spacing' and 'word-spacing' properties. Visual spacing adjustments made by the 'x' attribute is ignored. SVGTextContentElement.getStartPositionOfChar() Returns a DOMPoint representing the position of a typographic character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextContentElement.getEndPositionOfChar() Returns a DOMPoint representing the trailing position of a typographic ch...
SVGTextPositioningElement - Web APIs
SVGTextPositioningElement.x Read only Returns an SVGAnimatedLengthList reflecting the x attribute of the given element. SVGTextPositioningElement.y Read only Returns an SVGAnimatedLengthList reflecting the y attribute of the given element. SVGTextPositioningElement.dx Read only Returns an SVGAnimatedLength...
... SVGTextPositioningElement.x Read only Returns an SVGAnimatedLengthList reflecting the x attribute of the given element. SVGTextPositioningElement.y Read only Returns an SVGAnimatedLengthList reflecting the y attribute of the given element. SVGTextPositioningElement.dx Read only Returns an SVGAnimatedLengthList reflecting the dx attribute of the g...
SVGTransform - Web APIs
esult in an exception being thrown. ...
... 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 ...
SVGTransformList - Web APIs
length unsigned long The number of items in the list. Methods Name & Argument...
... long index) SVGTransform removeItem(in unsigned long index) SVGTransform appendItem(in SVGTransform newItem) SVGTransform createSVGTransformFromMatrix(in SVGMatrix) SVGTransform consolidate() Properties readonly unsigned long numberOfItems readonly unsigned long length Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItems unsigned long The number of items in the list. length unsigned long The number of items in the list. Methods Name & Arguments Return Description clear() void Clears all existing current items from the list, with the result being an empty list. Exceptions: ...
Screen - Web APIs
Web › API › Screen
Screen.availLeft Returns the first available pixel available from the left side of the screen. ...
...et.addEventListener() Registers an event handler of a specific event type on the EventTarget. EventTarget.removeEventListener() Removes an event listener from the EventTarget. EventTarget.dispatchEvent() Dispatches an event to this EventTarget. Additional methods in Mozilla chrome codebase Mozilla includes a couple of extensions for use by JS-implemented event targets to implement onevent properties. See also WebIDL bindings. void setEventHandler(DOMString type, EventHandler handler) EventHandler getEventHandler(DOMString type) Example if (screen.pixelDepth < 8) { // use low-color version of page } else { // use regular, colorful page } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen' in t...
Using the Screen Capture API - Web APIs
ple the cursor will always be visible in the capture, and the audio track should ideally have noise suppression and echo cancellation features enabled, as well as an ideal audio sample rate of 44.1kHz. Capturing audio is always optional, and even when web content requests a stream with both audio and video, the returned MediaStream may still have only one video track, with no audio. Note: Some properties are not widely implemented and might not be used by the engine. cursor, for example, has limited support. Using the captured stream The promise returned by getDisplayMedia() resolves to a MediaStream that contains at least one video stream that contains the screen or screen area, and which is adjusted or filtered based upon the constraints specifed when getDisplayMedia() was called. Security ...
...een contents will be streamed, a box into which logged output will be drawn, and the start and stop buttons that will turn on and off capture of screen imagery. The object displayMediaOptions contains the MediaStreamConstraints to pass into getDisplayMedia(); here, the cursor property is set to always, indicating that the mouse cursor should always be included in the captured media. Note: Some properties are not widely implemented and might not be used by the engine. cursor, for example, has limited support. Finally, event listeners are established to detect user clicks on the start and stop buttons. const videoElem = document.getElementById("video"); const logElem = document.getElementById("log"); const startElem = document.getElementById("start"); const stopElem = document.getElementById("st...
ScrollToOptions - Web APIs
A ScrollToOptions dictionary can be provided as a parameter for the following methods: Window.scroll() Window.scrollBy() Window.scrollTo() Element.scroll() Element.scrollBy() Element.scrollTo() Properties ScrollToOptions.top Specifies the number of pixels along the Y axis to scroll the window or element. ScrollToOptions.left Specifies the number of pixels along the X axis to scroll the window or element. ScrollToOptions.behavior Specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. ...
...dow or element. ScrollToOptions.behavior Specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. This is actually defined on the ScrollOptions dictionary, which is implemented by ScrollToOptions. Examples In our scrolltooptions example (see it live) we include a form that allows the user to enter three values -- two numbers representing the left and top properties (i.e. the positions to scroll to along the X and Y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. When the form is submitted, an event handler is run that puts the entered values into a ScrollToOptions dictionary, and then invokes the Window.ScrollTo() method, passing the dictionary as a parameter: form.addEventListener('submit', (e) => { e.preventDefault(...
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
eventInitDict Optional A dictionary object containing information about the properties of the SecurityPolicyViolationEvent to be constructed. ...
... The SecurityPolicyViolationEvent constructor creates a new SecurityPolicyViolationEvent object instance. Syntax let SPVEvt = new SecurityPolicyViolationEvent(type, eventInitDict); Properties type A DOMString representing the type of security policy violation that occurred. eventInitDict 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 defaul...
Sensor - Web APIs
Web › API › Sensor
If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Interfaces based on Sensor Below is a list of interfaces based on the Sensor interface. ...
... 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. Interfaces based on Sensor Below is a list of interfaces based on the Sensor interface. Accelerometer AmbientLightSensor Gyroscope LinearAccelerationSensor Magnetometer OrientationSensor Properties Sensor.activated Read only Returns a Boolean indicating whether the sensor is active. Sensor.hasReading Read only Returns a Boolean indicating whether the sensor has a reading. Sensor.timestamp Read only Returns the time stamp of the latest sensor reading. Event handlers Sensor.onerror Called when an error occurs on one of the child interfaces of the Sensor interface. Sensor.onr...
Sensor APIs - Web APIs
ure context Provides the acceleration applied to the device along all three axes, but without the contribution of gravity. MagnetometerSecure context Provides information about the magnetic field as detected by the device's primary magnetometer sensor. OrientationSensorSecure context The base class for the AbsoluteOrientationSensor. ...
... SensorErrorEventSecure context Provides information about errors thrown by a Sensor or related interface. Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Initial definition. ...
ServiceWorkerGlobalScope - Web APIs
y restarted to respond to events, such as ServiceWorkerGlobalScope.onfetch or ServiceWorkerGlobalScope.onmessage. Additionally, synchronous requests are not allowed from within a service worker -- only asynchronous requests, like those initiated via the fetch() method, can be used. This interface inherits from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements properties from WindowTimers, WindowBase64, and WindowEventHandlers. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 12.142857142857142%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 85" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event...
... ServiceWorkerGlobalScope.registration Read only Contains the ServiceWorkerRegistration object that represents the service worker's registration. ServiceWorkerGlobalScope.caches Read only Contains the CacheStorage object associated with the service worker. Events activate Occ...
ServiceWorkerRegistration - Web APIs
service worker to control one or more pages that share the same origin. The lifetime of a service worker registration is beyond that of the ServiceWorkerRegistration objects that represent them within the lifetime of their corresponding service worker clients. The browser maintains a persistent list of active ServiceWorkerRegistration objects. Note: This feature is available in Web Workers. Properties Also implements properties from its parent interface, EventTarget. ServiceWorkerRegistration.scope Read only Returns a unique identifier for a service worker registration. This must be on the same origin as the document that registers the ServiceWorker. ServiceWorkerRegistration.installing Read only Returns a service worker whose state is installing. This is initially set to null. Servi...
...ding subscribing, getting an active subscription, and accessing push permission status. ServiceWorkerRegistration.sync Read only Returns a reference to the SyncManager interface, which manages background synchronization processes. ServiceWorkerRegistration.index Read only Returns a reference to the ContentIndex interface, for managing indexed content for offline viewing. Unimplemented properties serviceWorkerRegistration.periodicSync Read only Returns a reference to the PeriodicSyncManager interface, which manages periodic background synchronization processes. This was mentioned as an idea in the SW explainer at some point, but as yet has not been implemented anywhere. Event handlers ServiceWorkerRegistration.onupdatefound Read only An EventListener property called whenever...
ShadowRoot - Web APIs
The ShadowRoot interface of the Shadow DOM API is the root node of a DOM subtree that is rendered separately from a document's main DOM tree. You can retrieve a reference to an element's shadow root using its Element.shadowRoot property, provided it was created using Element.attachShadow() with the mode option set to open. Properties ShadowRoot.delegatesFocus Read only Returns a boolean that indicates whether delegatesFocus was set when the shadow was attached (see Element.attachShadow()). ShadowRoot.host Read only Returns a reference to the DOM element the ShadowRoot is attached to. ShadowRoot.innerHTML Sets or returns a reference to the DOM tree inside the ShadowRoot. ShadowRoot.mode Read only The mode of the ShadowRoot -- either open or closed. This defines whether or not the ...
...see Element.attachShadow()). ShadowRoot.host Read only Returns a reference to the DOM element the ShadowRoot is attached to. ShadowRoot.innerHTML Sets or returns a reference to the DOM tree inside the ShadowRoot. ShadowRoot.mode Read only The mode of the ShadowRoot -- either open or closed. This defines whether or not the shadow root's internal features are accessible from JavaScript. Properties included from DocumentOrShadowRoot The ShadowRoot interface includes the following properties defined on the DocumentOrShadowRoot mixin. Note that this is currently only implemented by Chrome; other browsers still implement them on the Document interface. DocumentOrShadowRoot.activeElement Read only Returns the Element within the shadow tree that has focus. DocumentOrShadowRoot.styleSheets...
SpeechRecognitionError - Web APIs
SpeechRecognitionError.error Read only Returns the type of error raised. ...
... SpeechRecognitionError.error Read only Returns the type of error raised. ...
SpeechRecognitionEvent - Web APIs
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.emma Read only Returns an Extensible MultiModal Annotation markup language (EMMA) -- XML -- representation of the result. ...
SpeechSynthesis - Web APIs
SpeechSynthesis.paused Read only A Boolean that returns true if the SpeechSynthesis object is in a paused state. ...
... SpeechSynthesis.paused Read only A Boolean that returns true if the SpeechSynthesis object is in a paused state. ...
SpeechSynthesisErrorEvent - Web APIs
SpeechSynthesisErrorEvent.error Read only Returns an error code indicating what has gone wrong with a speech synthesis attempt. Methods SpeechSynthesisErrorEvent extends the SpeechSynthesisEvent interface, which inherits methods from its parent interface, Event. ...
... SpeechSynthesisErrorEvent.error Read only Returns an error code indicating what has gone wrong with a speech synthesis attempt. ...
SpeechSynthesisEvent - Web APIs
SpeechSynthesisEvent.charIndex Read only Returns the index position of the character in the SpeechSynthesisUtterance.text that was being spoken when the event was triggered. ...
... SpeechSynthesisEvent.charIndex Read only Returns the index position of the character in the SpeechSynthesisUtterance.text that was being spoken when the event was triggered. ...
StaticRange.StaticRange() - Web APIs
startOffset The offset into the starting node at which the first character of the range is found. ...
... 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. ...
StaticRange - Web APIs
AbstractRange and StaticRange are not available from web workers. ...
...h="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">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. StaticRange.endContainer Read only Returns the DOM Node which contains the ending point of the range. The offset into the node at which the en...
StylePropertyMap - Web APIs
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 p...
... 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. StyleProper...
SyncEvent - Web APIs
Web › API › SyncEvent
SyncEvent.tag Read only Returns the developer-defined identifier for this SyncEvent. SyncEvent.lastChance Read only Returns true if the user agent will not make further synchronization attempts after the current attempt. Methods Inherits methods from its parent, ExtendableEvent. None. ...
... SyncEvent.tag Read only Returns the developer-defined identifier for this SyncEvent. SyncEvent.lastChance Read only Returns true if the user agent will not make further synchronization attempts after the current attempt. Methods Inherits methods from its parent, ExtendableEvent. None. ...
Touch events - Web APIs
uch 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 scans through the ongoingTouches array to find the touch matching the given identifier then returns that touch's index into the array. function ongoingTouchIndexById(idToFind) ...
... Recommendation Initial definition. ...
TransitionEvent - Web APIs
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. ...
...ansitioncancel An Event fired when a CSS transition has been cancelled. transitionend An Event fired when a CSS transition has finished playing. transitionrun An Event fired when a CSS transition is created, when it is added to a set of running transitions, though not nessarilty started transitionstart An Event fired when a CSS transition has started transitioning. Methods Also inherits properties from its parent Event. TransitionEvent.initTransitionEvent() Initializes a TransitionEvent created using the deprecated Document.createEvent("TransitionEvent") method. Specifications Specification Status Comment CSS TransitionsThe definition of 'TransitionEvent' in that specification. Working Draft Initial definition. ...
UIEvent.layerX - Web APIs
Web › API › UIEvent › layerX
ay the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>This is an un-positioned div so clicking it will return layerX/layerY values almost the same as pageX/PageY values.</span> </div> <div id="d2"> <span>This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. ...
...rX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> <span>Make the page scroll more! This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> Parent Element id: <input type="text" name="parentId" size="7" /><br /> pageX:<input type="text" name="pageXCoords" size="7" /> pageY:<input type="text" name="pageYCoords" size="7" /><br /> layerX:<input type="text" name="layerXCoords" size="7" /> l...
UIEvent.layerY - Web APIs
Web › API › UIEvent › layerY
ay the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>This is an un-positioned div so clicking it will return layerX/layerY values almost the same as pageX/PageY values.</span> </div> <div id="d2"> <span>This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. ...
...rX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> <span>Make the page scroll more! This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> Parent Element id: <input type="text" name="parentId" size="7" /><br /> pageX:<input type="text" name="pageXCoords" size="7" /> pageY:<input type="text" name="pageYCoords" size="7" /><br /> layerX:<input type="text" name="layerXCoords" size="7" /> l...
UIEvent.pageY - Web APIs
Web › API › UIEvent › pageY
lay the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>This is an un-positioned div so clicking it will return layerX/layerY values almost the same as pageX/PageY values.</span> </div> <div id="d2"> <span>This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. ...
...rX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> <span>Make the page scroll more! This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords"> Parent Element id: <input type="text" name="parentId" size="7" /><br /> pageX:<input type="text" name="pageXCoords" size="7" /> pageY:<input type="text" name="pageYCoords" size="7" /><br /> layerX:<input type="text" name="layerXCoords" size="7" /> layerY:<input...
USBDevice.deviceClass - Web APIs
Syntax var number = USBDevice.deviceClass Value A number. ...
... Syntax var number = USBDevice.deviceClass Value A number. ...
USBDevice.deviceClass - Web APIs
Syntax var number = USBDevice.deviceClass Value A number. ...
... Syntax var number = USBDevice.deviceClass Value A number. ...
USBDevice.deviceProtocol - Web APIs
Syntax var number = USBDevice.deviceProtocol Value A number. ...
... Syntax var number = USBDevice.deviceProtocol Value A number. ...
USBDevice.deviceSubclass - Web APIs
Syntax var serialNumber = USBDevice.deviceSubclass Value A number. ...
... Syntax var serialNumber = USBDevice.deviceSubclass Value A number. ...
ValidityState - Web APIs
badInput Read only A Boolean that is true if the user has provided input that the browser is unable to convert. ...
... The ValidityState interface 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. customError Read only A Boolean indicating whether the element's custom validity message has been set to a non-empty string by calling the element's setCustomValidity() method. patternMismatch Read only A Boolean that is true if th...
VideoPlaybackQuality - Web APIs
creationTime Read only A DOMHighResTimeStamp containing the time in miliseconds between the start of the navigation and the creation of the object. droppedVideoFrames Read only An unsigned long giving the number of video frames dropped since the creation of the associated HTMLVideoElement. ...
...ime in miliseconds between the start of the navigation and the creation of the object. droppedVideoFrames Read only An unsigned long giving the number of video frames dropped since the creation of the associated HTMLVideoElement. totalVideoFrames Read only An unsigned long giving the number of video frames created and dropped since the creation of the associated HTMLVideoElement. Obsolete properties corruptedVideoFrames Read only An unsigned long giving the number of video frames corrupted since the creation of the associated HTMLVideoElement. A corrupted frame may be created or dropped. totalFrameDelay Read only A double containing the sum of the frame delay since the creation of the associated HTMLVideoElement. The frame delay is the difference between a frame's theoretical prese...
VisualViewport - Web APIs
The VisualViewport interface of the Visual Viewport API represents the visual viewport for a given window. For a page containing iframes, each iframe, as well as the containing page, will have a unique window object. Each window on a page will have a unique VisualViewport representing the properties associated with that window. You can get a window's visual viewport using Window.visualViewport. Note: Only the top-level window has a visual viewport that's distinct from the layout viewport. ...
...w's visual viewport using Window.visualViewport. Note: Only the top-level window has a visual viewport that's distinct from the layout viewport. Therefore, it's generally only the VisualViewport object of the top-level window that's useful. For an <iframe>, visual viewport metrics like VisualViewport.width always correspond to layout viewport metrics like document.documentElement.clientWidth. Properties VisualViewport also inherits properties from its parent, EventTarget. VisualViewport.offsetLeft Read only Returns the offset of the left edge of the visual viewport from the left edge of the layout viewport in CSS pixels. VisualViewport.offsetTop Read only Returns the offset of the top edge of the visual viewport from the top edge of the layout viewport in CSS pixels. VisualViewport.pag...
WaveShaperNode - Web APIs
a warm feeling to the signal. A WaveShaperNode always has exactly one input and one output. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor WaveShaperNode() Creates a new instance of an WaveShaperNode object. Properties Inherits properties from its parent, AudioNode. WaveShaperNode.curve Is a Float32Array of numbers describing the distortion to apply. WaveShaperNode.oversample Is an enumerated 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 m...
...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-change-O-matic demo (see app.js for relevant code). Note: Sigmoid functions are commonly used for distortion curves because of their natural properties. Their S-shape, for instance, helps create a smoother sounding result. We found the below distortion curve code on Stack Overflow. var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var distortion = audioCtx.createWaveShaper(); ... function makeDistortionCurve(amount) { var k = typeof amount === 'number' ? amount : 50, n_samples = 44100, curve = new Float32Ar...
Taking still photos with WebRTC - Web APIs
, or the user denied access. Listen for the video to start playing After calling HTMLMediaElement.play() on the <video>, there's a (hopefully brief) period of time that elapses before the stream of video begins to flow. To avoid blocking until that happens, we add an event listener to video for the canplay event, which is delivered when the video playback actually begins. At that point, all the properties in the video object have been configured based on the stream's format. video.addEventListener('canplay', function(ev){ if (!streaming) { height = video.videoHeight / (video.videoWidth/width); video.setAttribute('width', width); video.setAttribute('height', height); canvas.setAttribute('width', width); canvas.setAttribute('height', height); ...
...ariable, which is false the first time this method is run. 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() on each of the two properties on each element, and setting widths and heights as appropriate. Finally, we set the streaming variable to true to prevent us from inadvertently running this setup code again. Handle clicks on the button To capture a still photo each time the user clicks the startbutton, we need to add an event listener to the button, to be called when the click event is issued: startbutton.addEventListener...
Web Video Text Tracks Format (WebVTT) - Web APIs
utoKeyword) position; attribute PositionAlignSetting positionAlign; attribute double size; attribute AlignSetting align; attribute DOMString text; DocumentFragment getCueAsHTML(); }; VTT Region interface This is the second interface in WebVTT API. The new keyword can be used for defining a new VTTRegion object which can then be used for containing the multiple cues. There are several properties of VTTRegion which are width, lines, regionAnchorX, RegionAnchorY, viewportAnchorX, viewportAnchorY and scroll that can be used to specify the look and feel of this VTT region. The interface code is given below which can be used to expose the WebVTT regions in DOM API: enum ScrollSetting { "" /* none */, "up" }; [Constructor] interface VTTRegion { attribute double width; attribute long lines...
...We can categorize them for better understanding relating to each interface in WebVTT: VTTCue The methods which are available in this interface are: GetCueAsHTML to get the HTML of that Cue. VTT Constructor for creating new objects of Cues...
Keyframe Formats - Web APIs
This is the canonical format returned by the getKeyframes() method. ...
...frame), and the browser will infer the other end of the animation if it is able to. For example, consider this simple animation -- the Keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; We have only specified the end state of the animation, and the beginning state is implied. Attributes Keyframes may specify property-value pairs for any of the animatable css properties. The property names are specified using camel-case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have no effect o...
Web Animations API - Web APIs
rowsers and developers 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 Repre...
...d is not itself accessed by developers. AnimationEvent Actually part of CSS Animations. DocumentTimeline Represents animation timelines, including the default document timeline (accessed using the Document.timeline property). EffectTiming Element.animate(), KeyframeEffectReadOnly.KeyframeEffectReadOnly(), and KeyframeEffect.KeyframeEffect() all accept an optional dictionary object of timing properties. Extensions to other interfaces The Web Animations API adds some new features to document and element. Extensions to the Document interface document.timeline The DocumentTimeline object representing the default document timeline. document.getAnimations() Returns an Array of Animation objects currently in effect on elements in the document. Extensions to the Element interface Eleme...
Using the Web Speech API - Web APIs
/h1> <p>Tap/click then say a color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> The CSS provides a very simple responsive styling so that it looks ok across devices. JavaScript Let's look at the JavaScript in a bit more detail. ...
...tance of this grammar in relation of other grammars available in the list (can be from 0 to 1 inclusive.) The added grammar is available in the list as a SpeechGrammar object instance. speechRecognitionList.addFromString(grammar, 1); We then add the SpeechGrammarList to the speech recognition instance by setting it to the value of the SpeechRecognition.grammars property. 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. Setting this is good practice, and therefore recommended. SpeechRecognition.interimResults: Defines whether the speech recognition s...
Using the Web Storage API - Web APIs
age 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 Window.sessionStorage and Window.localStorage properties (to be more precise, in supporting browsers the Window object implements the WindowLocalStorage and WindowSessionStorage objects, which the localStorage and sessionStorage properties are members of) -- invoking one of these will create an instance of the Storage object, through which data items can be set, retrieved, and removed. A different Storage object is used for the sessionStorage and local...
...('.my-new').textContent = e.newValue; document.querySelector('.my-url').textContent = e.url; document.querySelector('.my-storage').textContent = JSON.stringify(e.storageArea); }); Here we add an event listener to the window object that fires when the Storage object associated with the current origin is changed. As you can see above, the event object associated with this event has a number of properties containing useful information -- the key of the data that changed, the old value before the change, the new value after that change, the URL of the document that changed the storage, and the storage object itself (which we've stringified so you can see its content). Deleting data records Web Storage also provides a couple of simple methods to remove data. We don't use these in our demo, but the...
Web Storage API - Web APIs
okie (at most 5MB). localStorage does the same thing, but persists even when the browser is closed and reopened. Stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser cache / Locally Stored Data. Storage limit is the maximum amongst the three. These mechanisms are available via the Window.sessionStorage and Window.localStorage properties (to be more precise, in supporting browsers the Window object implements the WindowLocalStorage and WindowSessionStorage objects, which the localStorage and sessionStorage properties hang off) -- invoking one of these will create an instance of the Storage object, through which data items can be set, retrieved and removed. A different Storage object is used for the sessionStorage and localStorage...
... from version 43 onwards.) Note: Web Storage is not the same as mozStorage (Mozilla's XPCOM interfaces to SQLite) or the Session store API (an XPCOM storage utility for use by extensions). Web Storage interfaces Storage Allows you to set, retrieve and remove data for a specific domain and storage type (session or local.) Window The Web Storage API extends the Window object with two new properties -- Window.sessionStorage and Window.localStorage -- which provide access to the current domain's session and local Storage objects respectively, and a Window.onstorage event handler that fires when a storage area changes (e.g. a new item is stored.) StorageEvent The storage event is fired on a document's Window object when a storage area changes. Examples To illustrate some typical web stora...
Functions and classes available to Web Workers - Web APIs
In addition to the standard JavaScript set of functions (such as String, Array, Object, JSON, etc), there are a variety of functions available from the DOM to workers. This article provides a list of those. Workers run in another global context, DedicatedWorkerGlobalScope, different from the current window. ...
...JSON, etc), there are a variety of functions available from the DOM to workers. This article provides a list of those. Workers run in another global context, DedicatedWorkerGlobalScope, different from the current window. By default, methods and properties of Window are not available to them, but DedicatedWorkerGlobalScope, like Window, implements WindowTimers and WindowBase64. ...
Web Workers API - Web APIs
alScope object (in the case of dedicated workers - workers that are utilized by a single script), or a SharedWorkerGlobalScope (in the case of shared workers - workers that are shared between multiple scripts). You can run whatever code you like inside the worker thread, with some exceptions. For example, you can't directly manipulate the DOM from inside a worker, or use some default methods and properties of the window object. But you can use a large number of items available under window, including WebSockets, and data storage mechanisms like IndexedDB. See Functions and classes available to workers for more details. Data is sent between workers and the main thread via a system of messages -- both sides send their messages using the postMessage() method, and respond to messages via the onmessag...
...kers in extensions and have access to js-ctypes in your worker. See ChromeWorker for more details. Audio Workers provide the ability for direct scripted audio processing to be done inside a web worker context. Note: As per the Web workers Spec, worker error events should not bubble (see bug 1188141. This has been implemented in Firefox 42. Web Worker interfaces AbstractWorker Abstracts properties and methods common to all kind of workers (i.e. Worker or SharedWorker). Worker Represents a running worker thread, allowing you to pass messages to the running worker code. WorkerLocation Defines the absolute location of the script executed by the Worker. SharedWorker Represents a specific kind of worker that can be accessed from several browsing contexts, being several windows, iframes or...
WheelEvent - Web APIs
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-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 ...
..."371" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="421" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">WheelEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor WheelEvent() Creates a WheelEvent object. Properties This interface inherits properties from its ancestors, 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 Retu...
Window.getSelection() - Web APIs
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 in an error if it does not have that property or method and may return unexpected results if it does. To use a Selection object as a string, call its ...
...ion object. selectedText is a string (Selected text). Related objects You can call Document.getSelection(), which works identically to Window.getSelection(). It is worth noting that currently getSelection() doesn't work on the content of <textarea> and <input> elements in Firefox, Edge (Legacy) and Internet Explorer. HTMLInputElement.setSelectionRange() or the selectionStart and selectionEnd properties could be used to work around this. Notice also the difference between selection and focus. Document.activeElement returns the focused element. Specifications Specification Status Comment Selection APIThe definition of 'Window.getSelection()' in that specification. Working Draft New spec. ...
window.location - Web APIs
Web › API › Window › location
y property returns a Location object with information about the current location of the document. Though window.location is a read-only Location object, you can also assign a DOMString to it. This means that you 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 th...
...xample #2: Force reloading the current page from the server location.reload(true); Example #3 Consider the following example, 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 prop...
WindowEventHandlers - Web APIs
The WindowEventHandlers mixin describes the event handlers common to several interfaces like Window, or HTMLBodyElement and HTMLFrameSetElement. Each of these interfaces can implement additional specific event handlers. Note: WindowEventHandlers is a mixin and not an interface; you can't actually create an object of type WindowEventHandlers. Properties The events properties, of the form onXYZ, are defined on the WindowEventHandlers, and implemented by Window, and WorkerGlobalScope for Web Workers. WindowEventHandlers.onafterprint Is an EventHandler representing the code to be called when the afterprint event is raised. WindowEventHandlers.onbeforeprint Is an EventHandler representing the code to be called when the beforeprint event is raised. WindowEventHandlers.onbeforeunload Is an Ev...
... ...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
-1 : 1; if (oDmn.task.call(oDmn.owner, oDmn.INDEX, oDmn.length, oDmn.BACKW) === false || oDmn.isAtEnd()) { oDmn.pause(); return false; } r...
...s something like callback.call(thisObject, index, length, backwards). If the callback function returns a false value the daemon is paused. rate (optional) The time lapse (in number of milliseconds) between each invocation. The default value is 100. length (optional) The total number of invocations. It can be a positive integer or Infinity. The default value is Infinity. MiniDaemon instances properties myDaemon.owner The this object on which is executed the daemon (read/write). It can be an object or null. myDaemon.task The function that is repeatedly invoked (read/write). It is called with three arguments: index (the iterative index of each invocation), length (the number of total invocations assigned to the daemon - finite or Infinity) and backwards (a boolean expressing whether the ind...
WorkerNavigator - Web APIs
The WorkerNavigator interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling window.self.navigator. Properties The WorkerNavigator interface implements properties from the NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorDataStore, and NavigatorConcurrentHardware interfaces. WorkerNavigator.connectionRead only Provides a NetworkInformation object containing information about the network connection of a device. WorkerNavigator.locks Read only Returns a LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object. WorkerNavigator.permissions Read only Returns...
... methods for requesting a new Lock object and querying for an existing Lock object. WorkerNavigator.permissions Read only Returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API. Navigator.storageRead only 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. NavigatorID.appVersion Read only Returns the version of the browser as a string. Do not rely on this property to return the ...
Worklet - Web APIs
Web › API › Worklet
ht version of Web Workers and gives developers access to low-level parts of the rendering pipeline. With Worklets, you can run JavaScript and WebAssembly code to do graphics rendering or audio processing where high performance is required. Worklet types Worklets are restricted to specific use cases; they cannot be used for arbitrary computations like Web Workers. The Worklet interface abstracts properties and methods common to all kind of worklets, and cannot be created directly. Instead, you can use one of the following classes: Name Description Location Specification PaintWorklet For programmatically generating an image where a CSS property expects a file. Access this interface through CSS.paintWorklet. Chrome: Main thread Gecko: Paint thread ...
...and other high performance procedural animations. Compositor thread CSS Animation Worklet API LayoutWorklet For defining the positioning and dimensions of custom elements. CSS Layout API For 3D rendering with WebGL, you don't use Worklets. Instead, you write Vertex Shaders and Fragment Shaders using GLSL code, and those shaders will then run on the graphics card. Properties The Worklet interface does not define any properties. Methods Worklet.addModule() Adds the script module at the given URL to the current worklet. Specifications Specification Status Comment Worklets Level 1The definition of 'Worklet' in that specification. Working Draft ...
XMLDocument - Web APIs
The XMLDocument interface represents an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="...
... Methods Also inherits methods from: Document XMLDocument.load() Loads an XML document. Specifications Specification Status Comment DOMThe definition of 'XMLDocument' in that specification. Living Standard No changes. DOM4The definition of ...
Using XMLHttpRequest - Web APIs
ame.toUpperCase() === "INPUT" ? ...
...h > 0) { if (this.technique === 3) { /* enctype is multipart/form-data */ for (nFile = 0; nFile < oField.files.length; nFile++) { oFile = oField.files[nFile]; oSegmReq = new FileReader(); /* (custom properties:) */ oSegmReq.segmentIdx = this.segments.length; oSegmReq.owner = this; /* (end of custom properties) */ oSegmReq.onload = pushSegment; this.segments.push("Content-Disposition: form-data; name=\"" + oField.name + "\"; filename=\"" + oFile.name + "\"\r\nContent-Type: " + oFile.type + "\r\n\r\n"); this.status++; oSegmReq.readAsBinaryString(oFile); } } else { /* enctype is application/x-www-f...
XRInputSourceEventInit - Web APIs
It also offers the following: frame An XRFrame object representing the event frame during which the event took place. This event is not associated with the animation process, and has no viewer information contained within it. ...
...It also offers the following: frame An XRFrame object representing the event frame during which the event took place. This event is not associated with the animation process, and has no viewer information contained within it. ...
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 depthFar. Th...
...efault 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). 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 - Web APIs
Web › API › XRSession
The WebXR Device API's XRSession interface represents an ongoing XR session, providing methods and properties used to interact with and control the session. To open a WebXR session, use the XRSystem interface's requestSession() method. With XRSession methods, you can poll the viewer's position and orientation (the XRViewerPose), gather information about the user's environment, and present imagery to the user. XRSession supports both inline and immersive virtual and augmented reality modes. Properties In addition to the properties listed below, XRSession inherits properties from its parent interface, EventTarget. environmentBlendMode Read only Returns this session's blend mode which denotes how much of the real-world environment is visible through the XR device and how the dev...
... 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 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 hardw...
Using the group role - Accessibility
ARIA attributes used group Related ARIA techniques region role Compatibility TBD: Add support information for common UA and AT product combinations Addition...
... ARIA attributes used group Related ARIA techniques region role Compatibility TBD: Add support information for common UA and AT product combinations Additional resources ARIA Authoring Practices - Accessible Name G...
ARIA: cell role - Accessibility
riate. A cell can contain a number of property attributes clarifying the cell's position within the tabular data structure, including aria-colindex, aria-colspan, aria-rowindex, and aria-rowspan. Using the native HTML table element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties Context roles role="row" An element with role="row" is a row of cells within a tabular structure. A row contains one or more cells, grid cells, column headers, or row headers within a grid, table or treegrid, and optionally within a rowgroup. role="rowgroup" Row is a required cell parent. Rowgroup is an optional contextual row parent. It establishes a relationship between descendant rows.
...th> element with a column scope. Unlike a plain cell, the columnheader role establishes a relationship between it and all cells in the corresponding column. role="rowheader" A header cell that is the structural equivalent of the HTML <th> element with a row scope. Unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. States and properties aria-colspan Similar to the HTML <th> and <td> colspan attribute, it defines the number of columns spanned by the cell. aria-rowspan Similar to the HTML <th> and <td> rowspan attribute, it defines the number of rows spanned by the cell. aria-colindex attribute The aria-colindex attribute is only needed if columns are hidden from the DOM. The attribute takes as its value an integer betwe...
ARIA: figure role - Accessibility
igure> Generally, you should reference the figure from the main text, but the figure need not be displayed at the same location as the referencing element. Note: If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a figure and its caption -- <figure> 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 r...
... 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 initial example on the page to also identify a paragraph that provides a descriptive label for the figure by referencing its ID in aria-labelledby: <div role="figure" aria-labelledby="figure-1"> <img src="diagram.png" alt="diagram showing the four layers of awesome and their relative priority order -- music, cats, nature, and i...
ARIA: grid role - Accessibility
dget contains one or more rows with one or more cells of thematically related interactive content. While it does not imply a specific visual presentation, it implies a relationship among elements. Uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). Even though both data grids and layout grids employ the same ARIA roles, states, and properties, differences in their content and purpose surface factors that are important to consider in keyboard interaction design. See ARIA Authoring practices for more details Cell elements have the role gridcell, unless they are a row or column header. Then the elements are rowheader and columnheader, respectively. Cell elements need to be owned by elements with a row role. Rows can be grouped using row...
...ing practices for more details Cell elements have the role gridcell, unless they are a row or column header. Then the elements are rowheader and columnheader, respectively. Cell elements need to be owned by elements with a row role. Rows can be grouped using rowgroups. If the grid is used as an interactive widget, keyboard interactions need to be implemented. Associated ARIA roles, states, and properties Roles treegrid (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...
ARIA: gridcell role - Accessibility
s applied to focusable via the Tab key. If a gridcell is conditionally toggled into a state where editing is prohibited, toggle aria-readonly on the gridcell element. Expandable cells In a treegrid, gridcells may be made expandable by toggling the aria-expanded attribute. Note that if this attribute is provided, it applies only to the individual gridcell. Associated WAI-ARIA Roles, States, and Properties grid Communicates that a parent element is a a table or tree style grouping of information. row Required to communicate the gridcell is part of a row of a table-style grouping of information. columnheader Specifies which element is the associated column header. aria-colindex Identifies the position of an element in relation to the rest of the table-style grouping of inf...
...If at all possible, utilize native HTML table markup in their place. Best practices The first rule of ARIA is: if a native HTML element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding an ARIA role, state or property to make it accessible. As such, it is recommended to use the utilize nat...
ARIA: row role - Accessibility
left to right and top to botton navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead. Note: Using the native HTML table element (<table>) along with the table row element (<tr>) whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties Context roles role="rowgroup" An optional contextual row parent, it establishes a relationship between descendant rows. It is a structural equivalent to the thead, tfoot, and tbody elements in an HTML table element. role="table" One of the three possible contexts (along with grid and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table struct...
...th> element with a column scope. Unlike a plain cell, the columnheader role establishes a relationship between it and all cells in the corresponding column. role="rowheader" A header cell that is the structural equivalent of the HTML <th> element with a row scope. Unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. States and properties aria-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 c...
ARIA: switch role - Accessibility
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. 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-r...
... ARIA in HTML Working Draft Describes how ARIA's features integrate into HTML. ...
ARIA: textbox role - Accessibility
res. <label for="txtbox">Enter your five-digit zipcode</label> <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. 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 tex...
.... Instead of using aria-required, use the semantic <input type="text"> or <textarea> with a required attribute. Keyboard interactions In a single-line use (when aria-multiline is false or not used), the Return or Enter key submits the form. In a multi-line use (when aria-multiline is true), Return or Enter key inserts a line break. JavaScript features All features associated with any and all properties and states must be maintained, and forms submission on enter or return on a single line textbox needs to be handled. Focus event handler and aria-activedescendent attribute If you are implementing a composite widget, such as a combobox composed of a text box and a listbox, you need to manage the aria-activedescendent attribute using a handler. Before using this technique, ensure that the brow...
An overview of accessible web applications and widgets - Accessibility
rd HTML tags and the desktop-style controls found in dynamic web applications, ARIA provides roles and states that describe the behavior of most familiar UI widgets. Many of these were later added in HTML5, and developers should always prefer using the correct semantic HTML element over using ARIA. The ARIA specification is split up into three different types of attributes: roles, states, and properties. Roles describe widgets that aren't otherwise available in HTML 4, such as sliders, menu bars, tabs, and dialogs. Properties describe characteristics of these widgets, such as if they are draggable, have a required element, or have a popup associated with them. States describe the current interaction state of an element, informing the assistive technology if it is busy, disabled, selected, or hid...
...urrent state of a UI widget. Examples include (but are certainly not limited to): aria-checked: indicates the state of a checkbox or radio button aria-disabled: indicates that an element is visible, but not editable or otherwise operable aria-grabbed: indicates the 'grabbed' state of an object in a drag-and-drop operation (For a full list of ARIA states, consult the ARIA list of states 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 techni...
Mobile accessibility checklist - Accessibility
means too (underlined text for links, etc.) Visibility Content hiding techniques such as zero opacity, z-index order and off-screen placement MUST NOT be used exclusively to handle visibility. Everything other than the currently visible screen MUST be truly invisible (especially relevant for single page apps with multiple cards): USE the hidden attribute or visibility or display style properties. Unless absolutely unavoidable, aria-hidden attribute SHOULD NOT be used. Focus All activatable elements MUST be focusable: Standard controls such as links, buttons, and form fields are focusable by default. Non-standard controls MUST have an appropriate ARIA Role assigned to them, such as button, link, or checkbox. Focus should be handled in a logical order and consi...
... Focus should be handled in a logical order and consistent manner. Text Equivalents Text equivalent MUST be provided for every non-strictly presentational non-text element within the app. Use alt and title where appropriate (see Steve Faulkner's post about Using the HTML title attribute for a good guide.) If the above attributes are not applicable, use appropriate ARIA States and Properties such as aria-label, aria-labelledby, or aria-describedby. Images of text MUST be avoided. All user interface components with visible text (or image of text) as labels must have the same text available in the programmatic name of the component. WCAG 2.1: Label in name. All form controls MUST have labels (<label> elements) for the benefit of screen reader users. Handling State Standard...
-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. ...
...gin-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 padding but not the border or margin. Formal definition Initial valuecontent-boxApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax border-box | content-box | margin-box | padding-box Examples HTML <div class="box"> <p>Lorem ...
@page - CSS: Cascading Style Sheets
Web › CSS › @page
The @page CSS at-rule is used to modify some CSS properties when printing a document. Syntax @page { margin: 1cm; } @page :first { margin: 2cm; } Descriptors size Specifies the target size and orientation of the page box's containing block. In the general case, where one page box is rendered onto one page sheet, it also indicates the size of the destination page sheet. marks Adds crop and/or registration marks to the document. bleed Specifies the extent beyond the page box at which the page rendering is clipped. Description You can't change all CSS properties with @page. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored. The @page at-rule can be accessed via the CSS object model in...
...ottom-left | @bottom-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 '@pa...
height - CSS: Cascading Style Sheets
Web › CSS › @viewport › height
x; 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 percentage value is treated as 0...
...ent is not absolutely positioned, the percentage value is treated as 0.max-height: The percentage is calculated with respect to the height of the generated box's containing block. ...
Box alignment in Flexbox - CSS: Cascading Style Sheets
able space in its dimension. This is how centering a block with auto margins works. By setting the left and right margin to auto, both sides of our block try to take up all of the available space and so push the box into the center. By setting a margin of auto on one item in a set of flex items all aligned to start, we can create a split navigation. This works well with Flexbox and the alignment properties. As soon as there is no space available for the auto margin, the item behaves in the same way as all the other flex items and shrinks to try to fit into space. The gap properties row-gap column-gap gap Creating fixed size gaps between items On the main axis, the column-gap property will create fixed size gaps between adjacent items. On the cross axis the row-gap property will create s...
... shrinks to try to fit into space. The gap properties row-gap column-gap gap Creating fixed size gaps between items On the main axis, the column-gap property will create fixed size gaps between adjacent items. ...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
of Multi-column Layout. As this page aims to detail things which are specific to Multi-column Layout 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. In multi-column layout the alignment container is the content box of the multicol container. The alignment subject is the column box. The properties which apply to multi-column layouts are detailed below. Note: Multi-column Layout predates the Box Alignment specification. and the properties listed here, 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 ...
...p 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 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 ...
CSS Containment - CSS: Cascading Style Sheets
ly give it a size. Style containment article { contain: style; } Despite the name, style containment does not provide scoped styles such as you would get with the Shadow DOM. The main use case is to prevent situations where a CSS Counter could be changed in an element, which could then affect the rest of the tree. Using contain: style would ensure that the counter-increment and counter-set properties created new counters scoped to that subtree only. Note: style containment is "at-risk" in the spec and may not be supported everywhere (it's not currently supported in Firefox). Special values There are two special values of contain: content strict We encountered the first in the example above. Using contain: content turns on layout and paint containment. The specification describes th...
.... ...
CSS Display - CSS: Cascading Style Sheets
CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
... CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
oss axis, controlling the width in this way will achieve that. In most cases however, adding widths to flex items in this way demonstrates that you would probably be better served by switching to grid layout for that component. Creating gutters between items When wrapping flex items, the need to space them out is likely to arise. At the current time we do not have any implementations of the gap properties from the Box Alignment module for Flexbox. In the future we will be able to simply use row-gap and column-gap for flexbox as we do for CSS Grid. At the current time you will need to use margins to achieve this. You can see from the live example below that in order to create gaps that do not also create a gap at the edges of the container, we need to use negative margins on the flex container its...
...gins to achieve this. You can see from the live example below that in order to create gaps that do not also create a gap at the edges of the container, we need to use negative margins on the flex container itself. Any border on the flex container is then moved to a second wrapper in order that the negative margin can pull the items up to that wrapper element. It is this requirement that the gap properties, once implemented, will solve for us. Proper gaps only happen on the inside edges of items. Collapsed items The flexbox specification details what should happen if a flex item is collapsed by setting visibility: collapse on an item. See the MDN documentation for the visibility property. The specification describes the behaviour as follows: "Specifying visibility:collapse on a flex item caus...
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
rap-reverse Spec: https://drafts.csswg.org/css-flexbox/#flex-wrap-property @mixin flex-wrap($value: nowrap) { // No Webkit/FF Box fallback. -webkit-flex-wrap: $value; @if $value == nowrap { -ms-flex-wrap: none; } @else { -ms-flex-wrap: $value; } flex-wrap: $value; } Flexbox flow (shorthand) The flex-flow property is shorthand for setting the flex-direction and flex-wrap properties, which together define the flex container's main and cross axes. Values: row (default) | nowrap Spec: https://drafts.csswg.org/css-flexbox/#flex-flow-property @mixin flex-flow($values: (row nowrap)) { // No Webkit/FF Box fallback. -webkit-flex-flow: $values; -ms-flex-flow: $values; flex-flow: $values; } Flexbox order The order property controls the order in which flex items appe...
...he flex-basis. When an element is a flex item, flex is consulted instead of the main size property to determine the main size of the element. If an element is not a flex item, flex has no effect. Values: See the flex reference for values and default Spec: https://drafts.csswg.org/css-flexbox/#flex-property @mixin flex($fg: 1, $fs: 0, $fb: auto) { // Set a variable to be used by box-flex properties $fg-boxflex: $fg; // Box-Flex only supports a flex-grow value so lets grab the // first item in the list and just return that. @if type-of($fg) == 'list' { $fg-boxflex: nth($fg, 1); } -webkit-box: $fg-boxflex; -moz-box: $fg-boxflex; -webkit-flex: $fg $fs $fb; -ms-flex: $fg $fs $fb; flex: $fg $fs $fb; } Flexbox justify content The justify-content property aligns flex i...
Introduction to formatting contexts - CSS: Cascading Style Sheets
nts participating in a BFC use the rules outlined by the CSS Box Model, which defines how an element's margins, borders, and padding interact with other blocks in the same context. Creating a new block formatting context The <html> element is not the only element capable of creating a block formatting context. Any block-level element can be made to create a BFC by the application of certain CSS properties. ...
... be made to create a BFC by the application of certain CSS properties. ...
Variable fonts guide - CSS: Cascading Style Sheets
le: 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 the guide. Weight Weight (represented by the wght tag) defines the design axis of how thin or thick (light or heavy, in typical typographic terms) the strokes of the letterforms can be. For a long time in CSS there has existed the ability to specify t...
... calling the variable fonts inside a feature query block. h1 { font-family: some-non-variable-font-family; } @supports (font-variation-settings: 'wdth' 115) { h1 { font-family: some-variable-font-family; } } Sample pages The following example pages show two different ways to structure your CSS. The first uses the standard attributes wherever possible. The second example uses CSS Custom Properties to set values for a font-variation-settings string, and shows how you can more easily update single variable values by overriding a single variable rather than rewriting the whole string. Note the hover effect on the h2, which only alters the grade axis custom property value. Resources W3C CSS Fonts Module 4 Specification (editor's draft) W3C Github issue queue Microsoft Open Type Variati...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
dering will not change tab order. This means that someone navigating using the keyboard could be tabbing through links on your site and suddenly find themselves jumping from the top to the bottom of the document due to a reordered item being next in line. The specification warns authors (the CSSWG term for web developers) not to do this reordering. Authors must use order and the grid-placement properties only for visual, not logical, reordering of content. Style sheets that use these features to perform logical reordering are non-conforming. What does this mean for designing with grid layout in practice? Visual not logical re-ordering Any time you reorder things with grid layout - or with flexbox - you only perform visual reordering. The underlying source is what controls things like text to ...
...not logical re-ordering Any time you reorder things with grid layout - or with flexbox - you only perform visual reordering. The underlying source is what controls things like text to speech, and the tab order of the document. You can see how this works with a very simple example. In this example I have used grid to lay out a set of boxes that contain links. I have used the line-based placement properties to position box 1 on the second row of the grid. Visually it now appears as the fourth item in the list. However, if I tab from link to link the tab order still begins with box 1, as it comes first in the source. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; bo...
Layout using named grid lines - CSS: Cascading Style Sheets
Line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes. Once you work through some examples it should become clearer and easier to work with. Naming lines when defining a grid You can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows and grid-template-columns properties. To demonstrate I'll use the simple layout created in the guide on line-based placement. This time I'll create the grid using named lines. * {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; } ...
... ...
CSS Lists - CSS: Cascading Style Sheets
Using CSS Counters Explains how to use the CSS counter properties to control list counters. ...
... CSS Lists is a module of CSS that defines how lists can be laid out and styled. Reference Properties list-style-image list-style-type list-style-position list-style Guides Consistent list indentation Explains how to achieve consistent list indentation across different browsers. Using CSS Counters Explains how to use the CSS counter properties to control list counters. Specifications Specification Status Comment CSS Lists Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation Initial definition ...
CSS Overflow - CSS: Cascading Style Sheets
verflow of painting effects which do not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, 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://gi...
...mple 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 overflow-y text-overflow block-overflow line-clamp max-lines continue Non-standard properties -webkit-line-clamp Specifications Specification Status Comment CSS Overflow Module Level 3The definition of 'overflow' in that specification. Working Draft Changed syntax to allow o...
Stacking context example 1 - CSS: Cascading Style Sheets
The only stacking context is the root context. Without z-indexes, elements are stacked in order of occurrence. ...
... The only stacking context is the root context. Without z-indexes, elements are stacked in order of occurrence. ...
The stacking context - CSS: Cascading Style Sheets
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. 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 ch...
...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-scrolling value touch. Element with a will-change value specifying any property that would create a stacking context on non-initial value (see this post). Element with a contain value of layout, or pai...
CSS Scroll Snap - CSS: Cascading Style Sheets
CSS Scroll Snap is a module of CSS that introduces scroll snap positions, which enforce the scroll positions that a scroll container's scrollport may end at after a scrolling operation has completed. Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
...precated. CSS Scroll Snap is the current implementation. ...
CSS Scrollbars - CSS: Cascading Style Sheets
Basic Example In this example we have chosen to use a thin scrollbar, with a green track and purple thumb. .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple green; 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 endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini. ...
...HTML <div class="scroller"> Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini. </div> Result Reference CSS Properties scrollbar-width scrollbar-color Specifications Specification Status Comment CSS Scrollbars Level 1 Working Draft Initial definition. Accessibility concerns When you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input. Baseline Rules for Scrollbar Usability | Adrian Ros...
Overview of CSS Shapes - CSS: Cascading Style Sheets
ext to wrap round the right and bottom of the item in a rectangular fashion. If you then apply a circle shape, the text would then wrap round the line of the circle. There are a number of ways to create these Shapes and in these guides we will find out how CSS Shapes work, and consider some ways you might like to use them. What does the specification define? The specification defines three new properties: shape-outside -- allows definition of basic shapes shape-image-threshold -- Sets an opacity threshold value. If an image is being used to define the shape, only the 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-outsi...
... pref. Future CSS Shapes Features The initial Shapes specification included a property shape-inside for creating shapes inside an element. This property, along with the possibility of creating shapes on non-floated elements, has been moved to level 2 of the specification. As the shape-inside property was initially in Level 1 of the specification, you may find tutorials on the web detailing both properties. ...
Using CSS transforms - CSS: Cascading Style Sheets
By modifying the coordinate space, CSS transforms change the shape and position of the affected content without disrupting the normal document flow. This guide provides an introduction to using transforms. CSS transforms are implemented using a set of CSS properties that let you apply affine linear transformations to HTML elements. These transformations include rotation, skewing, scaling, and translation both in the plane and in the 3D space. Only elements positioned by the box model can be transformed. As a rule of thumb, an element is positioned by the box model if it has display: block. CSS transforms properties Two major properties are used to define CSS transforms: transform and transform-origin transform-origin Specifies the position of the origin. By default, it is at the center o...
...sform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> Skewing and translating Here is the MDN logo, skewed by 10 degrees and translated by 150 pixels on the X-axis. <img style="transform: skewx(10deg) translatex(150px); transform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> 3D specific CSS properties Performing CSS transformations in 3D space is a bit more complex. You have to start by configuring the 3D space by giving it a perspective, then you have to configure how your 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. Set...
Class selectors - CSS: Cascading Style Sheets
ed on the contents of their class attribute. ...
...2em; } /* All <li> elements with class="spacious" */ li.spacious { margin: 2em; } /* All <li> elements with a class list that includes both "spacious" and "elegant" */ /* For example, class="elegant retro spacious" */ li.spacious.elegant { margin: 2em; } Syntax .class_name { style properties } Note that this is equivalent to the following attribute selector: [class~=class_name] { style properties } Examples CSS .red { color: #f33; } .yellow-bg { background: #ffa; } .fancy { font-weight: bold; text-shadow: 4px 4px 3px #77f; } HTML <p class="red">This paragraph has red text.</p> <p class="red yellow-bg">This paragraph has red text and a yellow background.</p> <p class="red fancy">This paragraph has red text and "fancy" styling.</p> <p>This is just a regular paragraph.</p> ...
Center an element - CSS: Cascading Style Sheets
In this recipe you will see how to center one box inside another. Centering both horizontally and vertically was difficult before flexbox, with the Box Alignment properties it is now straightforward. Requirements To place an item into the center of another box horizontally and vertically. Recipe Download this example Choices made To center one box inside another we make the containing box a flex container. Then set align-items to center to perform centering on the block axis, and justify-content to center to perform centering on the inline axis. In the future we may be able to center elements without needing to turn the parent into a flex container, as the Box Alignment properties used here are specified to apply to block layout too. However, support is currently limited for box alignm...
...ntainer. Then set align-items to center to perform centering on the block axis, and justify-content to center to perform centering on the inline axis. In the future we may be able to center elements without needing to turn the parent into a flex container, as the Box Alignment properties used here are specified to apply to block layout too. However, support is currently limited for box alignment properties on block layout, so currently centering using Flexbox is the most robust way to achieve this. ...
Testing media queries programmatically - CSS: Cascading Style Sheets
Once you've created a MediaQueryList object, you can check the result of the query or receive notifications when the result changes. Creating a media query list Before you can evaluate the results of a media query, you need to create the MediaQueryList object representing the query. To do this, use the window.matchMedia method. ...
... the parameter as evt -- an event object. This makes sense because newer implementations of MediaQueryList handle event listeners in a standard way. They no longer use the unusual MediaQueryListListener mechanism, but a standard event listener setup, passing an event object of type MediaQueryListEvent as the argument to the callback function. This event object also includes the media and matches properties, so you can query these features of the MediaQueryList by directly accessing it, or accessing the event object. Ending query notifications To stop receiving notifications about changes to the value of your media query, call removeListener() on the MediaQueryList, passing it the name of the previously-defined callback function: mediaQueryList.removeListener(handleOrientationChange); ...
Paged media - CSS: Cascading Style Sheets
Paged media properties control the presentation of content for print or any other media that splits content into discrete pages. It allows you to set page breaks, control printable area, style left and right pages differently, and control breaks inside elements. ...
... Paged media properties control the presentation of content for print or any other media that splits content into discrete pages. It allows you to set page breaks, control printable area, style left and right pages differently, and control breaks inside elements. ...
Replaced elements - CSS: Cascading Style Sheets
se contents are not affected by the current document's styles. The position of the replaced element can be affected using CSS, but not the contents of the replaced element itself. Some replaced elements, such as <iframe> elements, may have stylesheets of their own, but they don't inherit the styles of the parent document. The only other impact CSS can have on a replaced element is that there are properties which support controlling the positioning of the element's content within its box. See Controlling object position within the content box for further information. Replaced elements Typical replaced elements are: <iframe> <video> <embed> <img> Some elements are treated as replaced elements only in specific cases: <option> <audio> <canvas> <object> <applet> HTML spec also says th...
...d 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 the element's box area. These are defined by the CSS Images Module Level 3 and CSS Images Module Level 4 specifications: object-fit ...
Syntax - CSS: Cascading Style Sheets
Web › CSS › Syntax
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. Both properties and values are case-insensitive by default in CSS. The pair is separated by a colon, ':' (U+003A COLON), and white spaces befo...
...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. There are more than 100 different properties in CSS and a nearly infinite number of different values. Not all pairs of properties and values are allowed and each property defines what are the valid values. When a value is not valid for a given property, the declaration is deemed invalid and is wholly ignored by the CSS engine. CSS declarati...
animation-fill-mode - CSS: Cascading Style Sheets
y sets how a CSS animation applies styles to its target before and after its execution. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often convenient to use the shorthand property animation to set all animation properties at once. Syntax /* Single animation */ animation-fill-mode: 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 displaye...
... this during the animation-delay period. The first relevant keyframe depends on the value of animation-direction: animation-direction first relevant keyframe normal or alternate 0% or from reverse or alternate-reverse 100% or to both The animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions. 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-e...
animation-timing-function - CSS: Cascading Style Sheets
ction CSS property sets how an animation 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. Syntax /* Keyword values */ animation-timing-function: ease; animation-timing-function: ease-in; animation-timing-function: ease-out; animation-timing-function: ease-in-out; animation-timing-function: linear; animation-timing-function: step-start; animation-timing-function: step-end; /* Function values */ animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1); animation-timing-fu...
...ic-bezier(0.0, 0.0, 1.0, 1.0), animates at an even speed. ease-in Equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the speed of the transition of the animating properting increasing until complete. ease-out Equal to cubic-bezier(0, 0, 0.58, 1.0), starts quickly, slowing down the animation continues. o ease-in-out Equal to cubic-bezier(0.42, 0, 0.58, 1.0), with the animating properties slowly transitioning, speeding up, and then slowing down again. cubic-bezier(p1, p2, p3, p4) An author defined cubic-bezier curve, where the p1 and p3 values must be in the range of 0 to 1. steps(n, <jumpterm>) Displays an animation iteration along n stops along the transition, displaying each stop for equal lengths of time. For example, if n is 5, there are 5 steps. Whether the animation hol...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
Note that Firefox and Edge also support -webkit-appearance, for compatibility reasons. The source for this interactive example is stored in a GitHub repository. ...
... Value Demo Browser Description attachment div{ color: black; -moz-appearance: attachment; -webkit-appearance: attachment; } <div>Lorem</div> Safari borderless-attachment div{ color: black; -moz-appearance: borderless-attachment; -webkit-appearance: borderless-attac...
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
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. ...
...()' in that specification. Editor's Draft Changed it to work like var(). Property values involving attr() are valid at parse time, and the validation of the attribute value is deferred to computed value time. CSS Values and Units Module Level 3The definition of 'attr()' in that specification. Candidate Recommendation Added two optional parameters; can be used on all properties; may return values other than <string>. These changes are experimental and may be dropped during the CR phase if browser support is too small. CSS Level 2 (Revision 1)The definition of 'attr()' in that specification. Recommendation Limited to the content property; always returns a <string>. ...
background-position-x - CSS: Cascading Style Sheets
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 value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. Syntax /* Keyword values */ background-position-x: left; background-position-x: center; background-position-x: right; /* <percentage> values */ background-position-x: 25%; /* <length> values */ background-position-x: 0px; background-position-x: 1cm; background-position-x: 8em; /* Side-relative values */ background-position-x: right 3px; background-position-x:...
...4892b7e820122ac6dd7678891d4507/firefox.png); background-repeat: no-repeat; background-position-x: center; background-position-y: bottom 10px; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 4The definition of 'background-position-x' in that specification. Editor's Draft Initial specification of longhand sub-properties of background-position to match longstanding implementations. 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 An...
background-position-y - CSS: Cascading Style Sheets
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 value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. Syntax /* Keyword values */ background-position-y: top; background-position-y: center; background-position-y: bottom; /* <percentage> values */ background-position-y: 25%; /* <length> values */ background-position-y: 0px; background-position-y: 1cm; background-position-y: 8em; /* Side-relative values */ background-position-y: bottom 3px; background-position-y...
...4892b7e820122ac6dd7678891d4507/firefox.png); background-repeat: no-repeat; background-position-x: center; background-position-y: bottom 10px; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 4The definition of 'background-position-y' in that specification. Editor's Draft Initial specification of longhand sub-properties of background-position to match longstanding implementations. 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 An...
block-size - CSS: Cascading Style Sheets
t relates to the height of the element. A related property is inline-size, which defines the other dimension of the element. Initial valueautoApplies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Syntax Values The block-size property takes the same values as the width and height properties. Formal definition Initial valueautoApplies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Formal syntax <'width'> Examples Block size with vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow...
... Editor's Draft Initial definition ...
border-block-end-color - CSS: Cascading Style Sheets
perty 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, and border-inline-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertica...
... Editor's Draft Initial definition ...
border-block-end-style - CSS: Cascading Style Sheets
tion, 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. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border w...
... Editor's Draft Initial definition ...
border-block-end-width - CSS: Cascading Style Sheets
lues 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. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenA...
... Editor's Draft Initial definition ...
border-block-start-color - CSS: Cascading Style Sheets
rty 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-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> See border-color Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertical text HTML <div> ...
... Editor's Draft Initial definition ...
border-block-start-style - CSS: Cascading Style Sheets
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. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border wti...
... Editor's Draft Initial definition ...
border-block-start-width - CSS: Cascading Style Sheets
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. 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. See border-width. ...
... Editor's Draft Initial definition ...
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 valueno...
... Editor's Draft Initial definition ...
border-bottom-width - CSS: Cascading Style Sheets
...
... ...
border-image-slice - CSS: Cascading Style Sheets
a single time to form the corners of the final border image. Zones 5-8 are edge regions. These are repeated, scaled, or otherwise modified in the final border image to match the dimensions of the element. Zone 9 is the middle region. It is discarded by default, but is used like a background image if the keyword fill is set. The border-image-repeat, border-image-width, and border-image-outset 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 */ bord...
...lows: The diamonds are 30px across, therefore setting 30 pixels as the value for both border-width and border-image-slice will get you complete and fairly crisp diamonds in your border: border-width: 30px; border-image-slice: 30; These are the default values we have used in this example. However, we have also provided two sliders to allow you to dynamically change the values of the above two properties, allowing you to appreciate the effect they have: border-image-slice Changes the size of the image slice sampled for use in each border and border corner (and the content area, if the fill keyword is used) -- varying this away from 30 causes the border to look somewhat irregular, but can have some interesting effects. border-width: Changes the width of the border. The sampled image size is scal...
border-inline-end-color - CSS: Cascading Style Sheets
ending 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, and border-inline-start-color, which define the other border colors of the element. Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuec...
... Editor's Draft Initial definition ...
border-inline-end-style - CSS: Cascading Style Sheets
n, 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. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples HTML <div> <p...
... Editor's Draft Initial definition ...
border-inline-end-width - CSS: Cascading Style Sheets
es 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. 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. See border-width.
... Editor's Draft Initial definition ...
border-inline-start-color - CSS: Cascading Style Sheets
ty 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-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples HTML <div> <p class="exam...
... Editor's Draft Initial definition ...
border-inline-start-style - CSS: Cascading Style Sheets
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. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valuea...
... Editor's Draft Initial definition ...
border-inline-start-width - CSS: Cascading Style Sheets
efined 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. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnim...
... Editor's Draft Initial definition ...
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. /* <'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. Formal definition Initial valuenoneApplie...
... Editor's Draft Initial definition ...
border-left-style - CSS: Cascading Style Sheets
...
... ...
border-right-style - CSS: Cascading Style Sheets
...
... ...
box-sizing - CSS: Cascading Style Sheets
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. ...
...Note that padding and border will be inside of the box. For example, .box {width: 350px; border: 10px solid 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. ...
break-inside - CSS: Cascading Style Sheets
nside a generated box. If there 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. If more than one of them are such a break, the val...
... Full support No support No supportExperimental. Expect behavior to change in the future.Experimental. Expect behavior to change in the future. Notes on compatibility Prior to Firefox 65, the older property of page-break-inside will work in Firefox to prevent breaks in columns, as well as pages. Add both properties for backwards compatibility. For older WebKit-based browsers, the prefixed property -webkit-column-break-inside can be used to control column breaks. ...
<color> - CSS: Cascading Style Sheets
d behavior, such as in a <gradient>, the current CSS spec states that transparent should be calculated in the alpha-premultiplied color space. However, be aware that older browsers may treat it as black with an alpha value of 0. Historical note: transparent wasn't a true color in CSS Level 2 (Revision 1). It was a special keyword that could be used instead of a regular <color> value on two CSS properties: background and border. It was essentially added to allow developers to override an inherited solid color. With the advent of alpha channels in CSS Colors Level 3, transparent was redefined as a true color. It can now be used wherever a <color> value can be used. currentcolor keyword The currentcolor keyword represents the value of an element's color property. This lets you use the color value...
...ckground and border. It was essentially added to allow developers to override an inherited solid color. With the advent of alpha channels in CSS Colors Level 3, transparent was redefined as a true color. It can now be used wherever a <color> value can be used. currentcolor keyword The currentcolor keyword represents the value of an element's color property. This lets you use the color value on properties that do not receive it by default. If currentcolor is used as the value of the color property, it instead takes its value from the inherited value of the color property. currentcolor example HTML <div style="color:blue; border: 1px dashed currentcolor;"> The color of this text is blue. <div style="background:currentcolor; height:9px;"></div> This block is surrounded by a blue border. </...
fit-content() - CSS: Cascading Style Sheets
tion clamps a given size to an available size according to the formula min(maximum size, max(minimum size, argument)). The source for this interactive example is stored in a GitHub repository. If 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 function can be used as a track size in CSS Grid properties, where the maximum size is defined by max-content and the minimum size by auto, which is calculated similar to auto (i.e., minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. The function can also be used as laid out box size for width, height, min-width, min-height, max-width and max-height, where the maximum and minimum sizes re...
... 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. Otherwise it is relative to the available inline size or block size of the laid out box depending on the writing mode. Examples Sizing grid columns with fit-content HTML <div id="container"> <div>Item as wide as the content.</div> <div> Item with more t...
font-family - CSS: Cascading Style Sheets
ve 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 any given font is available. This lets the browser select an acceptable fallback font when necessary. The font-family property specifies a list of fonts, from highest priority to lowest. Font selection does not simply stop at the first font in the list that is on the us...
... lowest. Font selection does not simply stop at the first font in the list that is on the user's system. Rather, font selection is done one character at a time, so that if an available font does not have a glyph for a needed character, the latter fonts are tried. (However, this doesn't work in Internet Explorer 6 or earlier.) When a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen. Syntax /* A font family name and a generic family name */ font-family: Gill Sans Extrabold, sans-serif; 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; f...
font-variation-settings - CSS: Cascading Style Sheets
acters outside the U+20 - U+7E codepoint range, the whole property is invalid. The <number> can be fractional or negative, depending on the value range available in your font, as defined by the font designer. Description This property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. You should only use it when no basic properties exist to set those features (e.g. font-weight, font-style). Font characteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. In some browsers, this is currently only true when the @font-face declaration includes a font-weight range. Registered and custom axes Variab...
...t-weight range. Registered and custom axes Variable font axes come in two types: registered and custom. Registered axes are the most commonly encountered -- common enough that the authors of the specification felt they were worth standardizing. Note that this doesn't mean that the author has to include all of these in their font. ...
<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. ...
...ual 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 Zero, with a leading + and a unit -0kHz Zero, with a leading - and a unit Invalid frequency values 12.0 This is a <...
image-orientation - CSS: Cascading Style Sheets
The image-orientation CSS property specifies a layout-independent correction 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; /* Rotat...
...It should not be used for arbitrary rotations. For any purpose other than correcting an image's orientation due to how it was shot or scanned, use a transform property with the rotate keyword to specify rotation. This includes any user-directed changes to the orientation of the image, or changes required for printing in portrait versus landscape orientation. If used in conjunction with other CSS properties, such as a <transform-function>, any image-orientation rotation is applied before any other transformations. Formal definition Initial value0degApplies toall elementsInheritedyesComputed valuean <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value by 1turnAnimation typediscrete Formal syntax from-image | <angle> | [ <angle>? flip ] Examples Orienti...
Initial value - CSS: Cascading Style Sheets
You can explicitly specify the initial value by using the initial keyword. ...
... You can explicitly specify the initial value by using the initial keyword. ...
inline-size - CSS: Cascading Style Sheets
l 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 related property is block-size, which defines the other dimension of the element. Values The inline-size property takes the same values as the width and height properties. Formal definition Initial valueautoApplies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Formal syntax <'width'> Examples Setting inline size in pixels HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yello...
... Editor's Draft Initial definition ...
inset-block-end - CSS: Cascading Style Sheets
ue */ 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. ...
... Editor's Draft Initial definition ...
inset-block-start - CSS: Cascading Style Sheets
t-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. ...
... Editor's Draft Initial definition ...
inset-inline-end - CSS: Cascading Style Sheets
set-inline-end: initial; inset-inline-end: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. Syntax Values The inset-inline-end property takes the same values as the left property. ...
... Editor's Draft Initial definition ...
inset-inline-start - CSS: Cascading Style Sheets
line-start: initial; inset-inline-start: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. Syntax Values The inset-inline-start property takes the same values as the left property. ...
... Editor's Draft Initial definition ...
margin-block - CSS: Cascading Style Sheets
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. 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. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a perc...
... Editor's Draft Initial definition. ...
margin - CSS: Cascading Style Sheets
Web › CSS › margin
nition of 'margin' in that specification. Working Draft No significant change. CSS Level 2 (Revision 1)The definition of 'margin' in that specification. Recommendation Removes the effect of top and bottom margins on inline elements. CSS Level 1The definition of 'margin' in that specification. Recommendation Initial definition. ...
...Initial definition. Initial valueas each of the properties of the shorthand:margin-bottom: 0margin-left: 0margin-right: 0margin-top: 0Applies toall elements, except elements with table display types other than table-caption, table and inline-table. ...
mask-border-slice - CSS: Cascading Style Sheets
sed a single time to form the corners of the final border image. Zones 5-8 are edge regions. These are repeated, scaled, or otherwise modified in the final border image to match the dimensions of the element. Zone 9 is the middle region. It is discarded by default, but is used like a background image if the keyword fill is set. The mask-border-repeat, mask-border-width, and mask-border-outset properties determine how these regions are used to form the final mask border. Formal definition Initial value0Applies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoPercentagesrefer to size of the mask border imageComputed valueas specifiedAnimation typediscrete Formal syntax <number-percentage>{1,4} fill?where <number-percentage>...
...orted, it will serve to define the size of the slices taken from the source image, and used to create the border mask. mask-border-slice: 30 fill; Chromium-based browsers support an outdated version of this property -- mask-box-image-slice -- with a prefix: -webkit-mask-box-image-slice: 30 fill; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect. Note: The fill keyword needs to be included if you want the element's content to be visible. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-slice' in that specification. Candidate Recommendation Initial defintion ...
max-block-size - CSS: Cascading Style Sheets
<percentage> Defines the max-width as a percentage of the containing block's width. auto The browser will calculate and select a max-width for the specified element. none No limit on the size of the box. max-content The intrinsic preferred max-width. min-content The intrinsic minimum max-width. fit-content(<length-percentage>) ...
... which class is used. .standard-box { padding: 4px; background-color: #abcdef; color: #000; font: 16px "Open Sans", "Helvetica", "Arial", sans-serif; max-block-size: 160px; min-block-size: 100px; } .horizontal { writing-mode: horizontal-tb; } .vertical { writing-mode: vertical-rl; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'max-block-size' in that specification. Editor's Draft Initial definition ...
max-inline-size - CSS: Cascading Style Sheets
-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 value0Applies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as max-width and max-heightAnimation typea length, percentage or calc(); Formal syntax <'max-width'> Examples Setting max inline size in pixels HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background...
... Editor's Draft Initial definition ...
min-block-size - CSS: Cascading Style Sheets
k-size: initial; min-block-size: unset; If the writing mode is vertically oriented, the value of min-block-size relates to the minimum width of the element; otherwise, it relates to the minimum height of the element. A related property is min-inline-size, which defines the other dimension of the element. Values The min-block-size property takes the same values as the min-width and min-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as min-width and min-heightAnimation typea length, percentage or calc(); Formal syntax <'min-width'> Examples Setting minimum block size for vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; ...
... Editor's Draft Initial definition ...
min-inline-size - CSS: Cascading Style Sheets
size: initial; min-inline-size: unset; If the writing mode is vertically oriented, the value of min-inline-size relates to the minimum height of the element; otherwise, it relates to the minimum width of the element. A related property is min-block-size, which defines the other dimension of the element. Values The min-inline-size property takes the same values as the min-width and min-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as min-width and min-heightAnimation typea length, percentage or calc(); Formal syntax <'min-width'> Examples Setting minimum inline size for vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; ...
... Editor's Draft Initial definition ...
pointer-events - CSS: Cascading Style Sheets
her than none, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none. The value of the visibility property does not affect event processing. fill SVG only. The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) of the element. The values of the fill and visibility properties do not affect event processing. stroke SVG only. The element can only be the target of a pointer event when the pointer is over the perimeter (i.e., stroke) of the element. The values of the stroke and visibility properties do not affect event processing. all SVG only (experimental for HTML). The element can only be the target of a pointer event when the pointer is over the interior (i.e., f...
... Description When this property is unspecified, the same characteristics of the visiblePainted value apply to SVG content. ...
<position> - CSS: Cascading Style Sheets
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. Each keyword represents either an edge of the element's box or the center line between two edges. ...
...*/ Formal syntax [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length> | <percentage> ] [ top | center | bottom | <length> | <percentage> ]? | [ [ left | right ] [ <length> | <percentage> ] ] && [ [ top | bottom ] [ <length> | <percentage> ] ] ] Note: The background-position property also accepts a three-value syntax. This is not allowed in other properties that use <position>. Interpolation When animated, a point's abscissa and ordinate values are interpolated independently. However, because the speed of the interpolation is determined by a single timing function for both coordinates, the point will move in a straight line. Examples Valid positions center left center top right 8.5% bottom 12vmin right -6px 10% 20% 8rem 14px Invalid positi...
Resolved value - CSS: Cascading Style Sheets
See the specification link below for more per-property details. ...
...See the specification link below for more per-property details. ...
revert - CSS: Cascading Style Sheets
Web › CSS › revert
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 keyword works exactly the same as unset in many cases. The only difference is for properties that have values set by the browser or by custom stylesheets created by users (set on the browser side). Revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). So if you have a color: green for all sections and all: revert on a specific section the color of the section will be black. But if you have a rule to make all parag...
...roperty basis by the CSS specifications. In contrast, user-agent stylesheets set default values on the basis of CSS selectors. For example, the initial value for the display property is inline, whereas a normal user-agent stylesheet sets the default display value of <div>s to block, of <table>s to table, etc. Examples Revert vs unset Although revert and unset are similar they differ for some properties for some elements. So in the below example, we set custom font-weight in a global stylesheet, but then try to unset and revert. Unset will keep the text normal because this is an initial value for font-weight property. Revert will revert to bold because this is a default value for headers in most browsers. h3 { font-weight: normal; color: blue; } <h3 style="font-weight: unset; color: unset...
ruby-position - CSS: Cascading Style Sheets
equivalent of having display: inline on the ruby), and above (synonym of the modern over).Opera No support NoSafari No support NoNotes No support NoNotes Notes Safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scripts to the standard over value used with ruby-align: start).WebView Android No support NoChrome Android No support NoFirefox Android Full support 38Opera Android No support ...
...NoFirefox Android Full support 38Opera Android No support NoSafari iOS No support NoNotes No support NoNotes Notes Safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scripts to the standard over value used with ruby-align: start).Samsung Internet Android No support Nointer-character ExperimentalChrome No support NoEdge No support NoFirefox No support ...
scroll-margin-inline - CSS: Cascading Style Sheets
Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. ...
... Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. ...
scroll-margin - CSS: Cascading Style Sheets
-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. ...
... 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. Constituent properties This property is a shorthand for the following CSS properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top Syntax /* <length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /* Global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; Values <length> An outset from the corresponding edge of the scroll container. Description You can see the effect of scroll-marg...
scroll-padding - CSS: Cascading Style Sheets
roll-padding shorthand property sets scroll padding on all sides of an element at once, much like the padding property does for padding on 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 scroll-padding-* properties define offsets for the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This 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 pro...
...port: the region used as the target region for placing things in view of the user. This 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. ...
text-decoration-line - CSS: Cascading Style Sheets
e text-decoration-line CSS property sets the kind of decoration that is used on text in an element, such as an underline or overline. The source for this interactive example is stored in a GitHub repository. If 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 setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. 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-decorati...
... ...
text-decoration-style - CSS: Cascading Style Sheets
active-examples and send us a pull request. If the specified decoration has a specific semantic meaning, like a line-through 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 ...
... ...
text-overflow - CSS: Cascading Style Sheets
ellipsis ('...'), or display a custom 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. The text-overflow property doesn't force an overflow to occur. To make text overflow 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). Syntax The text-overflow property may be specified using one or two values. If one value is given, it specifies overflow behav...
... CSS value direction: ltr direction: rtl Expected Result Live result Expected Result Live result visible overflow 1234567890 1234567890 0987654321 1234567890 text-overflow: clip 1234567890 1234567890 text-overflow: '' 12345 1234567890 5...
url() - CSS: Cascading Style Sheets
Web › CSS › url()
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. ...
...RxVB0...); 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('fantasticfont.woff'); offset-path: url(#path); mask-image: url("masks.svg#mask1"); /* Properties with fallbacks */ cursor: url(pointer.cur), pointer; /* Associated short-hand properties */ background: 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...
will-change - CSS: Cascading Style Sheets
problems. It should not be used to anticipate performance problems. Excessive use of will-change will result in excessive memory use and will cause more complex rendering to occur as the browser attempts to prepare for the possible change. This will lead to worse performance. Give it sufficient time to work. This property is intended as a method for authors to let the user-agent know about properties that are likely to change ahead of time. Then the browser can choose to apply any ahead-of-time optimizations 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. Be aware, t...
...amples Via script This is an example showing how to apply the will-change property through scripting, which is probably what you should be doing in most cases. var el = document.getElementById('element'); // Set will-change when the element is hovered el.addEventListener('mouseenter', hintBrowser); el.addEventListener('animationEnd', removeHint); function hintBrowser() { // The optimizable properties that are going to change // in the animation's keyframes block this.style.willChange = 'transform, opacity'; } function removeHint() { this.style.willChange = 'auto'; } Specifications Specification Status Comment CSS Will Change Module Level 1The definition of 'will-change' in that specification. Candidate Recommendation Initial definition ...
Video player styling basics - Developer guides
height). Its position is also specifically set to relative, which is required for its responsiveness (more on that later). ...
...ound-color:#2a84cd; } A .data-state class is also used here when a <progress> element is being "faked"; when it's in this state the background colour needs to be set. The internal <span> element used as the actual progressing 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 r...
Media buffering, seeking, and time ranges - Developer guides
simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> We can access these attributes like so: var myAudio = document.getElementById('my-audio'); var bufferedTimeRanges = myAudio.buffered; TimeRanges Object TimeRanges are a series of non-overlapping ranges of time, with start and stop times. (learn more about TimeRanges). A TimeRanges Object consists of the following properties: length: The number of time ranges in the object. start(index): The start time, in seconds, of a time range. end(index): The end time, in seconds, of a time range. Without any user interaction there is usually only one time range, but if you jump about in the media more than one time range can appear, as illustrated by the below visualization. This represents two buffered time ranges -- on...
...ime ranges -- one spanning 0 to 5 seconds and the second spanning 15 to 19 seconds. ...
Audio and Video Delivery - Developer guides
e 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 can seek to. var mediaElement = document.querySelector('#mediaElementID'); mediaElement.seekable.start(0); // Ret...
... browser video player using the <video> element. Video player styling basics With the cross-browser video player put in place in the previous article, this article now looks at providing some basic, reponsive styling for the player. Cross-browser audio basics This article provides a basic guide to creating an HTML5 audio player that works cross browser, with all the associated attributes, properties and events explained, and a quick guide to custom controls created using the Media API. Media buffering, seeking, and time ranges Sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay -- a good example of this is the buffered progress bar of an audio or video player. This article discusses how to build a buffer/seek bar using TimeRanges, and o...
Overview of events and handlers - Developer guides
available from several sources, including this one.) Currently, all execution environments for JavaScript code use events and event handling. The event design pattern The event system, at its core, is simply a programming design pattern. The pattern starts with an agreement over a kind of event and: the name String used for the event, the type of the data structure used to represent the key properties of that event, and the JavaScript object which will 'emit' that event. The pattern is implemented by defining a JavaScript function which takes as an argument the data structure which was agreed upon, and registering the function using the name String with the object which will emit the event. The function is said to be a 'listener' or a 'handler' with both names used interchangeably. Th...
...' with both names used interchangeably. This pattern can easily be followed using completely custom code, as explained in the article on custom events. The pattern is also used by modern web browsers which define many events emitted in response to user input or browser activity. Modern web browsers follow the event pattern using a standardized approach. Browsers use as the data structure for the properties of the event, an object derived from the EventPrototype object. Browsers use as the registration method for the function which will handle those data structures a method called addEventListener which expects as arguments a string event type name and the handler function. Finally, browsers define a large number of objects as event emitters and define a wide variety of event types generated by the ...
HTML attribute reference - HTML: Hypertext Markup Language
charset <meta>, <script> Declares the character encoding of the page or script. checked <command>, <input> Indicates whether the element should be checked on page load. cite <blockquote>, <del>, <ins>, <q> Contains a URI which points to the source of the quote or change. class Global attribute Often used with CSS to style elements with common properties. code <applet> Specifies the URL of the applet's class file to be loaded and executed. codebase <applet> This attribute gives the absolute or relative URL of the directory where applets' .class files referenced by the code attribute are stored. color <basefont>, <font>, <hr> This attribute sets the text color using either a named color or a color ...
...ibute() 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 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, t...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
TML 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, interactive content, palpable content. Permitted content Transparent, containing either flow content (excluding interactive content) or phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content, or any element th...
... be easily activated. Understanding Success Criterion 2.5.5: Target Size Target Size and 2.5.5 Quick test: Large touch targets Proximity Interactive elements, like links, placed in close visual proximity should have space separating them. Spacing helps people with motor control issues, who may otherwise accidentally activate the wrong interactive content. Spacing may be created using CSS properties like margin. Hand tremors and the giant-button-problem Specifications Specification Status Comment Referrer PolicyThe definition of 'referrer attribute' in that specification. Candidate Recommendation Added the referrerpolicy attribute. HTML Living StandardThe definition of '<a>' in that specification. Living Standard HTML5The defin...
<basefont> - HTML: Hypertext Markup Language
Web › HTML › Element › basefont
The obsolete HTML Base Font element (<basefont>) sets a default font face, size, and color for the other elements which are descended from its parent element. With this set, the font's size can then be varied relative to the base size using the <font> element. You should not use this element; instead, you should use CSS properties such as font, font-family, font-size, and color to change the font configuration for an element and its contents. Attributes Like all other HTML elements, this element supports the global attributes. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. 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...
...nts related to styling only. Starting with HTML 4, HTML does not convey styling information anymore (outside the <style> element or the style attribute of each element). In HTML5, this element has been removed completely. For any new web development, styling should be written using CSS only. The former behavior of the <font> element can be achieved, and even better controlled using the CSS Fonts properties. DOM interface This element implements the HTMLBaseFontElement interface. Example <basefont color="#FF0000" face="Helvetica" size="+2" /> ...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
o give an icon button an accessible name, put text in the <button> element that concisely describes the button's functionality. Example <button name="favorite"> <svg aria-hidden="true" viewBox="0 0 10 10"><path d="M7 9L5 8 3 9V6L1 4h3l1-3 1 3h3L7 6z"/></svg> Add to favorites </button> If you want to visually hide the button's text, an accessible way to do so is to use a combination of CSS properties to remove it visually from the screen, but keep it parseable by assistive technology. However, it is worth noting that leaving the button text visually apparent can aid people who may not be familiar with the icon's meaning or understand the button's purpose. This is especially relevant for people who are not technologically sophisticated, or who may have different cultural interpretations for t...
... Adrian Roselli Quick test: Large touch targets - The A11Y Project Proximity Large amounts of interactive content -- including buttons -- placed in close visual proximity to each other should have space separating them. This spacing is beneficial for people who are experiencing motor control issues, who may accidentally activate the wrong interactive content. Spacing may be created using CSS properties such as margin. Hand tremors and the giant-button-problem - Axess Lab Firefox Firefox will add a small dotted border on a focused button. This border is declared through CSS in the browser stylesheet, but you can override it to add your own focused style using button::-moz-focus-inner { }. If overridden, it is important to ensure that the state change when focus is moved to the button is h...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
t, scripts can access the window object of the framed resource via the contentWindow property. The contentDocument property refers to the document inside the <iframe>, same as contentWindow.document. From the inside of a frame, a script can get a reference to its parent window with window.parent. Script access to a frame's content is subject to the same-origin policy. Scripts cannot access most properties in other window objects if the script was loaded from a different origin, including scripts inside a frame accessing the frame's parent. Cross-origin communication can be achieved using Window.postMessage(). Positioning and scaling As a replaced element, the position, alignment, and scaling of the embedded document within the <iframe> element's box, can be adjusted with the object-position and ...
...indow objects if the script was loaded from a different origin, including scripts inside a frame accessing the frame's parent. Cross-origin communication can be achieved using Window.postMessage(). Positioning and scaling As a replaced element, the position, alignment, and scaling of the embedded document within the <iframe> element's box, can be adjusted with the object-position and object-fit properties. Examples A simple <iframe> An <iframe> in action. After creating the frame, when the user clicks a button, its title is displayed in an alert. HTML <iframe src="https://mdn-samples.mozilla.org/snippets/html/iframe-simple-contents.html" title="iframe Example 1" width="400" height="300"> </iframe> Result Accessibility concerns People navigating with assistive technology suc...
itemref - HTML: Hypertext Markup Language
itemref provides a list of element IDs (not itemids) elsewhere in the document, with additional properties The itemref attribute can only be specified on elements that have an itemscope attribute specified. Note: the itemref attribute is not part of the microdata data model. It is merely a syntactic construct to aid authors in adding annotations to pages where the data to be annotated does not follow a convenient tree structure. For example, it allows authors to mark up data in a table so that each column defines a separate item while keeping the properties in the cells. ...
...elements that have an itemscope attribute specified. Note: the itemref attribute is not part of the microdata data model. It is merely a syntactic construct to aid authors in adding annotations to pages where the data to be annotated does not follow a convenient tree structure. For example, it allows authors to mark up data in a table so that each column defines a separate item while keeping the properties in the cells. Example HTML <div itemscope id="amanda" itemref="a b"></div> <p id="a">Name: <span itemprop="name">Amanda</span> </p> <div id="b" itemprop="band" itemscope itemref="c"></div> <div id="c"> <p>Band: <span itemprop="name">Jazz Band</span> </p> <p>Size: <span itemprop="size">12</span> players</p> </div> Structured data (in JSON-LD format) { "@id": "amanda", "name": "A...
itemtype - HTML: Hypertext Markup Language
In this case, MusicEvent would be the URL used by itemtype, with startDate and location as itemprop's which MusicEvent defines. ...
...In this case, MusicEvent would be the URL used by itemtype, with startDate and location as itemprop's which MusicEvent defines. ...
Expressions and operators - JavaScript
an object's property. The syntax is: delete object.property; delete object[propertyKey]; delete property; // legal only within a with statement where object is the name of an object, property is an existing property, and propertyKey is a string or symbol referring to an existing property. The fourth form is legal only within a with statement, to delete a property from an object, and also for properties of the global object. If the delete operator succeeds, it removes the propery from the object. Trying to access it afterwards will yield undefined. The delete operator returns true if the operation is possible; it returns false if the operation is not possible. x = 42; // implicitly creates window.x var y = 43; var myobj = {h: 4}; // create object with property h delete x; // returns tru...
...turns true if the operation is possible; it returns false if the operation is not possible. x = 42; // implicitly creates window.x var y = 43; var myobj = {h: 4}; // create object with property h delete x; // returns true (can delete if created implicitly) delete y; // returns false (cannot delete if declared with var) delete Math.PI; // returns false (cannot delete non-configurable properties) delete myobj.h; // returns true (can delete user-defined properties) Deleting array elements Since arrays are just objects, it's technically possible to delete elements from them. This is however regarded as a bad practice, try to avoid it. When you delete an array property, the array length is not affected and other elements are no re-indexed. To achieve that behavior, it is much better to j...
Grammar and types - JavaScript
renceError let x = 3; Function hoisting In the case of functions, only function declarations are hoisted--but not the function expressions. /* Function declaration */ foo(); // "bar" function foo() { console.log('bar'); } /* Function expression */ baz(); // TypeError: baz is not a function var baz = function() { console.log('bar2'); }; Global variables Global variables are in fact properties of the global object. In web pages, the global object is window, so you can set and access global variables using the window.variable syntax. Consequently, you can access global variables declared in one window or frame from another window or frame by specifying the window or frame name. For example, if a variable called phoneNumber is declared in a document, you can refer to this variable from...
...ame as those for let block-scope variables. If the const keyword is omitted, the identifier is assumed to represent a variable. You cannot declare a constant with the same name as a function or variable in the same scope. For example: // THIS WILL CAUSE AN ERROR function f() {}; const f = 5; // THIS WILL CAUSE AN ERROR TOO function f() { const g = 5; var g; //statements } However, the properties of objects assigned to constants are not protected, so the following statement is executed without problems. const MY_OBJECT = {'key': 'value'}; MY_OBJECT.key = 'otherValue'; Also, the contents of an array are not protected, so the following statement is executed without problems. const MY_ARRAY = ['HTML','CSS']; MY_ARRAY.push('JAVASCRIPT'); console.log(MY_ARRAY); //logs ['HTML','CSS','JAVASCR...
Introduction - JavaScript
ased 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 free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed. Java is a class-bas...
... such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation. JavaScript compared to Java JavaScript Java Object-oriented. No distinction between types of objects. Inheritance is through the prototype mechanism, and properties and methods can be added to any object dynamically. Class-based. Objects are divided into classes and instances with all inheritance through the class hierarchy. Classes and instances cannot have properties or methods added dynamically. Variable data types are not declared (dynamic typing, loosely typed). Variable data types must be declared (static typing, strongly typed). ...
Groups and ranges - JavaScript
groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). String.match() won't return groups if the /.../g flag is set. However, you can still use String.matchAll() to get all matches. \n Where "n" is a positive integer. A back reference to the last substring matc...
...ame. For example, to extract the United States area code from a phone number, we could use /\((?<area>\d\d\d)\)/. The resulting number would appear under matches.groups.area. (?:x) Non-capturing group: Matches "x" but does not remember the match. The matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined RegExp object's properties ($1, ..., $9). Examples Counting vowels var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then."; var regexpVowels = /[aeiouy]/g; console.log("Number of vowels:", aliceExcerpt.match(regexpVowels).length); // Number of vowels: 25 Using groups let personList = `First_Name: John, Last_Name: Doe First_Name: Jane, Last_Name: Smith`; let re...
Public class fields - JavaScript
page describes experimental features. Both Public and private field declarations are an experimental feature (stage 3) proposed at TC39, the JavaScript standards committee. Support in browsers is limited, but the feature can be used through a build step with systems like Babel. See the compat information below. Both static and instance public fields are writable, enumerable, and configurable properties. As such, unlike their private counterparts, they participate in prototype inheritance. Syntax class ClassWithInstanceField { instanceField = 'instance field' } class ClassWithStaticField { static staticField = 'static field' } class ClassWithPublicInstanceMethod { publicMethod() { return 'hello world' } } Examples Public static fields Public static fields are useful when you ...
...instance = new ClassWithInstanceField() console.log(instance.instanceField) // expected output: "instance field" Fields without initializers are initialized to undefined. class ClassWithInstanceField { instanceField } const instance = new ClassWithInstanceField() console.assert(instance.hasOwnProperty('instanceField')) console.log(instance.instanceField) // expected output: "undefined" Like properties, field names may be computed. const PREFIX = 'prefix' class ClassWithComputedFieldName { [`${PREFIX}Field`] = 'prefixed field' } const instance = new ClassWithComputedFieldName() console.log(instance.prefixField) // expected output: "prefixed field" When initializing fields this refers to the class instance under construction. Just as in public instance methods, if you're in a subclass yo...
TypeError: property "x" is non-configurable and can't be deleted - JavaScript
only. What went wrong? It was attempted to delete a property, but that property is non-configurable. The configurable attribute controls whether the property can be deleted from the object and whether its attributes (other than writable) can be changed. This error happens only in strict mode code. 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(...
...ect.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 ...
TypeError: "x" is not a constructor - JavaScript
not a constructor Error type TypeError What went wrong? There was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor. See constructor or the new operator for more information on what a constructor is. There are many global objects, like String or Array, which are constructable using new. However, some global objects are not and their properties and methods are static. The following JavaScript standard built-in objects are not a constructor: Math, JSON, Symbol, Reflect, Intl, Atomics. Generator functions cannot be used as constructors either. Examples Invalid cases var Car = 1; new Car(); // TypeError: Car is not a constructor new Math(); // TypeError: Math is not a constructor new Symbol(); // TypeError: Symbol is not a constructo...
...id cases var Car = 1; new Car(); // TypeError: Car is not a constructor new Math(); // TypeError: Math is not a constructor new Symbol(); // TypeError: Symbol is not a constructor function* f() {}; var obj = new f; // TypeError: f is not a constructor A car constructor Suppose you want to create an object type for cars. You want this type of object to be called car, and you want it to have properties for make, model, and year. To do this, you would write the following function: function Car(make, model, year) { this.make = make; this.model = model; this.year = year; } Now you can create an object called mycar as follows: var mycar = new Car('Eagle', 'Talon TSi', 1993); In Promises When returning an immediately-resolved or immediately-rejected Promise, you do not need to create a n...
TypeError: 'x' is not iterable - JavaScript
s not iterable (Chrome) Error type TypeError What went wrong? The value which is given as the right hand-side of for...of or as argument of a function such as Promise.all or TypedArray.from, is not an iterable object. 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. ...
...ion such as Promise.all or TypedArray.from, is not an iterable object. 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. Examples Iterating over Object properties In JavaScript, Objects are not iterable unless they implement the iterable protocol. Therefore, you cannot use for...of to iterate over the properties of an object. var obj = { 'France': 'Paris', 'England': 'London' }; for (let p of obj) { // TypeError: obj is not iterable // ... } Instead you have to use Object.keys or Object.entries, to iterate over the properties or entries of an object. var obj = { 'France': 'Paris', 'England': 'London' }; // Iterate over the property names: for (let country of Object.keys(obj)) { var capital = ...
JavaScript error reference - JavaScript
he Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code. For a beginner's introductory tutorial on fixing JavaScript errors, see What went wrong? Troubleshooting JavaScript. List of errors In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below! Error: Permission denied to access property "x"InternalError: too much recursionRangeError: argument is not a valid code pointRangeError: invalid array lengthRangeError: invalid dateRangeError: precision is out of rangeRangeError: radix must be an integerRangeError: repeat count m...
...rror: missing formal parameterSyntaxError: missing name after . ...
Array.prototype.forEach() - JavaScript
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 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 r...
...ng code logs a line for each element in an array: function logArrayElements(element, index, array) { console.log('a[' + index + '] = ' + element) } // Notice that index 2 is skipped, since there is no item at // that position in the array... ...
BigInt64Array - JavaScript
s an array of 64-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0n. Once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). 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(...
...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 arguments. See also Array.of(). Instance properties BigInt64Array.prototype.buffer Returns the ArrayBuffer referenced by the BigInt64Array. This is fixed at construction time and thus read only. BigInt64Array.prototype.byteLength Returns the length (in bytes) of the BigInt64Array from the start of its ArrayBuffer. This is fixed at construction time and thus read only. BigInt64Array.prototype.byteOffset Returns the offset (in bytes) of the ...
BigUint64Array - JavaScript
array of 64-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0n. Once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). 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(). BigUint64Ar...
...64Array. BigUint64Array.name Returns the string value of the constructor name. In the case of the BigUint64Array type this is "BigUint64Array". Static methods BigUint64Array.from() Creates a new BigUint64Array from an array-like or iterable object. See also Array.from(). BigUint64Array.of() Creates a new BigUint64Array with a variable number of arguments. See also Array.of(). Instance properties BigUint64Array.prototype.buffer Returns the ArrayBuffer referenced by the BigUint64Array. This is fixed at construction time and thus read only. BigUint64Array.prototype.byteLength Returns the length (in bytes) of the BigUint64Array from the start of its ArrayBuffer. This is fixed at construction time and thus read only. BigUint64Array.prototype.byteOffset Returns the offset (in bytes) of...
Float32Array - JavaScript
s (corresponding to the C float data type) in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). 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 ne...
... 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 also Array.of(). Instance properties Float32Array.prototype.buffer Returns the ArrayBuffer referenced by the Float32Array Fixed at construction time and thus read only. Float32Array.prototype.byteLength Returns the length (in bytes) of the Float32Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Float32Array.prototype.byteOffset Returns the offset (in bytes) of the Float32Array from the ...
Float64Array - JavaScript
(corresponding to the C double data type) in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). 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 ne...
... 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 also Array.of(). Instance properties Float64Array.prototype.buffer Returns the ArrayBuffer referenced by the Float64Array Fixed at construction time and thus read only. Float64Array.prototype.byteLength Returns the length (in bytes) of the Float64Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Float64Array.prototype.byteOffset Returns the offset (in bytes) of the Float64Array from the ...
Function.prototype.bind() - JavaScript
A copy of the given function with the specified this value, and initial arguments (if provided). 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. Calling the bound function generally results in the execution of its wrapped function. A bound function has the following internal properties: [[BoundTargetFunction]] The wrapped function object [[BoundThis]] The value that is always passed as this value when calling the wrapped function. [[BoundArguments]] A list of values whose elements are used as the first arguments to any call to the wrapped function. [[Call]] Executes code associated with this object. Invoked via a function call expression. The arguments to the internal...
...ot seriously attempt to be exhaustive) between this algorithm and the specified algorithm are: The partial implementation relies on Array.prototype.slice(), Array.prototype.concat(), Function.prototype.call() and Function.prototype.apply(), built-in methods to have their original values. The partial implementation creates functions that do not have immutable "poison pill" caller and arguments properties that throw a TypeError upon get, set, or deletion. (This could be added if the implementation supports Object.defineProperty, or partially implemented [without throw-on-delete behavior] if the implementation supports the __defineGetter__ and __defineSetter__ extensions.) The partial implementation creates functions that have a prototype property. (Proper bound functions have none.) The partial ...
Generator.prototype.next() - JavaScript
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. ...
... 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. This is equivalent of not specifying the done property altogether. value Any JavaScript value returned by the iterator. Can be omitted wh...
Generator.prototype.throw() - JavaScript
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. ...
...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. ...
Int16Array - JavaScript
rray of twos-complement 16-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). 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 wit...
...ement 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(). Instance properties Int16Array.prototype.buffer Returns the ArrayBuffer referenced by the Int16Array Fixed at construction time and thus read only. Int16Array.prototype.byteLength Returns the length (in bytes) of the Int16Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Int16Array.prototype.byteOffset Returns the offset (in bytes) of the Int16Array from the start of its...
Int32Array - JavaScript
rray of twos-complement 32-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). 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 wit...
...ement 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(). Instance properties Int32Array.prototype.buffer Returns the ArrayBuffer referenced by the Int32Array Fixed at construction time and thus read only. Int32Array.prototype.byteLength Returns the length (in bytes) of the Int32Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Int32Array.prototype.byteOffset Returns the offset (in bytes) of the Int32Array from the start of its...
Int8Array - JavaScript
The Int8Array typed array represents an array of twos-complement 8-bit signed integers. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). Constructor Int8Array() Creates a new Int8Array object. Static properties Int8Array.BYTES_PER_ELEMENT Returns a number value of the element size. 1 in the case of an Int8Array. Int8Array.name Returns the string value of the constructor name. In the case of the Int8Array type: "Int8Array". Static methods Int8Array.from() Creates a new Int8Array from an array-like or iterable object. See also Array.from(). Int8Array.of() Creates a new Int8Array with a variable number of arguments. See also Array.of(). ...
...f 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(). Instance properties Int8Array.prototype.buffer Returns the ArrayBuffer referenced by the Int8Array Fixed at construction time and thus read only. Int8Array.prototype.byteLength Returns the length (in bytes) of the Int8Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Int8Array.prototype.byteOffset Returns the offset (in bytes) of the Int8Array from the start of its Array...
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
The Intl.DateTimeFormat.prototype.resolvedOptions() method returns a new object with properties 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. 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 exte...
... 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 = new Intl.DateTimeFormat('de-XX', { timeZone: 'UTC' }); var usedOptions ...
Intl.NumberFormat() constructor - JavaScript
, "limb", "mathbold", "mathdbl", "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", "newa", "nkoo", "olck", "orya", "osma", "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. 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 cu...
...property must be provided. unitDisplay The unit formatting style to use in unit formatting, the defaults is "short". "long" (e.g., 16 litres) "short" (e.g., 16 l) "narrow" (e.g., 16l) useGrouping Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. Possible values are true and false; the default is true. 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. minim...
Intl.PluralRules() constructor - JavaScript
The Intl.PluralRules() constructor creates Intl.PluralRules 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. "...
...e "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. type The type to use. Possible values are: "cardinal" for cardinal numbers (refering to the quantity of things). This is the default value. "ordinal" for ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in English). The following properties fall into two groups: minimumIntegerDigits, minimumFractionDigits, and maximumFractionDigits in one group, minimumSignificantDigits and maximumSignificantDigits in the other. If at 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.
Intl - JavaScript
The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The Intl object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions. Constructor properties Intl.Collator() Constructor for collators, which are objects that enable language-sensitive string comparison. Intl.DateTimeFormat() Constructor for objects that enable language-sensitive date and time formatting. Intl.DisplayNames() Constructor for objects that enable the consistent translation of language, region and script display names. Intl.ListFormat() Constructor for objects that enable language-sensitive list forma...
...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 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 Formatt...
Map - JavaScript
Iteration A Map is an iterable, so it can be directly iterated. Iterating over an Object requires obtaining its keys in some fashion and iterating over them. Performance Performs better in scenarios involving frequent additions and removals of key-value pairs. Not optimized for frequent additions and removals of key-value pairs. Setting object properties Setting Object properties works for Map objects as well, and can cause considerable confusion. Therefore, this appears to work in a way: let wrongMap = new Map() wrongMap['bla'] = 'blaa' wrongMap['bla2'] = 'blaaa2' console.log(wrongMap) // Map { bla: 'blaa', bla2: 'blaaa2' } But that way of setting a property does not interact with the Map data structure. It uses the feature of the generic...
...ss: "123 N 1st Ave"}) contacts.has('Jessie') // true contacts.get('Hilary') // undefined contacts.set('Hilary', {phone: "617-555-4321", address: "321 S 2nd St"}) contacts.get('Jessie') // {phone: "213-555-1234", address: "123 N 1st Ave"} contacts.delete('Raymond') // false contacts.delete('Jessie') // true console.log(contacts.size) // 1 Constructor Map() Creates a new Map object. Static properties get Map[@@species] The constructor function that is used to create derived objects. Instance properties Map.prototype.size Returns the number of key/value pairs in the Map object. Instance methods Map.prototype.clear() Removes all key-value pairs from the Map object. Map.prototype.delete(key) Returns true if an element in the Map object existed and has been removed, or false if ...
Math - JavaScript
Math is a built-in object that has properties and methods for mathematical constants and functions. It's not a function object. Math works with the Number type. It doesn't work with BigInt. Description Unlike many other global objects, Math is not a constructor. All properties and methods of Math are static. You refer to the constant pi as Math.PI and you call the sine function as Math.sin(x), where x is the method's argument. Constants are defined with the full precision of real numbers in JavaScript. Note: Many Math functions have a precision that's implementation-dependent. This means that different browsers can give a different result. ...
...you call the sine function as Math.sin(x), where x is the method's argument. Constants are defined with the full precision of real numbers in JavaScript. Note: Many Math functions have a precision that's implementation-dependent. This means that different browsers can give a different result. Even the same JavaScript engine on a different OS or architecture can give different results! Static properties Math.E Euler's constant and the base of natural logarithms; approximately 2.718. Math.LN2 Natural logarithm of 2; approximately 0.693. Math.LN10 Natural logarithm of 10; approximately 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.141...
Object.getOwnPropertySymbols() - JavaScript
The Object.getOwnPropertySymbols() method returns an array of all symbol properties 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. ...
...ject.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.getOwnPropertySymbols() returns an empty array unless you have set symbol properties on your object. Examples Using getOwnPropertySymbols var obj = {}; var a = Symbol('a'); var b = Symbol.for('b'); obj[a] = 'localSymbol'; obj[b] = 'globalSymbol'; var objectSymbols = Object.getOwnPrope...
Object.keys() - JavaScript
s own enumerable property names, iterated 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 comp...
... 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 object. // In ES5 Object.keys('foo'); // TypeError: "foo" is not an object // In ES2015+ Object.keys('foo'); // ["0", "1", "2"] Specificatio...
Object.values() - 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 Object.values(obj) Parameters obj The object whose enumerable own property values are to be returned. ...
...b.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 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. Examples Using Object.values const obj = { foo: 'bar', baz: 42 }; console.log(Object.valu...
Proxy() constructor - JavaScript
Description Use the Proxy() constructor to create a new Proxy object. ...
...ensible() A trap for Object.isExtensible. handler.ownKeys() A trap for Object.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. const target = { notProxied: "original value", proxied: "original value" }; const handler = { get: function(target, prop, receiver) { if (prop === "proxied") { return "replaced value"; } return Reflect.get(...arguments); } }; cons...
Comparing Reflect and Object methods - JavaScript
es not exist in an API, it is marked as N/A. Method Name Object Reflect defineProperty() Object.defineProperty() returns the object that was passed to the function. Returns a TypeError if the property was not successfully defined on the object. Reflect.defineProperty() returns true if the property was defined on the object and false if it was not. defineProperties() Object.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() retur...
...as the first argument. getOwnPropertyDescriptors() Object.getOwnPropertyDescriptors() returns an object containing a property descriptor of each passed-in object. Returns an empty object if the passed-in object has no owned property descriptors. N/A getPrototypeOf() Object.getPrototypeOf() returns the prototype of the given object. Returns null if there are no inherited properties. Throws a TypeError for non-objects in ES5, but coerces non-objects in ES2015. Reflect.getPrototypeOf() returns the prototype of the given object. Returns null if there are no inherited properties, and throws a TypeError for non-objects. setPrototypeOf() Object.setPrototypeOf() returns the object itself if its prototype was set successfully. Throws a TypeError if the prototype bein...
Reflect.has() - JavaScript
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. ...
... ...
Reflect.isExtensible() - JavaScript
The static Reflect.isExtensible() method determines if an object is extensible (whether it can have new properties added to it). It is similar to Object.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. ...
...ples 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 are extensible. let empty = {} Reflect.isExtensible(empty) // === true // ...but that can be changed. Reflect.preventExtensions(empty) Reflect.isExtensible(empty) // === false // Sealed objects are by definition non-extensible. let sealed = Obj...
Reflect.preventExtensions() - JavaScript
It is similar to Object.preventExtensions(), 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. ...
...ctive-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.preventExtensions() See also Object.preventExtensions(). // Objects are extensible by default. let empty = {} Reflect.isExtensible(empty) // === true // ...but that can be changed. Reflect.preventExtensions(empty) Reflect.isExtensible(empty...
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 illustrate...
...egExp.test The following script uses the test() method of the RegExp instance to grab a number in a generic string. var str = 'Test 24'; var number = /(\d+)/.test(str) ? RegExp.$1 : '0'; number; // "24" Please note that any operation involving the usage of other regular expressions between a re.test(str) call and the RegExp.$n property, might have side effects, so that accessing these special properties should be done instantly, otherwise the result might be unexpected. Specifications Specification Legacy RegExp features in JavaScript ...
String - JavaScript
ess 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 (a > b) { console.l...
...tion, rather than as a constructor, which is usually more useful. Static methods String.fromCharCode(num1 [, ...[, numN]]) Returns a string created by using the specified sequence of Unicode values. String.fromCodePoint(num1 [, ...[, numN) Returns a string created by using the specified sequence of code points. String.raw() Returns a string created from a raw template string. Instance properties String.prototype.length Reflects the length of the string. Read-only. Instance methods String.prototype.charAt(index) Returns the character (exactly one UTF-16 code unit) at the specified index. String.prototype.charCodeAt(index) Returns a number that is the UTF-16 code unit value at the given index. String.prototype.codePointAt(pos) Returns a nonnegative integer Number that is the ...
TypeError - JavaScript
exclusively) when a value is not of the expected type. A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator or function; or when attempting to modify a value that cannot be changed; or when attempting to use a value in an inappropriate way. Constructor TypeError() Creates a new TypeError object. Instance properties TypeError.prototype.message Error message. Although ECMA-262 specifies that TypeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. TypeError.prototype.name Error name. Inherited from Error. TypeError.prototype.fileName Path to file that raised this error. Inherited from Error. TypeError.prototype.lineNumber Line number in file that raise...
... Line number in file that raised this error. Inherited from Error. TypeError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. TypeError.prototype.stack Stack trace. Inherited from Error. ...
Uint16Array - JavaScript
resents an array of 16-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, 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 Uint16...
...ze. 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.of(). Instance properties Uint16Array.prototype.buffer Returns the ArrayBuffer referenced by the Uint16Array Fixed at construction time and thus read only. Uint16Array.prototype.byteLength Returns the length (in bytes) of the Uint16Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Uint16Array.prototype.byteOffset Returns the offset (in bytes) of the Uint16Array from the start ...
Uint32Array - JavaScript
resents an array of 32-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). 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 Uint32...
...ze. 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.of(). Instance properties Uint32Array.prototype.buffer Returns the ArrayBuffer referenced by the Uint32Array Fixed at construction time and thus read only. Uint32Array.prototype.byteLength Returns the length (in bytes) of the Uint32Array from the start of its ArrayBuffer. Fixed at construction time and thus read only. Uint32Array.prototype.byteOffset Returns the offset (in bytes) of the Uint32Array from the start ...
Uint8Array - JavaScript
1 in the case of an Uint8Array. ...
...ement 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(). Instance properties Uint8Array.prototype.buffer Returns the ArrayBuffer referenced by the Uint8Array Fixed at construction time and thus read only. Uint8Array.prototype.byteLength Returns the length (in bytes) of the Uint8Array. Fixed at construction time and thus read only. Uint8Array.prototype.byteOffset Returns the offset (in bytes) of the Uint8Array from the start of its ArrayBuffer. Fixed at constructio...
Uint8ClampedArray - JavaScript
ut 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". Static methods Uint8ClampedArray.from() Creates a new Uint8ClampedArray from an array-like or iterable object. See also Array.from(...
...8ClampedArray.name Returns the string value of the constructor name. In the case of the Uint8ClampedArray type: "Uint8ClampedArray". Static methods Uint8ClampedArray.from() Creates a new Uint8ClampedArray from an array-like or iterable object. See also Array.from(). Uint8ClampedArray.of() Creates a new Uint8ClampedArray from a variable number of arguments. See also Array.of(). Instance properties Uint8ClampedArray.prototype.buffer Returns the ArrayBuffer referenced by the Uint8ClampedArray Fixed at construction time and thus read only. Uint8ClampedArray.prototype.byteLength Returns the length (in bytes) of the Uint8ClampedArray from the start of its ArrayBuffer. Fixed at construction time and thus read only. Uint8ClampedArray.prototype.byteOffset Returns the offset (in bytes) of t...
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. ...
...e) { console.log('Name: ' + n + ', Father: ' + f); } // "Name: Mike Smith, Father: Harry Smith" // "Name: Tom Jones, Father: Richard Jones" Computed object property names and destructuring Computed property names, like on object literals, can be used with destructuring. let key = 'z'; let {[key]: foo} = {z: 'bar'}; console.log(foo); // "bar" Rest in Object Destructuring The Rest/Spread Properties for ECMAScript proposal (stage 4) adds the rest syntax to destructuring. Rest properties collect the remaining own enumerable property keys that are not already picked off by the destructuring pattern. let {a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40} a; // 10 b; // 20 rest; // { c: 30, d: 40 } Invalid JavaScript identifier as a property name Destructuring can be used with property names that...
Optional chaining (?.) - JavaScript
in the chain is valid. The ?. operator functions similarly to the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined. 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. It can also be helpful while exploring the content of an object when there's no known guarantee as to 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 se...
...ng if onError really exists onError(err.message); } } } // Using optional chaining with function calls function doSomething(onContent, onError) { try { // ... ...
Spread syntax (...) - JavaScript
l 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: Unlike unshift(), this creates a new arr1, and does not modify the original arr1 array in-place. Spread in object literals The Rest/Spread Properties for ECMAScript proposal (ES2018) added spread properties to object literals. It copies own enumerable properties from a provided object onto a new object. Shallow-cloning (excluding prototype) or merging of objects is now possible using a shorter syntax than Object.assign(). const obj1 = { foo: 'bar', x: 42 }; const obj2 = { foo: 'baz', y: 13 }; const clonedObj = { ...obj1 }; // Object { foo: ...
...he object literal, due to the rest parameter. Only for iterables Objects themselves 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)Th...
in operator - JavaScript
// returns true You must specify an object on the right side of the in operator. For example, you can specify a string created with the String constructor, but you cannot specify a string literal. let color1 = new String('green') 'length' in color1 // returns true let color2 = 'coral' // generates an error (color2 is not a String object) 'length' in color2 Using in with deleted or undefined properties If you delete a property with the delete operator, the in operator returns false for that property. let mycar = {make: 'Honda', model: 'Accord', year: 1998} delete mycar.make 'make' in mycar // returns false let trees = new Array('redwood', 'bay', 'cedar', 'oak', 'maple') delete trees[3] 3 in trees // returns false If you set a property to undefined but do not delete it, the in operator r...
...perator 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 ECMAScript (ECMA-262)The definition of 'Relational Operators' in that specification. ...
new operator - JavaScript
or 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. To define an object type, create a function for the object type that specifies its name and properties. An object can have a property that is itself another object. See the examples below. When the code new Foo(...) is executed, the following things happen: A new object is created, inheriting from Foo.prototype. The constructor function Foo is called with the specified arguments, and with this bound to the newly created object. new Foo is equivalent to new Foo(), i.e. if no argument list is s...
...ole.log(car2.color); // 'original color' If you didn't write the new operator, the Constructor Function would be invoked like any Regular Function, without creating an Object. In this case, the value of this is also different. Examples Object type and object instance Suppose you want to create an object type for cars. You want this type of object to be called Car, and you want it to have properties for make, model, and year. To do this, you would write the following function: function Car(make, model, year) { this.make = make; this.model = model; this.year = year; } Now you can create an object called myCar as follows: var myCar = new Car('Eagle', 'Talon TSi', 1993); This statement creates myCar and assigns it the specified values for its properties. Then the value of myCar.make...
super - JavaScript
er-calling static methods You are also able to call super on static methods. class Rectangle { constructor() {} static logNbSides() { return 'I have 4 sides'; } } class Square extends Rectangle { constructor() {} static logDescription() { return super.logNbSides() + ' which are all equal'; } } Square.logDescription(); // 'I have 4 sides which are all equal' Deleting super properties will throw an error You cannot use the delete operator and super.prop or super[expr] to delete a parent class' property, it will throw 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 cann...
...cannot use the delete operator and super.prop or super[expr] to delete a parent class' property, it will throw 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. } } va...
this - JavaScript
Within a class constructor, this is a regular object. All non-static methods within the class are added to the prototype of this: class Example { constructor() { const proto = Object.getPrototypeOf(this); console.log(Object.getOwnPropertyNames(proto)); } first(){} second(){} static third(){} } new Example(); // ['constructor', 'first', 'second'] Note: Static methods are not properties of this. They are properties of the class itself. Derived classes Unlike base class constructors, derived constructors have no initial this binding. Calling super() creates a this binding within the constructor and essentially has the effect of evaluating the following line of code, where Base is the inherited class: this = new Base(); Warning: Referring to this before calling super() will...
...th the new keyword), its this is bound to the new object being constructed. While the default for a constructor is to return the object referenced by this, it can instead return some other object (if the return value isn't an object, then the this object is returned). /* * Constructors work like this: * * function MyConstructor(){ * // Actual function body code goes here. * // Create properties on |this| as * // desired by assigning to them. E.g., * this.fum = "nom"; * // et cetera... * * // If the function has a return statement that * // returns an object, that object will be the * // result of the |new| expression. Otherwise, * // the result of the expression is the object * // currently bound to |this| * // (i.e., the common case most usually seen). * ...
const - JavaScript
ntax const name1 = value1 [, name2 = value2 [, ... [, nameN = valueN]]]; nameN The constant's name, which can be any legal identifier. valueN The constant's value. 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. Global constants do not become properties of the window object, unlike var variables. An initializer for a constant is required. You must specify its value in the same statement in which it's declared. (This makes sense, given that it can't be changed later.) 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 insta...
...must specify its value in the same statement in which it's declared. (This makes sense, given that it can't be changed later.) 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 the case where the content is an object, this means the object's contents (e.g., its properties) can be altered. All the considerations about the "temporal dead zone" apply to both let and const. A constant cannot share its name with a function or a variable in the same scope. Examples Basic const usage Constants can be declared with uppercase or lowercase, but a common convention is to use all-uppercase letters. // define MY_FAV as a constant and give it the value 7 const MY_FAV = 7;...
Navigation and resource timings - Web Performance
Navigation timings are metrics measuring a browser's document navigation events. Resource timings are detailed network timing measurements regarding the loading of an application's resources. Both provide the same read-only properties, but navigation timing measures the main document's timings whereas the resource timing provides the times for all the assets or resources called in by that main document and the resources' requested resources. The general performance timings below have been deprecated in favor of the Performance Entry API, which provides for marking and measuring times along the navigation and resource loading process. While deprecated, they are supported in all browsers. Performance Timings The performanceTiming API, a JavaScript API for measuring the loading performance o...
...ontentLoaded event from the time value immediately after the event completes. Keeping this at 50ms or faster helps ensure a responsive user interface. DOMContentLoaded = timing.domContentLoadedEventEnd - timing.domContentLoadedEventStart Duration We are provided with the duration. The duration is the difference between the PerformanceNavigationTiming.loadEventEnd and PerformanceEntry.startTime properties. The PerformanceNavigationTiming interface also provides information about what type of navigation you are measuring, returning navigate, reload, back_forward or prerender. Resource timing Whereas navigation timing is for measuring the performance of the main page, generally the HTML file via which all the other assets are requested, resource timing measures timing for individual resources, th...
Web Performance
e web performance. We cover them in this section: Key performance guides Animation performance and frame rateAnimation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate.Critical rendering pathThe Critical Rendering Path is the sequence of steps the browser goes through to convert the HTML, CSS, and JavaScript into pixels on the screen. Optimizing the critical render path improves render performance.The critical rendering path includes the Document Object Model (DOM), CSS Object Model (CSSOM),...
... improve performance even further. In this article we discuss the impact video, audio, and image content has on performance, and the methods to ensure that impact is as minimal as possible. CSS performance features CSS may be a less important optimization focus for improved performance, but there are some CSS features that impact performance more than others. In this article we look at some CSS properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted. JavaScript performance best practices JavaScript, when used properly, can allow for interactive and immersive web experiences -- or it can significantly harm download time, render time, in-app performance, battery life, and user experience. This article outlines some JavaScript best p...
mask - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mask
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>, <t...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'mask' in that specification. Recommendation Initial definition ...
text-decoration - SVG: Scalable Vector Graphics
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. ...
... 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,...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
es override those set 'earlier' in the cascade). Only the attributes x, y, width, height and href on the use element will override those set on the referenced element. However, any other attributes not set on the referenced element will be applied to the use element. Since the cloned nodes are not exposed, care must be taken when using CSS to style a use element and its cloned descendants. CSS properties are not guaranteed to be inherited by the cloned DOM unless you explicitly request them using CSS inheritance. For security reasons, browsers may apply the same-origin policy on use elements and may refuse to load a cross-origin URL in the href attribute. There is currently no defined way to set a cross-origin policy for use elements. Since SVG 2, the xlink:href attribute is deprecated in favo...
...alue type: <length> ; Default value: 0; Animatable: yes height The height of the use element. Value type: <length> ; Default value: 0; Animatable: yes Note: width, and height have no effect on use elements, unless the element referenced has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. Note: Starting with SVG2, x, y, width, and height are Geometry Properties, meaning those attributes can also be used as CSS properties for that element. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, c...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
Change Notes pathLength attribute for all basic shapes Implementation status unknown SVGAnimatedPoints.animatedPoints as alias of SVGAnimatedPoints.points Implementation status unknown Auto behavior for rx and ry in <ellipse> Implementation status unknown Text Change Notes text-decoration-fill and text-decoration-stroke properties Not implemented yet (bug 1303569) inline-size attribute for <text> Implementation status unknown shape-inside property Inplementation status unknown shape-subtract property Inplementation status unknown white-space Implementation status unknown Deprecated xml:space attribute Implementation status unknown kerning property remo...
...e Notes paint-order Implemented (bug 828805) will-change instead of buffered-rendering Implementation status unknown context-fill and context-stroke paint values Implemented (bug 719286 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15) and bug 798843 (Firefox 26.0 / Thunderbird 26.0 / SeaMonkey 2.23)) child keyword for <paint> values and marker properties Implementation status unknown vector-effect property Only none and non-scaling-stroke values are supported (bug 528332 (Firefox 15 / Thunderbird 15 / SeaMonkey 2.12), bug 1318208) arcs value for stroke-linejoin Not implemented (bug 1239142) auto-start-reverse value for <marker>'s orient attribute Implemented (bug 879659) SVGPaint removed Implemen...
Scripting - SVG: Scalable Vector Graphics
Web › SVG › Scripting
Preventing default behavior in event code When writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. ...
... Preventing default behavior in event code When writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. ...
Clipping and masking - SVG: Scalable Vector Graphics
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. ...
...l data will be used to determine, which pixels of the circle "make it" to the final rendering. Since the rectangle covers only the upper half of the circle, the lower half of the circle will vanish: ScreenshotLive sample We now have a semicircle without having to deal with arcs in path elements. For the clipping, every path inside the clipPath is inspected and evaluated together with its stroke properties and transformation. Then every part of the target lying in a transparent area of the resulting clipPath's content will not be rendered. Color, opacity and such have no effect as long as they don't let parts vanish completely. Masking The effect of masking is most impressively presented with a gradient. If you want an element to fade out, you can achieve this effect quite quickly with masks. <s...
SVG and CSS - SVG: Scalable Vector Graphics
Example Make a new SVG document as a plain text file, doc8.svg. ...
...idth: 9; } #inner-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 individ...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
"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 CSS 2.1. ...
...h 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 CSS 2.1. Setting font properties An essential part of a text is the font in which it is displayed. SVG offers a set of attributes, many similar to their CSS counterparts, to enable font selection. Each of the following properties can be set as an attribute or via a CSS declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration. Other text-related elements tspan This element is used to mark up sub-portions of a larger text. It must be a child of a text element or another tspan element. A typical usecase is to paint...
Same-origin policy - Web security
to directly reference each other. When two documents do not have the same origin, these references provide very limited access to Window and Location objects, as described in the next two sections. To communicate between documents from different origins, use window.postMessage. Specification: HTML Living Standard ? Cross-origin objects. Window The following cross-origin access to these Window properties is allowed: Methods window.blur window.close window.focus window.postMessage Attributes window.closed Read only. window.frames Read only. window.length Read only. window.location Read/Write. window.opener Read only. window.parent Read only. win...
... Attributes window.closed Read only. window.frames Read only. window.length Read only. window.location Read/Write. window.opener Read only. window.parent Read only. window.self Read only. window.top Read only. window.window Read only. Some browsers allow access to more properties than the above. Location The following cross-origin access to Location properties is allowed: Methods location.replace Attributes URLUtils.href Write-only. Some browsers allow access to more properties than the above. Cross-origin data storage access Access to data stored in the browser such as Web Storage and IndexedDB are sep...
Window: deviceproximity event - Archive of obsolete content
ent has been disabled by default in Firefox 62, behind the device.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,...
Window: userproximity event - Archive of obsolete content
Specifications Specification Status Proximity SensorThe definition of 'Proximity Events' in that specification. Working Draft ...
Interacting with page scripts - Archive of obsolete content
Any of them, even setters and getters, could have been redefined by a page script. Don't use it unless you trust the page, and even then be careful. Also, unsafeWindow isn't a supported API, so it could be removed or changed in a future version of the SDK. Expose objects to page scripts Until Firefox 30, you could use unsafeWindow to perform the ...
self - Archive of obsolete content
that is available as a global in content scripts. self provides: access to the options object access to the port object access to a mostly deprecated messaging API For an overview of content scripts, see the main article. Note that the self object in content scripts is completely different from the self module, which provides an API for an add-on to access its data files and ID. self Properties options Content-scripting APIs such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content script as a JSON object via the contentScriptOptions option. If you do this, the data is available to the content script in the options property of self: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.html", onReady: function(tab) { tab.atta...
Module structure of the SDK - Archive of obsolete content
lib main.js dependencies geolocation.js It can then load them in the same way it would load a local module. For example, to load from main: // main.js code var geo = require("./dependencies/geolocation"); Freezing The SDK freezes the exports object returned by require. ...
Porting the Library Detector - Archive of obsolete content
s All the work is done inside a single file, librarydetector.xul This contains: a XUL overlay a script The XUL overlay adds a box element to the browser's status bar: The script does everything else. The bulk of the script is an array of test objects, one for each library. Each test object contains a function called test(): if the function finds the library, it defines various additional properties for the test object, such as a version property containing the library version. Each test also contains a chrome:// URL pointing to the icon associated with its library. The script listens to gBrowser's DOMContentLoaded event. When this is triggered, the testLibraries() function builds an array of libraries by iterating through the tests and adding an entry for each library which passes. Once t...
Working with Events - Archive of obsolete content
eClick }); function handleClick(state) { panel.show({ position: button }); } This wildcard feature does not yet work for the tabs or windows modules. Adding Listeners in Constructors Event emitters may be modules, as is the case for the ready event above, or they may be objects returned by constructors. In the latter case the options object passed to the constructor typically defines properties whose names are the names of supported event types prefixed with "on": for example, "onOpen", "onReady" and so on. Then in the constructor you can assign a listener function to this property as an alternative to calling the object's on() method. For example: the ActionButton object emits an event when the button is clicked. The following add-on creates a button and assigns a listener to the onC...
Guides - Archive of obsolete content
d by the SDK (which is based on the CommonJS specification), how sandboxes and compartments can be used to improve security, and about the built-in SDK module loader, known as Cuddlefish. Classes and Inheritance Learn how classes and inheritance can be implemented in JavaScript, using constructors and prototypes, and about the helper functions provided by the SDK to simplify this. Private Properties Learn how private properties can be implemented in JavaScript using prefixes, closures, and WeakMaps, and how the SDK supports private properties by using namespaces (which are a generalization of WeakMaps). Content Processes The SDK was designed to work in an environment where the code to manipulate web content runs in a different process from the main add-on code. This article highlights the...
clipboard - Archive of obsolete content
meters data : string The data to put on the clipboard. datatype : string The type of the data, , one of "text", "html", "image". Optional. get(datatype) Get the contents of the user's clipboard. Parameters datatype : string Retrieve the clipboard contents only if matching this type (optional). The function will return null if the contents of the clipboard do not match the supplied type. Properties currentFlavors Data on the clipboard is sometimes available in multiple types. For example, HTML data might be available as both a string of HTML (the html type) and a string of plain text (the text type). This property is an array contains all types in which the data currently on the clipboard is available. ...
indexed-db - Archive of obsolete content
See the IDBFactory documentation. IDBKeyRange Defines a range of keys. See the IDBKeyRange documentation. DOMException Provides more detailed information about an exception. See the DOMException documentation. ...
page-mod - Archive of obsolete content
eets, in the context of any documents matching the pattern specified by the include property. Methods destroy() Stops the page-mod from making any more modifications. Once destroyed the page-mod can no longer be used. Modifications already made to open documents by content scripts will not be undone, but stylesheets added by contentStyle or contentStyleFile, will be unregistered immediately. Properties include A list of match pattern strings. These define the documents to which the page-mod applies. See the documentation of the include option above for details of include syntax. Events attach This event is emitted when the page-mod's content scripts are attached to a document whose URL matches the page-mod's include pattern. The listener function is passed a worker object that you can use...
page-worker - Archive of obsolete content
king 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 The type of event for which listener was registered. listener : function The listener function that was registered. Properties port Object that allows you to: send events to the content script using the port.emit function receive events from the content script using the port.on function See the guide to communicating using port for details. contentURL The URL of content to load. This can point to local content loaded from your add-on's "data" directory or remote content. Setting it loads the content immediatel...
self - Archive of obsolete content
This URI can be used for APIs which require a valid URI string, such as the passwords module. id This property is a printable string that is unique for each add-on. ...
system - Archive of obsolete content
tem').pathFor('ProfD'); // get OS temp files directory (/tmp) var temps = require('sdk/system').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. You can get the value of an environment variable by accessing the property with that name: var system = require("sdk/system"); console.log(system.env.PATH); You can test whether a variable exists by checking whether a property with that name exists: var system = require("sdk/system"); if ('PATH' in system.env) { console.log("PATH i...
content/symbiont - Archive of obsolete content
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 composed from the Worker trait, therefore instances of Symbiont and their descendants expose all the public properties exposed by Worker along with additional public properties that are listed below: Properties contentScriptFile The local 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 ...
dev/panel - Archive of obsolete content
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 devtool", icon: "./my-devt...
frame/hidden-frame - Archive of obsolete content
ontent the moment they are added. Functions add(hiddenFrame) Register a hidden frame, preparing it to load content. Parameters hiddenFrame : HiddenFrame the frame to add remove(hiddenFrame) Unregister a hidden frame, unloading any content that was loaded in it. Parameters hiddenFrame : HiddenFrame the frame to remove HiddenFrame HiddenFrame objects represent hidden frames. Properties element The host application frame in which the page is loaded. Events ready This event is emitted when the DOM for a hidden frame content is ready. It is equivalent to the DOMContentLoaded event for the content page in a hidden frame. ...
io/byte-streams - Archive of obsolete content
acking stream. If the stream is already closed, an exception is thrown. read(numBytes) Reads a string from the stream. If the stream is closed, an exception is thrown. Parameters numBytes : number The number of bytes to read. If not given, the remainder of the entire stream is read. Returns string : A string containing the bytes read. If the stream is at the end, returns the empty string. Properties closed True if the stream is closed. ByteWriter Methods close() Closes both the stream and its backing stream. If the stream is already closed, an exception is thrown. write(str) Writes a string to the stream. If the stream is closed, an exception is thrown. Parameters str : string The string to write. Properties closed True if the stream is closed. ...
stylesheet/style - Archive of obsolete content
tring, 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; null if no uri option was given to the constructor. This property is read-only. type The type of the sheet. I...
system/environment - Archive of obsolete content
env.FOO = null; console.log('FOO' in env); // false env.BAR = ''; console.log(env.BAR); // undefined ...
system/runtime - Archive of obsolete content
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. ...
test/assert - Archive of obsolete content
All identical values are equivalent, as determined by ===. If the expected value is a Date object, the actual value is equivalent if it is also a Date object that refers to the same time. Other pairs that do not both pass typeof value == "object", equivalence is determined by ==. For all other Object pairs, including Array objects, equivalence is determined by having the same number of owned properties (as verified with Object.prototype.hasOwnProperty.call), the same set of keys (although not necessarily the same order), equivalent values for every corresponding key, and an identical "prototype" property. Note: this accounts for both named and indexed properties on Arrays. assert.deepEqual({ a: "foo" }, { a: "foo" }, "equivalent objects"); Parameters actual : object The actual result. ex...
ui/sidebar - Archive of obsolete content
y upon the first event it catches. Parameters type : string The type of event to listen for. listener : function The listener function that handles the event. removeListener(type, listener) Unregisters/removes an event listener from the sidebar. Parameters type : string The type of event for which listener was registered. listener : function The listener function that was registered. Properties id The id of the sidebar. This used to identify this sidebar in its chrome window. It must be unique. title The title of the sidebar. This will be used for the label for your sidebar in the "Sidebar" submenu in Firefox, and will be shown at the top of your sidebar when it is open. url The URL of the content to load in the sidebar. This must be a local URL (typically, loaded from the "data" ...
util/collection - Archive of obsolete content
items already contained in the collection are ignored. Parameters itemOrItems : object An item or array of items. Returns Collection : The Collection. remove(itemOrItems) Removes a single item or an array of items from the collection. Any items not contained in the collection are ignored. Parameters itemOrItems : object An item or array of items. Returns Collection : The Collection. Properties length The number of items in the collection array. ...
util/list - Archive of obsolete content
...
cfx - Archive of obsolete content
f updateLink. --update-link=UPDATE_URL Embed the URL supplied in UPDATE_URL in the XPI file, as the value of updateURL. --no-strip-xpi Will force the packager to include all files into the output xpi. If your extension works unpacked, but breaks after you cfx xpi it, you should try using this option. Experimental Options --harness-option=KEY=VALUE Extra properties added to harness-options.json. --manifest-overload Add fields to, or override selected fields in, package.json. This option takes an argument which is a path to a file containing JSON, and overloads any property of package.json with the properties found in the specified file. --output-file=OUTPUT_FILE Where to put the finished XPI file. --templatedir=TEMPLATEDIR ...
console - Archive of obsolete content
But see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. Console Methods All console methods except exception() and trace() accept one or more JavaScript objects as arguments and log them to the console. Depending on the console's underlying implementation and user interface, you may be able to examine the properties of non-primitive objects that are logged. console.debug(...) Deprecated, you should use console.log() instead. console.error(object[, object, ...]) Logs the arguments to the console, preceded by "error:" and the name of your add-on: console.error("This is an error message"); error: my-addon: This is an error message console.exception(exception) Logs the given exception instance as an er...
jpm - Archive of obsolete content
se 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 new instance of Firefox with the add-on installed: jpm run jpm run accepts ...
Chrome Authority - Archive of obsolete content
t feature available in the Mozilla JS environment, will provide the usual Components.* aliases: Cc An alias for Components.classes. Ci An alias for Components.interfaces. Cu An alias for Components.utils. Cr An alias for Components.results. Cm An alias for Components.manager. components An alias for Components itself (note the lower-case). From this you can access less-frequently-used properties like Components.stack and Components.isSuccessCode. Note: the require("chrome") statement is the only way to access chrome functionality and the Components API. The Components object should not be accessed from modules. The SDK tools will emit a warning if it sees module code which references Components directly. Your modules should refrain from using chrome privileges unless they are absolutel...
Creating Event Targets - Archive of obsolete content
In its initialize() function, we: call the base class initializer use merge() to copy any supplied options into the newly created object call createObserver(), passing in the newly created object as the event target createObserver() is the same as in the previous example, except that in emit() we pass the newly created BookmarkMana...
Getting Started (jpm) - Archive of obsolete content
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 following code: var buttons = require('sdk/ui/butt...
Add-on SDK - Archive of obsolete content
buttons, context menus, menu items, and dialogs. Modify web pages Modify pages matching a URL pattern or dynamically modify a particular tab. Putting it together Walkthrough of the Annotator example add-on. Guides Contributor's guide Learn how to start contributing to the SDK and about the most important idioms used in the SDK code such as modules, classes and inheritance, private properties, and content processes. SDK infrastructure Aspects of the SDK's underlying technology: modules, the Program ID and the rules defining Firefox compatibility. Content scripts A detailed guide to working with content scripts. SDK idioms The SDK's event framework and the distinction between add-on scripts and content scripts. XUL migration A guide to porting XUL add-ons to the SDK. This ...
Canvas code snippets - Archive of obsolete content
s 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 jQuery-style chained access to 2D context methods and properties. function Canvas2DContext(canvas) { if (typeof canvas === 'string') { canvas = document.getElementById(canvas); } if (!(this instanceof Canvas2DContext)) { return new Canvas2DContext(canvas); } this.context = this.ctx = canvas.getContext('2d'); if (!Canvas2DContext.prototype.arc) { Canvas2DContext.setup.call(this, this.ctx); } } Canvas2DContext.setup = function() { va...
Dialogs and Prompts - Archive of obsolete content
The possible values for the attribute are the names of buttons listed above, and the default is "accept", for compatibility with previous versions. Using <dialogheader> You can use the dialogheader element to add "headers" to windows. To get an idea of what it looks like, open Options (or Preferences) dialog in Firefox or Thunderbird (v1.0 and earlier only). ...
Examples and demos from articles - Archive of obsolete content
by each animation to start, stop, etc. etc. in different objects and then to create a constructor for such class of objects in order to standardize and simplify the instantiation of them. Convert relative paths to absolute This example show how to translate relative paths to absolute paths. A shortcut to massively modify the DOM This example shows how to create a framework able to modify many properties of DOM objects at the same time. Filter the digitation into a form field, Capture the digitation of a hidden word This example shows the use of the onkeypress event during a digitation into a form field. AJAX - Submitting forms and uploading files This paragraph shows how to submit forms in pure-AJAX. Multipage AJAX navigation example This article provides a working (minimalist) example of ...
SVG General - Archive of obsolete content
/2000/svg"> <!-- SVG elements go here --> </svg> Note: It is recommended that you do not use DTD's with SVG documents. The tutorial and authoring guidelines have more information. Dynamic scripting helper This little helper script can be used to simplify creation of SVG elements in script. SVG requires you to use setAttributeNS to add attributes to a newly created SVG DOM element. No properties like HTML. SVG IMAGE also requires the use of XLINK for the href attribute, which can be tricky to remember, especially when you're mixing SVG with HTML or XUL. Here is the script: var svgns = "http://www.w3.org/2000/svg"; var xlinkns = "http://www.w3.org/1999/xlink"; var ATTR_MAP = { "className": "class", "svgHref": "href" } var NS_MAP = { "svgHref": xlinkns }; function makeSVG(tag, ...
View Source for XUL Applications - Archive of obsolete content
ou should be using directly is the viewSource method. The rest of those methods should be considered private, and might become inaccessible in the future. void viewSource(aObject); Methods viewSource Opens a viewer to the source code for some document or URI. Parameters The viewSource method takes an Object as its first and only parameter. The Object can include the following properties: URL (required) A string URL for the document to view the source of. browser (optional) The browser containing the document that we would like to view the source of. This is optional if outerWindowID is not passed. outerWindowID (optional) The outerWindowID of the content window containing the document that we want to view the source of. Pass this if you want to attempt to load the docume...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
d, only the script is run, and the link href is not navigated to. If you omit this step, the user may see two installation dialogs--since you've effectively invoked two install requests, one from the InstallTrigger, one from trying to load the XPI file directly. Available Parameters for the install object The InstallTrigger.install method accepts a JavaScript object as a parameter, with several properties on that object used to affect the install. URL The URL property specifies the URL of the XPI to install. This property is required. IconURL The IconURL property specifies an icon to be displayed in the installation dialog. This property is optional. If you do not specify an icon, the default icon will be used, usually a green puzzle piece. The icon can be any image format supported by Firefox...
Interaction between privileged and non-privileged pages - Archive of obsolete content
back({quux: 4}); }, 3000); } if (request.mozilla) { return alert("alert in chrome"); } return callback(null); } } something.listen_request(something.callback); Message Passing in Chromium Sending structured data The above mechanisms use element attributes and are thus only strings. You may want to transfer objects. Gecko prevents chrome to access custom object properties added by the content, because that can create security holes. A workaround is to treat the communication between webpage and chrome as a normal network protocol and use XML. With element attributes and E4X, this is fairly easy. You do need to convert your data to/from E4X objects, though. And your chrome needs to carefully check every value passed (you need to do that either way). var targetDoc...
Multiple item extension packaging - Archive of obsolete content
t to determine if this is a Multiple Item Package and then start the installation of the individual packages it contains automatically. No other files besides the install.rdf Install Manifest and the files with a jar and xpi file extension will be extracted or utilized. install.rdf A multiple item package does not have the same requirements as an extension for its install.rdf. The only required properties are em:id, em:targetApplication, and em:type. For the Firefox and Thunderbird 1.5 Extension Manager to determine that the package is a multiple item package, the em:type specified in your install.rdf must be 32 and specified as <em:type NC:parseType="Integer">32</em:type>. The XML namespace xmlns:NC="http://home.netscape.com/NC-rdf#" must also be declared in your install.rdf as shown below. ...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
nd files. Let's see what happens when we pass true to delete all the contents of a folder. Listing 7: Check that file exists, delete it, and create it file.initWithPath('C:\\temp\\temp.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...
Adding sidebars - Archive of obsolete content
ack. 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 remains simple. A stack is like a deck, except that all of its chi...
Getting Started with Firefox Extensions - Archive of obsolete content
e file extension from xpi to zip, or open the file directly, then unzip it, using a ZIP tool. You should see the following directory structure: xulschoolhello1 chrome.manifest install.rdf content browserOverlay.xul browserOverlay.js skin browserOverlay.css locale en-US browserOverlay.dtd browserOverlay.properties That's lots of files for something so simple! In the next section, we'll inspect these files and see what they do. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Local Storage - Archive of obsolete content
l log.txt somedbfile.sqlite The Directory Service and the nsIFile interface are used to create the local directory. Here's what we usually do: we have a function that returns a reference to our root directory and creates it if necessary. getLocalDirectory : function() { let directoryService = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); // this is a reference to the profile dir (ProfD) now. let localDir = directoryService.get("ProfD", Ci.nsIFile); localDir.append("XULSchool"); if (!localDir.exists() || !localDir.isDirectory()) { // read and write permissions to owner and group, read-only for others. localDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0774); } return localDir; }, ProfD is a special identifier fo...
Observer Notifications - Archive of obsolete content
}, false); In the observe method the notification topic is verified because you can have one observer listening to several topics. You may notice that we explicitly set the interface of the aSubject object to nsISupportsString using the QueryInterface method. This is because the first parameter of the observe method is typed as nsISupports (the generic interface, as seen before), therefore its properties and methods cannot be accessed unless the correct interface is set to it. When the notifyTest method is called, all observers registered with xulschoolhello-test-topic will get notified and display two alerts. If there are 2 Firefox windows open, the observer will be notified in both and the alerts will show up on both. You can always listen for multiple notification topics using the same obser...
Security best practices in extensions - Archive of obsolete content
user's disk and other local devices. There are ways to get around the content/chrome security barrier, if for example, you want a web page to send a notification to the add-on (or vice versa). One way to do this is to use custom DOM events; see Interaction between privileged and non-privileged pages. Regardless of where the document comes from, you can further restrict what it can do by applying properties to the document holder, known as the docshell. frame.docShell.allowImages = false; frame.docShell.allowJavascript = false; frame.docShell.allowPlugins = false; There are more examples listed in the document listed above in this section. In certain circumstances you may want to run code in your extension, but you would like to give it restricted privileges. One of the best ways to do this is t...
Setting up an extension development environment - Archive of obsolete content
However, it is usually easier to place extension files in a temporary location, which also protects source files from accidental deletion. This section explains ho...
Signing an XPI - Archive of obsolete content
te: http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. For Windows you'll want the nspr-4.6.zip package in the v4.6/WINNT5.0_OPT.OBJ/ folder. 2. Extract the contents of the archive file to a local folder. In my case it's C:\Apps\nspr-4.6\ Add path Add the NSS tools bin/ and lib/, and the NSPR lib/ directories to the system path. You can either set this permanently via Control Panel->System Properties->Advanced->Environment Variables->System Variables or do it each time you run the tools from the command-line (preferably using a batch file). Windows contains its own version of some of these files (e.g. certutil.exe) in the system directory (\Windows\system32\) so ensure the new paths are first in the PATH search list. C:\> set PATH=C:\Apps\nss-3.11.4\bin\;C:\Apps\nss-3.11.4\lib\;C:\Apps\nspr-...
Updating addons broken by private browsing changes - Archive of obsolete content
None of the ones listed above will be sent as of Firefox 20. The supporting per-window private browsing article explains further about the equivalent notifications, which are all backwards compatible through to Firefox 12 (and are sent side-by-side with the global private browsing notifications in older versions). Chrome APIs OpenBrowserWindow: Takes an optional parameter to indicate desired properties of the window. Passing {private: true} will cause a private window to open, otherwise the window will always be non-private. Use {private: PrivateBrowsingUtils.isWindowPrivate(window)} to open a window that matches the current window's privacy status. openLinkIn: Can receive an extra private boolean property in the parameter object. internalSave: Takes a new required Document argument (prio...
Search Extension Tutorial (Draft) - Archive of obsolete content
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 below: // This is a localizable preference, so it must contain a URL which // points at a properties file containing 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 p...
Creating reusable content with CSS and XBL - Archive of obsolete content
e. Another structural limitation concerns content. You can use CSS to provide content for selected elements, but the content is limited to text and images, and its positioning is limited to before or after the selected element. Mozilla provides a mechanism that overcomes these limitations: XBL (XML Bindings Language). You can use XBL to link selected elements to their own: Stylesheets Content Properties and methods Event handlers Because you avoid linking everything at the document level, you can make self-contained parts that are easy to maintain and reuse. More details For more information about XBL bindings, see the XBL page in this wiki. Action: An XBL demonstration Make a new HTML document, doc6.html. Copy and paste the content from here: <!DOCTYPE HTML PUBLIC "-//W3C...
Creating a status bar extension - Archive of obsolete content
aster/gatekeeper/there.is.only.xul"> Once that's accomplished, we can describe our user interface. In this case, we're simply inserting a new panel into the status bar at the bottom of Firefox browser windows. We do this by embedding inside the statusbar named "status-bar" -- which is the Firefox browser window's status bar -- a new statusbarpanel object we call "status-bar-sample-1". We include properties to configure our new status bar panel the way we want, setting its text label to "Hello World" and establishing a tool tip with the message "Sample status bar item" in it. Trying it out To test your extension, drop the folder into the extensions folder in your Profile Folder. Then restart Firefox, and you should see the extension in the status bar. Next >> ...
MozAudioAvailable - Archive of obsolete content
type Read only DOMString The type of event. ...
MozBeforeResize - Archive of obsolete content
The MozBeforeResize event is executed before a browser window is resized. General info Specification Mozilla specific Interface Event Bubbles No Cancelable No Target window 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
cached - Archive of obsolete content
Read Only. ...
chargingtimechange - Archive of obsolete content
The chargingtimechange event is fired when the chargingTime attribute of the battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.chargingTime double (float) The remaining time in seconds until the system's battery is fully charged. Returns 0 if the battery is fully charged. Returns positive infinity, if the battery is discharging or if the implementation is unable to report the remaining charging time. Read only. Example navigator.getBatt...
checking - Archive of obsolete content
Read Only. ...
dischargingtimechange - Archive of obsolete content
The dischargingtimechange event is fired when the dischargingTime attribute of the battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.dischargingTime double (float) the remaining time in seconds until the system's battery is completely discharged and the system is about to be suspended. Returns positive infinity if the battery is charging, if the implementation is unable to report the remaining discharging time, or if there is no battery attache...
downloading - Archive of obsolete content
The downloading event is fired after checking for an application cache update, if the user agent has found an update and is fetching it, or is downloading the resources listed by the cache manifest for the first time. General info Specification Offline Interface Event Bubbles No Cancelable No Target applicationCache Default Action None Properties Property Type Description target EventTarget (DOM element) The event target (the topmost target in the DOM tree). Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. cancelable boolean Is it possible to cancel the event? Read only. Related Events checking noupdate progress cached upd...
error - Archive of obsolete content
Read Only. type string The type of event. ...
noupdate - Archive of obsolete content
Read Only. type string The type of event. Read only. ...
obsolete - Archive of obsolete content
Read Only. ...
progress - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
updateready - Archive of obsolete content
The updateready event is fired when the resources listed in the application cache manifest have been newly redownloaded, and the script can use swapCache() to switch to the new cache. General info Specification Offline Interface Event Bubbles No Cancelable No Target applicationCache Default Action None Properties Property Type Description target EventTarget (DOM element) The event target (the topmost target in the DOM tree). Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. cancelable boolean Is it possible to cancel the event? Read only. Related Events checking noupdate downloading progress cached updateready obsolete e...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
ttp://mit.edu/~firefox/www/maintain...utoconfig.html. For history, I've kept Mozilla and Netscape chapters, as certain points are complementary to the web-based AutoConfig file. This MCD (aka autoconfig here), is not to be confused with https://wiki.mozilla.org/Thunderbird...oconfiguration . It's Mission is to enable completely automatic configuration of mozilla's apps preferences based on users properties either retrieved from system environement variables or on an organisation ldap directory. Situation INT-Evry manages about 3000 users (mostly students) who share computers in labs and "self service" computer rooms. Hence a single computer might connect many different users all day long. Computers are dual-boot (Windows 7 and Linux Fedora 19 by 2013). All users have a personal account on a Windo...
Dehydra - Archive of obsolete content
Treehydra, a heavy-duty static analysis GCC plugin. Documentation Installing Dehydra Download, installation and dependency info for Dehydra Using Dehydra Examples for getting started writing analysis scripts. Dehydra Function Reference Callback and utility functions for Dehydra scripts. Dehydra Object Reference Javascript objects and properties provided by Dehydra. Dehydra FAQ Answers to common questions Static Analyses Analyses being worked on for Mozilla 2 TODO Steps to Dehydra 1.0 release Community View Dehydra Forums... Mailing list Newsgroup RSS feed #static on irc.mozilla.org Blogs Taras Glek David Mandel...
Drag and Drop - Archive of obsolete content
LINK A link (or shortcut or alias) to the item being dragged should be created in the dropped location. The interface nsIDragService also provides the function getCurrentSession which can be called from within the drag event handlers to get and modify 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...
Fast Graphics Performance With HTML - Archive of obsolete content
style="position:fixed">Simple</div>lots of text...</div> Make the content of scrollable sub frames opaque e.g. use <div style="overflow:scroll><div style="background:white"><p>This is some text</p><p>And some more</p></div></div> instead of <div style="overflow:scroll><p>This is some text</p><p>And some more</p></div> Animating 'transform' and 'opacity' properties can be done with the compositor which makes them efficient to animate ...
Documentation for BiDi Mozilla - Archive of obsolete content
e dir=rtl, either explicitly (nsGenericHTMLElement::MapCommonAttributesInto), or as a consequence of a style rule (MapDeclarationTextInto in nsCSSStyleRule.cpp) All these cases use nsDocument::EnableBidi to set the flag mBidiEnabled. In a Bidi-enabled document, the following things happen: During a reflow, nsBidiPresUtils::Resolve is called. This method uses the UBA to determine the directional properties of the text and reorder frames if necessary. If necessary, text frames are split so that every frame has the same directionality. FrameManager::SetFrameProperty is used to set the following flags and pointers (for terminology see the specification of the UBA): embeddingLevel: the embedding level of the frame textClass: the text class of the frame. baseLevel: the base level (direction) of the pa...
JavaScript Client API - Archive of obsolete content
s 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: "Record.Foo", ttl: FOO_TTL, // optional get bar() this.cleartext.bar, set bar(value) { this.cleartext.bar = value; }, get baz() this.cleartext.
GRE - Archive of obsolete content
st the proper libraries. If you link directly against xpcom.dll/libxpcom.so (xpcom.lib import lib), your application will not launch unless xpcom.dll is in your PATH. This prevents dynamically finding a compatible GRE at runtime. Find a compatible GRE Note: Support for locating a standalone glue was removed in Gecko 6.0. To find a compatible GRE, you should use the function GRE_GetGREPathWithProperties() (declared in xpcom/glue/standalone/nsXPCOMGlue.h). This allows the embedder to specify what version(s) of GRE are appropriate, and to specify any special features the GRE must have (currently there are no special features defined). Statically link to xpcomglue.lib (the "standalone glue") The solution is to statically link against xpcomglue.lib, also known as the "standalone glue" (see XPCOM G...
JavaScript OS.Shared - Archive of obsolete content
Module OS.Shared contains tools to interact with the operating system (and, more generally, in C) in JavaScript. All these tools are designed to be used with js-ctypes. For the moment, module OS.Shared is accessible only from chrome workers. ...
Settings - Archive of obsolete content
] }, { name: "music", type: "boolean", label: "Music", default: true }, { name: "volume", type: "range", label: "Volume", min: 0, max: 10, default: 5 } ] }; // Import after defining manifest! jetpack.future.import("storage.settings"); This definition will result in a user interface with an input field for each setting defined above. ...
Jetpack Snippets - Archive of obsolete content
ack.slideBar.append({ onReady: function (slide) { // call out to a global function, passing the slidebar object exInitSlidebar(slide); }, ...});function exInitSlidebar(aSlidebar) { // This variable will now be global slider = aSlidebar;} // then, accessing the slidebar HTMLvar tl = slider.contentDocument.getElementById("thumbList"); // or calling slidebar API methods or accessing propertiesslider.notify(); ...
Settings - Archive of obsolete content
] }, { name: "music", type: "boolean", label: "Music", default: true }, { name: "volume", type: "range", label: "Volume", min: 0, max: 10, default: 5 } ] }; // Import after defining manifest! ...
Simple Storage - Archive of obsolete content
or what we're up to next! The jetpack.storage.simple namespace provides an easy way to persist data across browser restarts. It's a simple key-based persistent object data store. Simple storage is really simple. jetpack.storage.simple is a single, persistent JavaScript object private to each jetpack. For the most part this object is like any other JavaScript object, and a jetpack can set whatever properties it wants on it. To manipulate its persistent data, a jetpack therefore need only use the various standard JavaScript functions and operators. The jetpack.simple.storage object is automatically and periodically flushed to disk. How and when it is flushed is an implementation detail. Jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). The object can also be forced to ...
Simple Storage - Archive of obsolete content
The jetpack.storage.simple namespace provides an easy way to persist data across browser restarts. It's a simple key-based persistent object data store. Simple storage is really simple. jetpack.storage.simple is a single, persistent JavaScript object private to each jetpack. For the most part this object is like any other JavaScript object, and a jetpack can set whatever properties it wants on it. To manipulate its persistent data, a jetpack therefore need only use the various standard JavaScript functions and operators. The jetpack.simple.storage object is automatically and periodically flushed to disk. How and when it is flushed is an implementation detail. Jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). The object can also be forced to reload its data fr...
Plug-n-Hack Phase1 - Archive of obsolete content
ch defines the capabilities that the browser can make use of. It is up to the tool authors to decide how the URL of the manifest is published. The tool configures itself by serving an HTML document (we'll call this the Configuration Document) to the browser. This can cause the browser to inspect the manifest and register the tool by firing a CustomEvent with the type ConfigureSecTool and a properties object which specifies the URL of the tool manifest. For example: var manifest = {"detail":{"url":"http://localhost:8080/manifest"}}; var evt = new CustomEvent('ConfigureSecTool', manifest); It is suggested that browsers wishing to support PnH restrict handling of CustomEvents such that they're ignored where the event happens outside of user initiated actions. The Configuration Document shou...
RDF Datasource How-To - Archive of obsolete content
nd "spammer128@hotmail.com is considered an 'important friend'." Statements from one datasource can be combined with statements from another datasource using a composite datasource. By combining statements from the IMAP datasource and address book datasource, above, we'd be able to identify the sender of "message 126" as an "important friend". Deciding on a vocabulary The vocabulary is the set of properties that you will use to express relationships between elements (resources and literals) in your data model. The first question that you must answer is "should I use an existing vocabulary, or invent my own?" A reasonable answer is, "use an existing vocabulary unless you absolutely must invent your own." This will allow your datasource to be integrated with other datasources with a minimum of effort.
Venkman Internals - Archive of obsolete content
er per url (web page). This method is set into jsdIScriptHook.onScriptCreated venkman-views.js Views are the panels shown within the venkman window. For example, the "Open Windows" view shows the browser's windows. venkman-records.js A "record" seems to be data underlying a view. For example, FrameRecord represents a JavaScript stack frame. venkman-msg.js Localization code, reads venkman.properties from a subdirectory of "locale" and injects variables. Things like msg.alert define variables MSG_ALERT. venkman-utils.js Defines the dd debug dump and friends WindowRecord Representation of the open windows. FileContainerRecord - List of script tags found in the parent record's window.document property. To obtain the antecedent files: doc.getElementsByTagName("script"); then extract th...
Using Breakpoints in Venkman - Archive of obsolete content
ture breakpoint, which is represented by a yellow letter "F". A second click will remove the future breakpoint as well. Advanced Breakpoints Venkman allows you to associate a breakpoint with a script that will be executed in the scope of the function when that breakpoint is hit. This advanced feature and other options you can see for the associated script are available from the Future Breakpoint Properties dialog, which you can access by right-clicking a breakpoint and selecting Properties. Once you've created a script that will be executed when the associated breakpoint is hit, you can select a number of different options from the Future Breakpoint Properties dialog that determine how Venkman will deal with the output of the associated script. The following options are available: Continue rega...
Anonymous Content - Archive of obsolete content
ents. As far as CSS is concerned, anonymous content nodes are children (or descendants) of the bound element, they are ancestors of explicit content, and they are siblings of the explicit content. Style rules using the child, descendant, or sibling selectors transparently cross bind scopes and operate on the altered and original content models. The final modified content tree determines how CSS properties (e.g., fonts and colors) are inherited. An element either ends up underneath its explicit parent (just as in the content model), or it ends up being nested through a series of insertion points. When nested, it inherits from the innermost anonymous parent. Binding stylesheets A binding file can load stylesheets using the stylesheet element. By default these stylesheets apply to the bound element...
Event Handlers - Archive of obsolete content
authors in the bound document to write events that potentially suppress the default actions taken by the XBL handlers. Within an XBL inheritance chain, event handlers always fire first on the derived binding and then on the base binding in the chain. A derived handler then has a way of preventing the event from flowing to its base binding handlers. Mouse and key handlers have certain additional properties that are supported by XBL. Additional attributes can be used to impose a filter on the event handler. When a filter is imposed, additional conditions must be met before the event handler will fire. For both mouse and key events, modifier keys can be specified using the modifiers attribute. This attribute is a comma-separated list of modifier keys that must be down at the time the key or mouse ev...
Example Sticky Notes - Archive of obsolete content
/** * 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 st = this.innerHTML || ''; if (st != '') { var re = /<\/?[^>]+>/gi; return st.replace(re,''); } else { return ''; } ]]></getter> <setter><![CDATA[ // "val" in setter contains the assignment value. // ...
Methods - Archive of obsolete content
File method. getLastError Returns the most recent non-zero error code. getWinProfile Constructs an object for working with a Windows .ini file. getWinRegistry Constructs an object for working with the Windows Registry. initInstall Initializes installation for the given software and version. loadResources Returns an object whose properties are localized strings loaded from the specified property file. logComment Add a comment line to the install log. patch Applies a set of differences between two versions. performInstall Finalizes the installation of the software. refreshPlugins Refreshes the list of plug-ins registered for the browser. registerChrome Registers c...
XPInstall - Archive of obsolete content
st 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. <?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> Cross-Platform Install (XPInstall) is a technology used by Mozilla Application Suite, Mozilla Firefox, Mozilla Thunderbird and other XUL-based applications for installing extensions. An XPI (pronounced "zippy" and derived from XPInstall) installer module is a ZIP file that contains an install script or manifest (entitled install.js or install.rdf) at the root of the ...
containment - Archive of obsolete content
<< XUL Reference home containment Type: URI This attribute specifies RDF properties (an RDF predicate) that indicate that a resource is a container. When generating content from a template this is used to determine which resources from the datasource are containers and thus can have child nodes and which ones are not containers. This attribute should be placed on the same element that the datasources and the ref attribute is on. It may be set to a space-separated list of RDF properties or resources. ...
equalsize - Archive of obsolete content
equal in size. 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. never All of the children are displayed at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. ...
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. ...
ordinal - Archive of obsolete content
...
Attribute (XUL) - Archive of obsolete content
ing onpopupshown onsearchcomplete onselect ontextcommand ontextentered ontextrevert ontextreverted onunload onwizardback onwizardcancel onwizardfinish onwizardnext open ordinal orient pack pageid pageincrement pagestep parent parsetype persist persistence phase pickertooltiptext placeholder popup position predicate preference preference-editable primary priority properties querytype readonly ref rel removeelement resizeafter resizebefore rows screenX screenY searchbutton searchSessions searchlabel selected selectedIndex seltype setfocus showcaret showCommentColumn showpopup size sizemode sizetopopup smoothscroll sort sortActive sortDirection sortResource sortResource2 spellcheck src state statedatasource statusbar statustext styl...
Building accessible custom components in XUL - Archive of obsolete content
round within the control. We want to do the same thing with our spreadsheet control. Events in XUL are similar to events in HTML documents. You can register event handlers on specific XUL elements, and when an event occurs, it bubbles down the element hierarchy and back up. You can capture events on the way down or on the way up, and registered event handlers get an event object which has all the properties you would expect for that event. To make a long story short, this means that we can register a single event handler on the spreadsheet itself (technically, the grid element), then check <var>e.target.tagName</var> to see which element actually received the event. There is no need to register event handlers on every single cell within the spreadsheet. There is one small implementation issue, which...
CheckboxStateChange - Archive of obsolete content
The CheckboxStateChange event is executed when the state of a <checkbox> element has changed. 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. bubbles Read only boolean Does the event normally bubble? cancelable Read only boolean Is it possible to cancel the event? Related events ValueChange RadioStateChange ...
DOMMenuItemActive - Archive of obsolete content
The DOMMenuItemActive event is executed when a <menu> or a <menuitem> has been hovered or highlighted. 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
DOMMenuItemInactive - Archive of obsolete content
The DOMMenuItemInactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted. 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
RadioStateChange - Archive of obsolete content
The RadioStateChange event is executed when the state of a <radio> element has changed. 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. bubbles Read only boolean Does the event normally bubble? cancelable Read only boolean Is it possible to cancel the event? Related events CheckboxStateChange ValueChange ...
ValueChange - Archive of obsolete content
The ValueChange event is executed when the value of an element, <progress> for example, has changed. 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. bubbles Read only boolean Does the event normally bubble? cancelable Read only boolean Is it possible to cancel the event? Related events CheckboxStateChange RadioStateChange ...
broadcast - Archive of obsolete content
The broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed. The event handler should be placed on an observer. General info Specification XUL Interface Event Bubbles No Cancelable No 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
close - Archive of obsolete content
w element, it can be prevented to close (see example below). Note that the close event is only fired when the user presses the close button on the titlebar; (i.e. not File -> Quit). The unload event should be used to capture all attempts to unload the window. General info Specification XUL Interface Event Bubbles No Cancelable No Target window Default Action The window is closed. 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 Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. Example window...
command - Archive of obsolete content
Archive › Mozilla › XUL › Events › command
cting them with the mouse or by pressing a shortcut key. Command elements can be activated by any of their observing elements being activated. The command event should always be used instead of the click event because it will be called in all of the needed cases. General info Specification XUL Interface XULCommandEvent 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. bubbles Read only Boolean Whether the event normally bubbles or not cancelable Read only Boolean Whether the event is cancellable or not? view Read only...
commandupdate - Archive of obsolete content
The commandupdate event is executed when a command update occurs on a <commandset>. This event would be used to update the disabled status of its commands. General info Specification XUL Interface Event Bubbles No Cancelable No 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
popuphidden - Archive of obsolete content
The popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden. General info Specification XUL Interface PopupEvent 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
popuphiding - Archive of obsolete content
The popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden. General info Specification XUL Interface PopupEvent 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
popupshowing - Archive of obsolete content
The 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. General info Specification XUL Interface PopupEvent Bubbles Yes Cancelable Yes Target element Default Action A popup is displayed 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 Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
popupshown - Archive of obsolete content
The popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible. General info Specification XUL Interface PopupEvent 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. ...
XUL Events - Archive of obsolete content
ent 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 This event is sent when a node is remove...
Menus - Archive of obsolete content
ll Selects all context-searchselect Selected text is searched context-viewpartialsource-selection Views the selection source Selection context-viewpartialsource-mathml Views the MathML source MathML context-viewsource Views the source context-viewinfo Views the page info context-metadata Views the properties context-spell-check-enabled Spell check enabled checkbox context-inspect Inspects the element ...
loadTabs - Archive of obsolete content
<< XUL Reference home loadTabs( uris, loadInBackground, replace ) loadTabs( uris, params ) Return type: no return value Loads a set of URIs, specified by the array uris, into tabs. ...
showPopup - Archive of obsolete content
esponds to the popupanchor attribute on the element. The align argument corresponds to the popupalign attribute on the element. The anchor and align arguments are ignored if either x or y are not -1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently. ...
ContextMenus - Archive of obsolete content
ext menu in bold. What constitutes the default item isn't specified, but is usually the operation carried out when the item was left-clicked or pressed normally, as opposed to context clicked. You can indicate this item, if it applies, using the default attribute. <menupopup id="link-menu"> <menuitem label="Open Link" default="true"/> <menuitem label="Open In New Window"/> <menuitem label="Properties"/> </menupopup> The default attribute has been set to true on the first menu item ('Open Link'). On platforms that support it, it will be marked as a default item. On other platforms, the attribute will just be ignored and the menuitem will be displayed normally. Naturally, it only makes sense to have one default item per context menu. Note that the default attribute just affects how the item ...
Floating Panels - Archive of obsolete content
ill always appear above the main window. On Mac, floating panels are invisible when another application is made active, and become visible again when the XUL application is made active. A floating panel may contain any type of element. A label for the titlebar may be set using the label attribute, as in the following example: <panel id="info-panel" noautohide="true" titlebar="normal" label="Image Properties"> Closing a Floating Panel Unlike other panels, a floating panel does not close when clicking outside of it. You can use the close attribute to have a close button on the titlebar. When the user presses it, the popup will be closed. <panel id="info-panel" noautohide="true" titlebar="normal" label="Image Properties" close="true"> The hidePopup method may be used to manually close a popup. See Cl...
MenuItems - Archive of obsolete content
d state of the command is changed, the menuitem updates accordingly. This is an advantage when attaching several menuitems or buttons to the same command, as the disabled state can be adjusted once for the command, and this will propagate to all elements attached to it. Modifying a menuitem Both the label and the access key may be changed dynamically in script by setting the label and accesskey properties. Note the mixed case of the accessKey property versus the lowercase usage of the accesskey attribute in XUL. For instance, you might want to change the label of an Undo menuitem based on what would be undone. The example below demonstrates this. if (gUndoBufferType == "typing") menuitem.label = "Undo Typing"; else if (gUndoBufferType == "paste") menuitem.label = "Undo Paste"; else menuite...
Popup Guide - Archive of obsolete content
ls temporarily over the existing UI. For example, a popup search field could be used to allow searching and will disappear when a search term has been entered. A panel is created using the panel element. Floating Panels A floating popup is a type of panel with a titlebar and acts like an auxiliary window. Usually it would contain tools related to the main window, or an inspector which displays properties of a selected element. Tooltips When the mouse is positioned over a UI control, a tooltip provides a small box with descriptive help about that control. When the mouse is moved away from the control, the tooltip automatically disappears. A tooltip can be created by setting the tooltiptext attribute on an element or by using the tooltip element. Working with Popups The following additional i...
documentCharsetInfo - Archive of obsolete content
...
Property - Archive of obsolete content
tyle 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:element.children DOM:element.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:ele...
Additional Navigation - Archive of obsolete content
ith the value of the ?start variable. The RDF graph is examined for an arrow pointing in to the node instead of out. In the photos example, we might wish to categorize each photo into several categories. One possibility is to just add another predicate for each photo with a literal value set to the category. Or, we could use a resource for each category. This will allow us to associate additional properties to each category and more easily navigate the graph in a template. In this case, we will categorize each photo by country where the photo was taken using a country predicate. <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:r="http://www.xulplanet.com/rdf/"> <rdf:Seq rdf:about="http://www...
Attribute Substitution - Archive of obsolete content
he caret is considered a separator between variables, however it will not appear in the output. It can also be used to separate a variable with normal text: <label value="?name" class="?gender^german"/> These last two examples have been setting the class attribute on a label. The effect will be that a label will have either the 'malegerman' or 'femalegerman' class. In a stylesheet, you could set properties for each of these classes such that different values appear differently without having to use multiple rules. Although not common, you may also wish to insert a question mark or caret into an attribute value. To do this, just use two question marks or two carets in a row. For instance: <label value="What is my name?? My name is ?name"/> In this example, the label might be 'What is my name? My na...
Building Hierarchical Trees - Archive of obsolete content
splayed in the tree. Similarly, when the user closes a tree row, the 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 f...
Multiple Rule Example - Archive of obsolete content
redicate="http://purl.org/dc/elements/1.1/title" object="?phototitle"/> </conditions> <action> <vbox uri="?photo" class="box-padded"> <label value="?phototitle"/> <image src="?photo"/> </vbox> </action> </rule> </template> </vbox> In this example, the first rule matches only those photos with title, description, and date properties. 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 properties to match the first rule. The second photo has a title and date but no description, while the third photo has only a title. The first photo will match both rules whereas the other two photos will match only the...
SQLite Templates - Archive of obsolete content
Finally, we rebuild the entire template. << PreviousNext >> ...
Template Guide - Archive of obsolete content
Basics of XUL Templates Introduction Rule Compilation RDF Template Syntax Result Generation RDF Query Syntax Actions Recursive Generation Simple Example Bindings Additional Navigation Filtering Static Content Simple Query Syntax Containment Properties XML Template Syntax XML Templates XML Assignments SQL Template Syntax SQLite Templates Common Template Syntax Attribute Substitution Multiple Rules Using Recursive Templates Building Menus With Templates Special Condition Tests Multiple Queries Using Multiple Queries to Generate More Results Building Trees with Templates Building Trees Building Hierarchical Trees Template Modifications Template Builder Interface Template and Tree Listeners RDF Modifications Additional Topics Sorting Res...
Things I've tried to do with XUL - Archive of obsolete content
happily split the space out according to flex, ignoring the contents of each box, as desired. From my reading of the code, just height="0" should work, but it doesn't seem to. This trick doesn't work in 1.4, but works in 1.7 and current versions. Obtaining the rect of an element You can't obtain the actual visible rect of an element. HTML elements have the non-standard clientWidth/clientHeight properties (see http://www.mozilla.org/docs/dom/domr...entHeight.html); no equivalent exists for XUL. Enn: most people would use the box object width and height properties, or do you want something else? Vlad: the boxObject width/height are the actual width and height of the box, regardless of the actual visible portion of the box (clipped by the window borders, for example). This is assuming no scrolling i...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
key, see: Installation directory If you cannot easily find the directory, you can use the following method to find it. From SeaMonkey's menu bar, choose Tools - Web Development - JavaScript Console. Copy the following code. It is one very long line ending in path--make sure that you get all of it: Components.classes["@mozilla.org/file/directory_service;1"].getService( Components.interfaces.nsIProperties).get("AChrom", Components.interfaces.nsIFile).path In the JavaScript Console window, paste the code in the field near the top. Presss the Return or Enter key, or the Evaluate button. The console displays the location of SeaMonkey's chrome directory. Explanation: The chrome directory contains program files that are part of SeaMonkey itself, together with other files that are provided by exten...
Tree Widget Changes - Archive of obsolete content
() takes a row index and a nsITreeColumn as arguments, whereas before it took a row index and a column id. ...
Accesskey display rules - Archive of obsolete content
rted 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 a way for specifying accesskeys which are independent from their labels. Note that using '&' in label text is bad way. Because Japanese localizers "&Cancel" need to localize to "?????(&C)". This label will be displayed as "?????(C)(C)" on the localized build. So, "(C)" will be doubled. For this issue, we recommend the following format if you use .proper...
Adding Buttons - Archive of obsolete content
thing in it, so it isn't very interesting yet. In this section, we will add two buttons, a Find button and a Cancel button. We will also learn a simple way to position them on the window. Like HTML, XUL has a number of tags that can be used to create user interface elements. The most basic of these is the button tag. This element is used to create simple buttons. The button element has two main properties associated with it, a label and an image. You need one or the other or both. Thus, a button can have a label only, an image only or both a label and an image. Buttons are commonly used for the OK and Cancel buttons in a dialog, for example. Syntax of buttons The button tag has the following syntax: <button id="identifier" class="dialog" label="OK" image="images/image.jpg" d...
Adding Event Handlers - Archive of obsolete content
nts are triggered only by certain elements. Each event has a name, for example, 'mousemove' is the name of the event that is triggered when the user moves the mouse over a UI element. XUL uses the same event mechanism as defined by DOM Events. When an action occurs that would trigger an event, such as the user moving the mouse, an event object is created corresponding to that event type. Various properties are set on the event object such as the mouse position, the key that was pressed, and so forth. The event is then sent to the XUL in phases. In the capturing phase, the event is first sent to the window, then to the document, followed by each ancestor of the XUL element where the event occured downwards until it reaches that element. In the target phase, the event is sent to the target XUL e...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
e" action="script"/> </handlers> </binding> Place all of your handlers within the handlers element. Each handler element defines the action taken for a particular event specified by its event attribute. Valid event types are those supported by XUL and JavaScript, such as click and focus. Use the event name without the 'on' in front of it. A common reason to set handlers is to modify the custom properties when an event occurs. For example, a custom checkbox might have a checked property which needs to be changed when the user clicks the checkbox: <handlers> <handler event="mouseup" action="this.checked=!this.checked"/> </handlers> When the user clicks and releases the mouse button over the check box, the mouseup event is sent to it, and the handler defined here is called, causing the state of t...
Anonymous Content - Archive of obsolete content
rom a binding definition declared in an XBL file. The second scroll bar has its own content so it will use that instead of the XBL content, resulting in something that isn't much of a scroll bar at all. Note that the built-in elements such as scroll bars get their XBL from the files in the bindings directory in the toolkit package. This only applies to the elements defined within the content tag. Properties, methods and other aspects of XBL are still available whether the content is from XBL or whether the XUL provides its own content. Using the Children Element There may be times when you want both the XBL content and the content provided by the XUL file to be displayed. You can do this by using the children element. The children added in the XUL are added in place of the children element. This is ...
Box Model Details - Archive of obsolete content
We've added them to buttons and textboxes, but we can also add them to spacers or boxes. In addition, the flex attribute can be applied to any element. ...
Creating a Skin - Archive of obsolete content
look at this image (btn1.gif), you will notice that it contains a grid of smaller images, each one 16 by 16 pixels. The -moz-box-orient property is used to orient the button vertically, so that the image appears above the label. This property has the same meaning as the orient attribute. This is convenient because the skin cannot change the XUL. Most of the box attributes have corresponding CSS properties. Other Changes Next, we'll make a couple of changes to the buttons along the bottom, again reusing some icons from Mozilla to save time. If creating your own skin, you will need to create new icons or copy the icons to new files. If following the example in this section, just copy the files to your new skin and change the URLs accordingly. #find-button { list-style-image: url("chrome://globa...
Focus and Selection - Archive of obsolete content
error would occur. If you use the same value for both parameters, the start and end of the selection changes to the same position. This results in changing the cursor position within the textbox. For example, the line below can be used to move the cursor to the beginning of the text. tbox.setSelectionRange(0,0); You can retrieve the current selection by using the selectionStart and selectionEnd properties. These properties are set to the starting and ending positions of the current selection respectively. If both are set to the same value no text is selected, and the cursor is moved to that position. Once you have the start and end positions, you can pull out the substring from the whole text. You can retrieve and modify the contents of the textbox by using the value property. One additional usefu...
Keyboard Shortcuts - Archive of obsolete content
lement that has the focus. Typically, this will include textboxes, buttons, checkboxes and so forth. If no element is focused, the key event will instead be targeted at the XUL document itself. In this case, you can add an event listener to the window tag. Normally though, if you want to respond to keys globally, you will use a keyboard shortcut as described earlier. The key event object has two properties which hold the key that was pressed. The keyCode property holds the key code and may be compared to one of the constants from the key table earlier in this section. The charCode is used for printable characters and will hold the numeric Unicode character code value for the key that was pressed. Our Find files example so far : Source View Next, we'll find out how to handle focus and the selectio...
More Wizards - Archive of obsolete content
); } </script> <wizardpage onpageshow="checkCode(); return true;"> <label value="Enter the secret code:"/> <textbox id="secretCode" onkeyup="checkCode();"/> </wizardpage> <wizardpage> <label value="That is the correct secret code."/> </wizardpage> </wizard> There is also a corresponding canRewind property that you can use to enable or disable the Back button. Both properties are adjusted automatically as you switch pages. Thus, the Back button will be disabled on the first page so you don't have to set it yourself. Another useful property of the wizard is currentPage, which holds a reference to the currently displayed wizardpage. You can also modify the current page by changing this property. If you do change it, the various page change events will still be fired. ...
Splitters - Archive of obsolete content
ze. This image shows the 4 panels with the splitter in a collapsed state. This image shows the 4 panels with the splitter resized to the right. Notice how the middle two panels have not changed size. Only panel 1 and panel 4 have changed size. You can just see part of the fourth panel. If you continue to drag the splitter to the right, the other two panels will shrink. You can use the style properties such as min-width, max-height on the iframes to specify minimum or maximum widths or heights in the box. If you do, the splitter will detect this and not allow the user to drag the splitter past the minimum and maximum sizes. For example, if you specified a minimum width of 30 pixels on panel 4 above, it would not shrink below that size. The other two panels would have to shrink. If you set the ...
Stack Positioning - Archive of obsolete content
t, including boxes and other stacks. The size of a stack is determined by the 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 ...
The Box Model - Archive of obsolete content
XUL element layout, it follows a few very simple rules. A box can lay out its children in one of two orientations, either horizontally or vertically. A horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. You can think of a box as one row or one column from an HTML table. Various attributes placed on the child elements in addition to some CSS style properties control the exact position and size of the children. Box elements The basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox> <!-- vertical elements --> </vbox> The hbox element is used to create a horizontally oriented box. Each element placed in the hbox will be placed horizontally in a row. The vbox element is used to create a vertically oriented box. Adde...
XBL Attribute Inheritance - Archive of obsolete content
<< PreviousNext >> ...
XBL Inheritance - Archive of obsolete content
ting XBL definitions. Inheritance Sometimes you may want to create an XBL widget that is similar to an existing one. For example, let's say you want to create an XBL button with a popup. One way to create this is to duplicate the existing XBL code for buttons. However, it would be better to simply extend the existing button code. Any binding can be extended with another. The child binding can add properties, 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 val...
XPCOM Examples - Archive of obsolete content
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 Tutorial - Archive of obsolete content
etails Tree Box Objects RDF and Templates Introduction to RDF Templates Trees and Templates RDF Datasources Advanced Rules Persistent Data Skins and Locales Adding Style Sheets Styling a Tree Modifying the Default Skin Creating a Skin Skinning XUL files by hand Localization Property Files Bindings Introduction to XBL Anonymous Content XBL Attribute Inheritance Adding Properties Adding Methods Adding Event Handlers XBL Inheritance Creating reusable content using CSS and XBL XBL Example Specialized Window Types Features of a Window Creating Dialogs Open and Save Dialogs Creating a Wizard More Wizards Overlays Cross Package Overlays Installation Creating an Installer Install Scripts Additional Install Features This XUL tutorial was originally crea...
Urlbar-icons - Archive of obsolete content
Create new image or button child elements to add your own items. ...
Using nsIXULAppInfo - Archive of obsolete content
de for those older versions. Getting nsIXULAppInfo To get a component implementing nsIXULAppInfo use this code: var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo); (For explanation see this Creating XPCOM article.) Getting application information After you obtained the app info component, you can read its properties to get the application's ID, human-readable name, version, platform version, etc. For complete list of nsIXULAppInfo's properties, please see nsIXULAppInfo interface description. ID You can tell which application you're running under using the nsIXULAppInfo.ID property. const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";...
XUL Accesskey FAQ and Policies - Archive of obsolete content
y. Letters next to a letter with a descender. Letters that are only one pixel wide, such as i or l. Example: i, l. Make it easy to remember Do the most important prompts first, so that they get the best accesskeys. See if a similar prompt has an accesskey elsewhere in Mozilla, and use the same accesskey. There are standard accesskeys used in Windows as well, like Properties. If not, try the first letter of the first word in the prompt. Next, try the first letter of another word in the prompt. Finally, use any non-silent letter in an action word (do these after the rest of the dialog has accesskeys chosen). Common elements that don't get accesskeys OK buttons. Cancel buttons. Close buttons. Tab panel labels. Toolbar buttons Tree it...
XUL Changes for Firefox 1.5 - Archive of obsolete content
o 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 description argument when creating items this way. <listbox> The removeItemAt method was sometime non zero-based due to a bug (bug 236068). This ...
XULBrowserWindow - Archive of obsolete content
In order to do so it implements the following interfaces: nsISupports nsIXULBrowserWindow nsIWebProgressListener nsIWebProgressListener2 nsISupportsWeakReference Note: This page is not complete at this time. See the linked interfaces for the definition of the implemented methods. You may also wish to refer to the implementation of XULBrowserWindow in browser/base/content/browser.js. ...
XUL Reference - Archive of obsolete content
bbox deck stack grid columns column rows row scrollbox action assign binding bindings conditions content member param query queryset rule template textnode triple where script commandset command broadcaster broadcasterset observes key keyset stringbundle stringbundleset arrowscrollbox dropmarker grippy scrollbar scrollcorner spinbuttons All attributes All properties All methods Attributes defined for all XUL elements Style classes Event handlers Deprecated/Defunct Markup ...
XUL Coding Style Guidelines - Archive of obsolete content
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 localization even though we've consistently referred to our notes as "LOCALIZATION NOTE". Files not to be localized? Some files live in the tree but aren't really part of the build; they're just there as programming examples ...
content - Archive of obsolete content
La pregunta en una regla deberia enlazar a solo a un elemento del contenido. Los contenidos deberian tener al atributo uri . Esto se utiliza para vincular una variable a un nodo de contenido cuando se emparejan. Cuando use un arbol con los atributos flags ("banderas"), establezca dont-build-content, ("no almacenar contenido"), use treeitem en su lugar. Para mas informacion, se encuentra disponible el tutorial XUL. ...
XUL - Archive of obsolete content
ns are applications using XUL and other components of the platform). XUL Controls lists some of the common controls provided by XUL. Documentation XUL Tutorial A guided tutorial that will help you get started with XUL, originally from XULPlanet. XUL Reference XUL elements, attributes, properties, methods, and event handlers. XUL Controls A quick list of all of the available XUL controls. The Joy of XUL Describes the key features and components of XUL. Menus and Popups Guide A guide on using menus and popup panels. Template Guide A detailed guide on XUL templates, which is a means of generating content from a ...
Application Update - Archive of obsolete content
When all registered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // Whether or not we show a dialog box informing the user that the update was // successfully applied. This is off in Firefox by default since we show a // upgrade start page instead! Other apps may wish to show this UI, and supply // a whatsNewURL field in their brand.properties that contains a link to a page // which tells users what's new in this new update. pref("app.update.showInstalledUI", false); // 0 = suppress prompting for incompatibilities if there are updates available // to newer versions of installed addons that resolve them. // 1 = suppress prompting for incompatibilities only if there are VersionInfo // updates available to installed addons that r...
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
ame) xulrunner/ 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_XULRun...
Custom app bundles for Mac OS X - Archive of obsolete content
ication in a way which is consistent with the expectations of Mac OS X users. Application bundle layout Application bundles are essentially just directory structures that conform to a standard layout and naming convention. ...
nsIContentPolicy - Archive of obsolete content
lled before loading the resource specified by aContentLocation to determine whether or not to start loading the requested resource. shouldLoad() can be called while the DOM and layout of the document involved is in an inconsistent state. This means that implementers of this method must not do any of the following: Modify the DOM in any way (e.g., setting attributes is a no-no). Query any DOM properties that depend on layout (e.g., offset* properties). Query any DOM properties that depend on style (e.g., computed style). Query any DOM properties that depend on the current state of the DOM outside the "context" node (e.g., lengths of node lists). [JavaScript implementations only] Access properties of any sort on any object without using XPCNativeWrapper (either explicitly or implicitly). Due t...
Gecko Compatibility Handbook - Archive of obsolete content
s upgraded to software that correctly implements SSL. DHTML Menus implemented using HierMenu have problems The HierMenu version is obsolete. The earliest version of HierMenu only supported Netscape Navigator 4.x and Internet Explorer 4.x and above. Later versions did support Netscape 6; however, in Netscape 6.1 and higher, support for Internet Explorer's proprietary offsetXXX properties results in HierMenu placing popups in the wrong position. The most recent versions of HierMenu fully support all Gecko-based browsers. Upgrade to the most recent version of HierMenu Common Coding and Server Problems This section details solutions to the most common problems affecting standards-based browsers as well as issues that may specifically affect Gecko brows...
2006-10-06 - Archive of obsolete content
Rich Internet Applications) roadmap--a set of guidelines for developers to make accessible web content. This set of documents tackles some of the difficulties that AJAX has been causing with regards to accessibility. Read more... Other links of interest: Roadmap for Accessible Rich Internet Applications (WAI-ARIA Roadmap) Roles for Accessible Rich Internet Applications (WAI-ARIA Roles) States and Properties Module for Accessible Rich Internet Applications (WAI-ARIA States and Properties) Making Ajax Work with Screen Readers Meetings Accessibility Hackfest 2006 - October 10-12 in Cambridge, MA (more details) Participants include the Mozilla Foundation, IBM, Sun and Novell to name a few. Authors Dean Woodside Sherman Fernandes ...
2006-11-10 - Archive of obsolete content
omponent and how to make this efficient and usable. Event in Firefox similar to OnDownloadComplete event in IE An inquiry about how to change the font of a web page before it is displayed using an extenstion. favicon as microsummary/feed/other stuff indicator Suggestion about making the favicon create a bookmark for the page with a microsummary. Firefox 2.0 - net accessed when bookmark properties viewed Question about whether Firefox 2.0 downlads the web page again when the properties of the bookmark are viewed. Followed by a discussion whether this is an improvement. what is the build date for Firefox 2? Quesiton about why a user using Firefox 2 RC3 didn't get a prompt for updating to Firefox 2 after the release date. improving the UE for content control Suggestion about how to ...
2006-10-06 - Archive of obsolete content
bird - September 30-October 06, 2006 Announcements Mac user needed Scott MacGregor announced that .mac support and a dynamically add ISP account feature has been added to the Thunderbird account manager, however, testing is required before release can be issued. Hence, they are looking for a Mac user to test out the new features by building a mac.rdf file with all of the various .mac account properties mentioned in the document here. Discussions Is Thunderbird using a valid W3C coding? Peter Lairo requested someone who are knowledgeable in W3C standards to confirm if the use of <blockquote type="cite"> is valid W3C code. Q & A Q: Walt experienced an unusual behaviour in his build and wanted to perform an experiment to figure out the problem, but he couldn't find the mozilla.org's conf...
2006-11-17 - Archive of obsolete content
and want suggestion from others. A few suggestion is posted. What file format is TB's address book using? TB's address book uses Mork (file format). There are also some perl code provided in this link. How to get review for work-in-progress patch? Answer: CC whoever you need review from, but don't post a formal review. Steps for posting a formal review is provided also. How to access xyz.properties items More detail and code examples are provided in the posting. How to create top-level folders in INBOX with an IMAP account on Courier Server. Solution is provided by Jay Lee Should there be an additional options for account configuration that just delete the messages from the server whenever they are deleted in TB? Some discussion is posted. However, David Bienvenu stated that the opti...
2006-11-24 - Archive of obsolete content
...
NPAPI plugin reference - Archive of obsolete content
dentifiers are unique, in that for any given string or integer, there is only one NPIdentifier. The lifetime of NPIdentifiers is controlled by the browser. NPN NewStream Requests the creation of a new data stream produced by the plug-in and consumed by the browser. NPN_CreateObject Allocates a new NPObject. NPN_DestroyStream Closes and deletes a stream. NPN_Enumerate Gets the names of the properties and methods of the specified NPObject. 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 i...
Sunbird Theme Tutorial - Archive of obsolete content
theme, create a plain text file named <tt>chrome.manifest</tt>. Copy and paste the content from here (just one line): skin calendar testing chrome/calendar/ Change <tt>testing</tt> to your theme's one-word internal name. Save the file. Creating the theme itself To create the theme itself, go to Sunbird's program directory. Note: If you do not know where the program directory is, look at the properties of the shortcut or launcher icon that you use to start Sunbird. There you can see the location of the directory. In the program directory, go to the <tt>chrome</tt> directory. Use a jar tool or zip tool to unpack the file <tt>calendar.jar</tt> there. Go to the <tt>skin</tt> directory that has just been created, then to the <tt>classic</tt> directory there. Copy the <tt>calendar</tt> directory tha...
Common Firefox theme issues and solutions - Archive of obsolete content
, the existing @namespace: @namespace html url("http://www.w3.org/1999/xhtml"); You can generate the error console message by going to Mozilla's Mission page. If you are using the extension Console2 you can easily filter out content related messages to see just chrome issues. Warning: Unknown Property (Obsolete CSS Rules) -moz-border-radius Firefox no longer supports -moz-border-radius style properties. Use CSS standard border-radius properties instead (supported by Firefox since Firefox 4). -moz-box-shadow Firefox no longer supports -moz-box-shadow style property. Use CSS standard box-shadow property instead (supported by Firefox since Firefox 4). -moz-transition Firefox no longer supports -moz-transition style property. Use CSS standard transition property instead (supported by Firefox si...
Settings - Archive of obsolete content
ption is not caught. This is usually the behavior you want. You don't generally want to pause execution when an exception that is thrown is caught, since that generally indicates that your program is handling it properly. Show Panes on Startup When this option is enabled, the debugger's variables pane is visible when you first start the debugger. Show Only Enumerable Properties Do not display non-enumerable JavaScript properties. Show Variables Filter Box Enabling this option adds a "Filter variables" search box to the variables pane, so that you can filter the displayed list of variables. Show Original Sources Enabling this option will make the debugger use source maps, if they are available, to display the original source for code which has ...
Developing cross-browser and cross-platform pages - Archive of obsolete content
n the appVersion string visits that page. As new browsers are released, it becomes necessary to make updates to such code which attempts to narrow down the browser and browser version and to make the appropriate switches. Another major problem with this approach is that the browser identity can be "spoofed" because, in many modern browsers, the navigator.appVersion and navigator.userAgent 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 Ne...
-ms-accelerator - Archive of obsolete content
Values false The object is not a keyboard shortcut. true The object is a keyboard shortcut. Formal syntax false | true Examples This 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" ...
-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. 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-ty...
-ms-high-contrast-adjust - Archive of obsolete content
The -ms-high-contrast-adjust CSS property is a Microsoft extension that gets or sets a value indicating whether to override any CSS properties that would have been set in high contrast mode. Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values auto Indicates the applicable CSS properties will be adjusted as expected when the system is in high contrast mode. 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. Remarks The -ms-high-contrast-adjust property works with the -ms-high-contrast media feature. ...
-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 value...
-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 value...
::-ms-browse - Archive of obsolete content
The ::-ms-browse CSS pseudo-element is a Microsoft extension that represents the button that opens the file picker of <input type="file">. Permitted properties Only the following CSS properties can be used in a rule with ::-ms-browse in its selector. Other properties are ignored. -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust background-clip background-color background-image background-origin background-repeat background-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 bo...
::-ms-clear - Archive of obsolete content
-empty text controls. This includes inputs that appear text-like or fall back to type="text". Such inputs include: <input type="color"> <input type="date"> <input type="datetime"> <input type="datetime-local"> <input type="email"> <input type="month"> <input type="number"> <input type="search"> <input type="tel"> <input type="time"> <input type="url"> <input type="week"> Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-clear in its selector. Other properties are ignored. -ms-high-contrast-adjust background-clip background-color background-image background-origin background-position-x background-position-y background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-styl...
::-ms-reveal - Archive of obsolete content
is a Microsoft extension that is used to display a password reveal button for use with a password field created by <input type="password">. The user presses the button to reveal the actual field value rather than asterisks. 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. background-clip background-color background-image background-origin background-repeat background-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-lef...
::-ms-ticks-after - Archive of obsolete content
<input type="range">. These ticks are not shown by default. To show them, set the control's display property to block. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. To remove tick marks altogether, set the color property to transparent. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-ticks-after in its selector. Other properties are ignored. background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style borde...
::-ms-ticks-before - Archive of obsolete content
<input type="range">. These ticks are not shown by default. To show them, set the control's display property to block. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. To remove tick marks altogether, set the color property to transparent. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-ticks-before in its selector. Other properties are ignored. background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style bord...
::-ms-tooltip - Archive of obsolete content
The ::-ms-tooltip CSS pseudo-element is a Microsoft extension that represents the tooltip of a slider control. A slider control is one possible representation of <input type="range">. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-tooltip in its selector. Other properties are ignored. display visibility Syntax ::-ms-tooltip ...
::-ms-track - Archive of obsolete content
pe="range">. Applying the color property within the ::-ms-track selector affects the tick marks inside the track area. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. To remove tick marks altogether, set the color property to transparent. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-track in its selector. Other properties are ignored. background-clip background-color background-image background-origin background-repeat background-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...
E4X for templating - Archive of obsolete content
scape function above as well if (typeof s === 'string') { return s.replace(/"/g, '&quot;').replace(/'/g, '&apos;'); } if (typeof s === 'xml') { return s.toString().replace(/"/g, '&quot;').replace(/'/g, '&apos;'); } return String(s).replace(/"/g, '&quot;').replace(/'/g, '&apos;'); } Localization E4X works nicely with a simple utility for localizing strings of a properties file: // Localization function $S(msg, args){ //get localized message var STRS = Cc['@mozilla.org/intl/stringbundle;1'].getService(Ci.nsIStringBundleService). createBundle('chrome://myeExt/locale/myExt.properties'); if (args){ args = Array.prototype.slice.call(arguments, 1); return STRS.formatStringFromName(msg,args,args.length); } ...
Processing XML with E4X - Archive of obsolete content
may be converted to a string when used in other contexts (such as insertion into a textbox). if (languages.@type.toString() === 'agile') { ... } or, simply: if (languages.@type == 'agile') { ... } Working with XML objects XML objects provide a number of methods for inspecting and updating their contents. ...
Namespaces - Archive of obsolete content
ul"; var b = <label>More text</label>; a.appendChild(b); gives <p xmlns="http://www.w3.org/1999/xhtml"> Some text <label xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul">More text</label> </p> name() Using name() on an XML object returns a QName object (Qualified Name). QName is a global constructor available in JavaScript implementations supporting E4X. QName objects have two properties of particular relevance. The localName property returns the name of the element, without any namespace prefix. The uri property returns the uri of the namespace that the element is in. var info = a.name(); info.localName; // returns 'p'. info.uri; // returns "http://www.w3.org/1999/xhtml" Elements in no namespace return the empty string as their uri. The Namespace global constructor is very simi...
The global XML object - Archive of obsolete content
XML elements will remember the settings of the XML object from the time of their creation. Extending XML.prototype XML.prototype and XMLList.prototype (XMLList.prototype is actually just XML.prototype) cannot be extended in the same conventional way as other constructors such as Object. You can only define methods in XML.prototype and not fields. ...
Array.observe() - Archive of obsolete content
e list ["add", "update", "delete", "splice"]. However, this API has been deprecated and removed from Browsers. You can use the more general Proxy object instead. Syntax Array.observe(arr, callback) Parameters arr The array to be observed. callback The 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 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 o...
Date.prototype.toLocaleFormat() - Archive of obsolete content
alization tasks are not handled automatically since you have control over the order in which they occur. You should take care that the format string is localized properly according to the user's system settings. Be aware that the locale used is not necessarily the same as the locale of the browser. Extension and XULRunner developers should know that just loading the format string from a .dtd or .properties file using a chrome://somedomain/locale/somefile.ext URI should be avoided, as the .dtd/.properties file and the toLocaleFormat() method does not not necessarily use the same locale, which could result in odd looking or even ambiguous or unreadable dates. Also note that the behavior of the used locale depends on the platform, and the user might customize the locale used, so using the system loca...
ActiveXObject - Archive of obsolete content
ation object, assign the new ActiveXObject to an object variable: var ExcelApp = new ActiveXObject("Excel.Application"); var ExcelSheet = new ActiveXObject("Excel.Sheet"); This code starts the application creating the object (in this case, a Microsoft Excel worksheet). Once an object is created, you refer to it in code using the object variable you 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. Exc...
Error.description - Archive of obsolete content
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]": document.write(e) document.write (" "); // Prints 5009: document.write((e.number & 0xF...
GetObject - Archive of obsolete content
t to activate, use the optional class argument. For example: var MyObject; MyObject = GetObject("C:\\DRAWINGS\\SAMPLE.DRW", "FIGMENT.DRAWING"); In the preceding example, FIGMENT is the name of a drawing application and DRAWING is one of the object types it supports. Once an object is activated, you reference it in code using the object variable you defined. In the preceding example, you access properties and methods of the new object using the object variable MyObject. For example: MyObject.Line(9, 90); MyObject.InsertText(9, 100, "Hello, world."); MyObject.SaveAs("C:\\DRAWINGS\\SAMPLE.DRW"); Note: Use the GetObject function when there is a current instance of the object, or if you want to create the object with a file already loaded. If there is no current instance, and you don't want the ob...
New in JavaScript 1.2 - Archive of obsolete content
E="JavaScript1.1"> <!-- JavaScript for Navigator 3.0. --> <SCRIPT LANGUAGE="JavaScript1.2"> <!-- JavaScript for Navigator 4.0. --> New features in JavaScript 1.2 New objects You can create objects using literal notation (inspired by dictionary literal syntax from Python 1.x). Arrays can now be created using literal notation (inspired by list literal syntax from Python 1.x). ...
New in JavaScript 1.8.1 - Archive of obsolete content
a modest update syntactically to JavaScript; the main change in this release is the addition of the Tracemonkey just-in-time 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.prototype.__count__ - Archive of obsolete content
Obsolete since Gecko 2 (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. The __count__ property used to store the count of enumerable properties on the object, but it has been removed. Syntax obj.__count__ Examples { 1: 1 }.__count__ // 1 [].__count__ // 0 [1].__count__ // 1 [1, /* hole */, 2, 3].__count__ // 3 Specifications Not part of any standard. ...
Object.prototype.eval() - Archive of obsolete content
The Object.eval() method used to evaluate a string of JavaScript code in the context of an object, however, this method has been removed. Syntax obj.eval(string) Parameters string Any string representing a JavaScript expression, statement, or sequence of statements. The expression can include variables and properties of existing objects. Description The eval method can no longer be used as a method of an object. Use the top-level eval() function instead. Specifications Not part of any standard. ...
Object.observe() - Archive of obsolete content
he order in which they occur. However, this API has been deprecated and removed from browsers. You can use the more general Proxy object instead. Syntax Object.observe(obj, callback[, acceptList]) Parameters obj The object to be observed. callback The 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 give...
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. ...
JSObject - Archive of obsolete content
ascript.JSObject and passed to Java. JSObject allows Java to manipulate JavaScript objects. When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type JSObject; when a JSObject is sent from Java to JavaScript, the runtime engine unwraps it to its original JavaScript object type. The JSObject class provides a way to invoke JavaScript methods and examine JavaScript properties. Any JavaScript data brought into Java is converted to Java data types. When the JSObject is passed back to JavaScript, the object is unwrapped and can be used by JavaScript 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 D...
JavaArray - Archive of obsolete content
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 method is overridden by the inherited method java.lang.Object.toString. in JavaScript 1.3 and earlier, this method returns a string identifying the object as a JavaArray. In JavaScript 1.4 and later, JavaArray also inherits methods from the Java array superclass, java.lang.Obje...
JavaClass - Archive of obsolete content
lect the Java package and class hierarchy. You can pass a JavaClass object to a Java method which requires an argument of type java.lang.Class. Backward compatibility JavaScript 1.3 and earlier You must create a wrapper around an instance of java.lang.Class before you pass it as a parameter to a Java method -- JavaClass objects are not automatically converted to instances of java.lang.Class. Properties The properties of a JavaClass object are the static fields of the Java class. Methods The methods of a JavaClass object are the static methods of the Java class. Examples Example: Using JavaClass In the following example, x is a JavaClass object referring to java.awt.Font. Because BOLD is a static field in the Font class, it is also a property of the JavaClass object. x = java.awt.Font; my...
JavaObject - Archive of obsolete content
reated in or passed to JavaScript. JavaObject is a wrapper for the instance; all references to the class instance are made through the JavaObject. Any Java data brought into JavaScript is converted to JavaScript data types. When the JavaObject is passed back to Java, it is unwrapped and can be used by Java code. See the Core JavaScript 1.5 Guide for more information about data type conversions. Properties Inherits public data members from the Java class of which it is an instance as properties. It also inherits public data members from any superclass as properties. Methods Inherits public methods from the Java class of which it is an instance. The JavaObject also inherits methods from java.lang.Object and any other superclass. Examples Example: Instantiating a Java Object in JavaScript The f...
JavaPackage - Archive of obsolete content
ample, a reference to netscape is a JavaPackage. netscape.javascript is both a JavaPackage and a property of the netscape JavaPackage. A JavaClass object is a reference to one of the classes in a package, such as netscape.javascript.JSObject. The JavaPackage and JavaClass hierarchy reflect the Java package and class hierarchy. Although the packages and classes contained in a JavaPackage are its properties, you cannot use a for...in statement to enumerate them as you can enumerate the properties of other objects. Properties The properties of a JavaPackage are the JavaClass objects and any other JavaPackage objects it contains. Examples Suppose the Redwood corporation uses the Java redwood package to contain various Java classes that it implements. The following code creates the JavaPackage red:...
ParallelArray - Archive of obsolete content
ted to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of JS that Firefox supports. Syntax new ParallelArray() new ParallelArray([element0, element1, ...]) new ParallelArray(arrayLength, elementalFunction) ParallelArray instances Properties length Reflects the number of elements in the ParallelArray. Methods map reduce scan scatter filter flatten partition get Examples Using map in parallel var p = new ParallelArray([0, 1, 2, 3, 4]); var m = p.map(function (v) { return v + 1; }); ...
background-size - Archive of obsolete content
e fact that this reference has serious shortcomings in many places and few contributors, I think spending much time here is not effective. People especially interested in this browser are welcome to contribute. It's hard 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...
Writing JavaScript for XHTML - Archive of obsolete content
document author having the possibility of later wanting to make documents available in XHTML for browsers that support it), one may wish to avoid features which are not likely to stay compatible into the future. Solution: Avoid HTML-specific DOM The HTML DOM , even though it is compatible with XHTML 1.0, is not guaranteed to work with future versions of XHTML (perhaps especially the formatting properties which have been deprecated as element attributes). The regular XML DOM provides sufficient methods via the Element interface for getting/setting/removing attributes. Problem: My Favourite JS Library still Breaks If you use JavaScript libraries like the famous prototype.js or Yahoo's one, there is bad news for you: As long as the developers don't apply the fixes mentioned above, you won't be abl...
XForms Custom Controls - Archive of obsolete content
input, secret and textarea XForms controls. select.xml - contains the base bindings for select and select1 XForms controls (except minimal/default select1 that is hosted in select1.xml file) range.xml - contains the base bindings for the range XForms control. xforms.xml also defines the few base bindings that are common for all XForms controls. These are: xformswidget-general - defines utility properties and methods common for all XForms controls xformswidget-accessors - defines the methods that are allow the bindings to work with bound instance nodes and the XForms element itself. xformswidget-base - implements nsIXFormsUIWidgets interfaces. You are free to choose what type of binding you will extend to provide the foundation for your custom control. This will very likely be one of the implemen...
Implementation Status - Archive of obsolete content
unsupported Supported types: string, normalized string, token, language, boolean, gDay, gMonth, gYear, gYearMonth, gMonthDay, date, time, datetime, duration, integer, nonPositiveInteger, negativeInteger, positiveInteger, long, int, short, unsignedLong, unsignedInt, unsignedShort, byte, unsignedByte, float, decimal, anyURI, base64Binary, hexBinary, qname 6. ...
RFE to the XForms API - Archive of obsolete content
Archive › Web › XForms › RFE › XForms API
e 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 Put here your requirements to improve existing XForms interfaces or to add a new one. Ability to get nsIXFormsAccessors for instance node We need the ability to get to the nsIXFormsAccessors interface on a node by specifying the node via an ...
XForms Select Element - Archive of obsolete content
hich 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 used, which allows the available choices to be obtained from an XForms Model. The relaxation happens when...
XForms Select1 Element - Archive of obsolete content
- 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 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. The relaxation happens when the itemset element specifie...
Mozilla XForms User Interface - Archive of obsolete content
to the user when the specified event occurs (see the spec). XForms User Interface These elements are mainly used to organize and manage the form's markup. They can be bound to instance nodes to define context for the xforms controls that they contain, should any of their child nodes happen to use relative xpath expressions. Binding these elements to instance data is also a way to apply Model Item Properties (for example, relevancy) to the elements. Elements in this section do not have any behaviors that are dependent on the host language. group This element is used to logically group xforms elements together (see the spec). switch This element is used in conjunction with case and toggle elements (see the spec). The switch element contains case elements which in turn contain markup. Only the contents...
Window: devicelight event - Archive of obsolete content
The devicelight event is 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',...
Parsing microformats in JavaScript - Archive of obsolete content
The property's parent node. If it is a subproperty, this is the parent property node. Otherwise this is the microformat node. Return value A string containing all the text from the specified microformat node, including the tags. telGetter() Specifically retrieves a telephone number from a microformat node. This handles the fact that telephone numbers use "value" as the name of one of their subproperties, but "value" is also used for value excerpting. tel = Microformats.parser.telGetter(propnode, parentnode); Parameters propnode The DOM node to check. parentnode The property's parent node. If it is a subproperty, this is the parent property node. Otherwise this is the microformat node. Return value A string containing the telephone number. uriGetter() Specifically retrieves a URI fr...
RDF in Fifty Words or Less - Archive of obsolete content
ults from your favorite web crawler, just to name a few. And fundamentally, there's no reason that you shouldn't be able to treat these as "bookmarks" as well, grouping them together into folders as you please, or maybe even creating "smart" folders that, when you open them, dynamically generate their contents by running common search that you define. And a "bookmark" could really have arbitrary properties associated with it: you might want to invent your own "classification" scheme for a bookmarka la Macintosh's "hot", "warm", "cool" color coding. Or you might want to relate a bookmark to another bookmark, or keep it in multiple "folders" at once. The RDF graph provides a perfect data model upon which to build a "universal" bookmarking service as described above: the graph can contain pointers to...
RDF in Mozilla FAQ - Archive of obsolete content
datasources from which the template is built. The builder property refers to an nsIXULTemplateBuilder object, which is a the "builder" that maintains the state of the template's contents. Note the rdf:null datasource: this is a special datasource that says, "hey, I don't have a datasource for you yet, but I'm going to add one later, so set yourself up for it!" It causes the database and builder properties to get installed, but leaves the database empty of datasources: you've got to add these in yourself! Can I manipulate a XUL template using the DOM APIs? Yes: you can add rules, remove rules, change a query, and change the content that is built by a rule. In fact, you can change anything about a template using the W3C DOM APIs. The only caveat is that you must call rebuild() before the changes ...
3D collision detection - Game development
(y - sphere.y) * (y - sphere.y) + (z - sphere.z) * (z - sphere.z)); return distance < sphere.radius; } Using a physics engine 3D physics engines provide collision detection algorithms, most of them based on bounding volumes as well. The way a physics engine works is by creating a physical body, usually attached to a visual representation of it. This body has properties such as velocity, position, rotation, torque, etc., and also a physical shape. This shape is the one that is considered in the collision detection calculations. We have prepared a live collision detection demo (with source code) that you can take a look at to see such techniques in action -- this uses the open-source 3D physics engine cannon.js. ...
Building up a basic demo with A-Frame - Game development
e elements. Add the <a-animation> element seen below to the <a-box> element as a child, as shown: <a-box color="#0095DD" rotation="20 40 0" position="0 1 0"> <a-animation attribute="rotation" from="20 0 0" to="20 360 0" direction="alternate" dur="4000" repeat="indefinite" easing="ease"> </a-animation> </a-box> As with any other entities, you can define key properties for the animation. We'll be animating the rotation attribute from 20 0 0 to 20 360 0, so it will do a full spin. The animation direction is set to alternate so the animation will be played forward, and then back. The duration is set to 4 seconds, and it will be repeated indefinitely. The animation uses ease for easing, with tween.js being implemented internally. Scaling We can also add animatio...
Building up a basic demo with PlayCanvas editor - Game development
derMaterial icon onto the cylinder object on the sceene to apply that color. Follow the same approach again to add a cone to the scene, giving it a grayish color (we used EAEFF2.) You should now have three shapes on your scene, something like the below screenshot. Animating our scene Animating 3D models might be considered an advanced thing to do, but all we want to do is to control a few properties of a given object -- we can use a script component to do that. Click on the plus button in the Assets panel, select the Script option, and name your new script file boxAnimation.js. If you double click on it, you'll be moved to a code editor. As you can see, the file contains some boilerplate code already: pc.script.create('boxAnimation', function (app) { // Creates a new BoxAnimation ins...
GLSL Shaders - Game development
ongly typed and there is a lot of math involving vectors and matrices. It can get very complicated -- very quickly. In this article we will make a simple code example that renders a cube. To speed up the background code we will be using the Three.js API. As you may remember from the basic theory article, a vertex is a point in a 3D coordinate system. Vertices may, and usually do, have additional properties. The 3D coordinate system defines space and the vertices help define shapes in that space. Shader types A shader is essentially a function required to draw something on the screen. Shaders run on a GPU (graphics processing unit), which is optimized for such operations. Using a GPU to deal with shaders offloads some of the number crunching from the CPU. This allows the CPU to focus its processin...
Audio for Web games - Game development
the OS level and this shouldn't be overridden. Buffering and preloading Likely as an attempt to mitigate runaway mobile network data use, we also often find that buffering is disabled before playback has been initiated. Buffering is the process of the browser downloading the media in advance, which we often need to do to ensure smooth playback. The HTMLMediaElement interface comes with lots of properties to help determine whether a track is in a state to be playable. Note: In many ways the concept of buffering is an outdated one. As long as byte-range requests are accepted (which is the default behavior), we should be able to jump to a specific point in the audio without having to download the preceding content. However, preloading is still useful -- without it, there would always need to be so...
Unconventional controls - Game development
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 full game this could be replaced with the shooting logic.) That's it -- everything you needed for a working Leap Motion example in JavaScript is here already. You can explore the hand's properties and implement any behaviour you like right inside your game. Doppler effect There's a very interesting article available on Motion sensing using the doppler effect, which mixes together waving your hand and using the microphone. This time it's about detecting sound waves bouncing off objects and returning to the microphone. If the frequency of the bounced sound is shifted from the original o...
Implementing controls using the Gamepad API - Game development
x: 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(), there are two more methods in the gamepadAPI object: update() and buttonPressed(). update() is executed on every frame inside t...
Crisp pixel art look with image-rendering - Game development
quire algorithms that analyse 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 dif...
Square tilemaps implementation: Static maps - Game development
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 used. It contains the basic map properties: cols: The width of the map, in columns. rows: The height of the map, in rows. tsize: The tile size, in pixels. tiles: A 1-dimensional array containing the visual grid. getTile(): 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 at...
Animations and tweens - Game development
ion just before your closing </script> tag: function ballHitPaddle(ball, paddle) { ball.animations.play('wobble'); } The animation is played every time the ball hits the paddle. You can add the animations.play() call inside the ballHitBrick() function too, if you feel it would make the game look better. Tweens Whereas animations play external sprites sequentially, tweens smoothly animate properties of an object in the gameworld, such as width or opacity. Let's add a tween to our game to make the bricks smoothly disappear when they are hit by the ball. Go to your ballhitBrick() function, find your brick.kill(); line, and replace it with the following: var killTween = game.add.tween(brick.scale); killTween.to({x:0,y:0}, 200, Phaser.Easing.Linear.None); killTween.onComplete.addOnce(function(...
Move the ball - Game development
that. Updating the ball's position on each frame Remember the update() function and its definition? The code inside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen. Add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } The code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame. Reload index.html and you should see the ball rolling across the screen. 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 it works: Next steps The next step is to add some basic collision detection, so our ball can bounce off the walls. This ...
Scaling - Game development
after completing this lesson at Gamedev-Phaser-Content-Kit/demos/lesson02.html. Scaling refers to how the game canvas will scale on different screen sizes. We can make the game scale to fit on any screen size automatically during the preload stage, so we don't have to worry about it later. The Phaser scale object There's a special scale object available in Phaser with a few handy methods and properties available. Update your existing preload() function as follows: function preload() { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; } scaleMode has a few different options available for how the Canvas can be scaled: NO_SCALE -- nothing is scaled. EXACT_FIT -- scale the canvas to fill all the av...
2D maze game with device orientation - Game development
onsible for the Device Orientation API, providing the motion controls when the game is running on a mobile device with appropriate hardware. finishLevel loads a new level when the current level is completed, or finished the game if the final level is completed. Adding the ball and its motion mechanics First, let's go to the create() function, initialize the ball object itself and assign a few properties to it: this.ball = this.add.sprite(this.ballStartPos.x, this.ballStartPos.y, 'ball'); this.ball.anchor.set(0.5); this.physics.enable(this.ball, Phaser.Physics.ARCADE); this.ball.body.setSize(18, 18); this.ball.body.bounce.set(0.3, 0.3); Here we're adding a sprite at the given place on the screen and using the 'ball' image from the loaded graphic assets. We're also setting the anchor for any phy...
API - MDN Web Docs Glossary: Definitions of Web-related terms
a set of features and rules that exist inside a software program (the application) enabling interaction with it through software - as opposed to a human user interface. The API can be seen as a simple contract (the interface) between the application offering it and other items, such as third party software or hardware. In Web development, an API is generally a set of code features (e.g. methods, properties, events, and URLs) that a developer can use in their apps for interacting with components of a user's web browser, or other software/hardware on the user's computer, or third party websites and services. For example: The getUserMedia API can be used to grab audio and video from a user's webcam, which can then be used in any way the developer likes, for example, recording video and audio, broa...
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
CSS (Cascading Style Sheets) is a declarative language that controls how webpages look in the browser. The browser applies CSS style declarations to selected elements to display them properly. A style declaration contains the properties and their values, which determine how a webpage looks. 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. Here is an example that makes every HTML paragraph yellow against a black background: /* The selector "p" indicates that all paragraphs in the document will be affected by that rule */ p { /* The "color" property defines the text color, in this case yellow. */ c...
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
The CSSOM is very similar to the Document Object Model (DOM). Both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. The CSSOM, together with the DOM, to build the render tree, which is in turn used by the browser to layout and paint the web page. CSSOM API The CSS Object Model is also 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. ...
Class - MDN Web Docs Glossary: Definitions of Web-related terms
Learn More General knowledge Class-based vs. ...
Delta - MDN Web Docs Glossary: Definitions of Web-related terms
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. ...
Document directive - MDN Web Docs Glossary: Definitions of Web-related terms
CSP document directives are used in a Content-Security-Policy header and govern the properties of a document or worker environment to which a policy applies. Document directives don't fall back to the default-src directive. See Document directives for a complete list. ...
Dynamic programming language - MDN Web Docs Glossary: Definitions of Web-related terms
This is opposed to so-called static programming languages, in which such changes are normally not possible. ...
Expando - MDN Web Docs Glossary: Definitions of Web-related terms
Expando properties are properties added to DOM nodes with JavaScript, where those properties are not part of the object's DOM specification: window.document.foo = 5; // foo is an expando The term may also be applied to properties added to objects without respecting the object's original intent, such as non-numeric named properties added to an Array. ...
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
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. ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
In CSS the block or column axis is the axis used when laying out blocks of text. ...
Grid Column - MDN Web Docs Glossary: Definitions of Web-related terms
In addition, columns may be created in the implicit grid when items are placed outside of columns created in the explicit grid. These columns will be auto-sized by default, or can have a size specified with the grid-auto-columns property. ...
Grid Row - MDN Web Docs Glossary: Definitions of Web-related terms
In addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. These rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. ...
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
ibute() 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 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, t...
Main Axis - MDN Web Docs Glossary: Definitions of Web-related terms
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. Learn more Property reference flex-basis flex-direction flex-grow flex-shrink justify-content flex Further reading CSS Flexbox Guide: Basic Concepts of Flexbox CSS Flexbox Guide: Aligning items in a flex container CSS Flexbox Guide: Controlling Ratios of flex items along ...
Object reference - MDN Web Docs Glossary: Definitions of Web-related terms
A link to an object. Object references can be used exactly like the linked objects. The concept of object references becomes clear when assigning the same object to more than one property. Rather than holding a copy of the object, each assigned property holds object references that link to the same object, so that when the object changes all properties referring to the object reflect the change. Learn more General knowledge Reference (computer science) on Wikipedia ...
Prototype-based programming - MDN Web Docs Glossary: Definitions of Web-related terms
Prototype-based programming is a style of object-oriented programming in which classes are not explicitly defined, but rather derived by adding properties and methods to an instance of another class or, less frequently, adding them to an empty object. In simple words: this type of style allows the creation of an object without first defining its class. Learn More General knowledge Prototype-based programming on Wikipedia ...
Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms
at outputs numbers in a complex, seemingly unpredictable pattern. Truly random numbers (say, from a radioactive source) are utterly unpredictable, whereas all algorithms are predictable, and a PRNG returns the same numbers when passed the same starting parameters or seed. PRNGs can be used for a variety of applications, such as games. A cryptographically secure PRNG is a PRNG with certain extra properties making it suitable for use in cryptography. These include: that it's computationally unfeasible for an attacker (without knowledge of the seed) to predict its output that if an attacker can work out its current state, this should not enable the attacker to work out previously emitted numbers. Most PRNGs are not cryptographically secure. Learn more General knowledge Pseudorandom number ...
WebIDL - MDN Web Docs Glossary: Definitions of Web-related terms
It uses a somewhat stylized syntax which is independent of any specific programming language, so that the underlying code which is used to build each API can be written in whatever language is most appropriate, while still being possible to map the API's components to JavaScript-compatible constructs. ...
HTML: A good basis for accessibility - Learn web development
Criterion 2.4.1 | W3C Understanding WCAG 2.0 Proximity Large amounts of interactive content--including anchors--placed in close visual proximity to each other should have space inserted to separate them. This spacing is beneficial for people who suffer from fine motor control issues and may accidentally activate the wrong interactive content while navigating. Spacing may be created using CSS properties such as margin. Hand tremors and the giant-button-problem - Axess Lab Test your skills! You've reached the end of this article, but can you remember the most important information? See Test your skills: HTML Accessibility to verify that you've retained this information before you move on. Summary You should now be well-versed in writing accessible HTML for most occasions. Our WAI-ARIA bas...
HTML: A good basis for accessibility - Learn web development
Criterion 2.4.1 | W3C Understanding WCAG 2.0 Proximity Large amounts of interactive content--including anchors--placed in close visual proximity to each other should have space inserted to separate them. This spacing is beneficial for people who suffer from fine motor control issues and may accidentally activate the wrong interactive content while navigating. Spacing may be created using CSS properties such as margin. Hand tremors and the giant-button-problem - Axess Lab Test your skills! You've reached the end of this article, but can you remember the most important information? See Test your skills: HTML Accessibility to verify that you've retained this information before you move on. Summary You should now be well-versed in writing accessible HTML for most occasions. Our WAI-ARIA bas...
Accessible multimedia - Learn web development
Before moving onto creating our button functionality, let's remove the native controls so they don't get in the way of our custom controls. Add the following, again at the bottom of your JavaScript: player.removeAttribute('controls'); Doing it this way round rather than just not including the controls attribu...
Images, media, and form elements - Learn web development
This includes all the items mentioned in the last three sections: button, input, select, textarea { font-family: inherit; font-size: 100%; box-sizing: border-box; padding: 0; margin: 0; } textarea { overflow: auto; } Note: Normalizing stylesheets are used by many developers to create a set of...
Overflowing content - Learn web development
above, we only need to scroll on the y axis, however we get scrollbars in both axes. To just scroll on the y axis, you could use the overflow-y property, setting overflow-y: scroll. You can also scroll on the x axis using overflow-x, although this is not a recommended way to accommodate long words! If you have a long word in a small box, you might consider using 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 fi...
Styling tables - Learn web development
his 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: tables. Summary With styling tables now behind us, we need something else to occupy our time. The next article explores debugging CSS -- how to solve problems such as layouts not looking like they should, or properties not applying when you think they should. This includes information on using browser DevTools to find solutions to your problems. Previous Overview: Building blocks Next In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute selectors Pseudo-classes and pseudo-elements Combinators The box model Backgrounds and borders Handl...
Floats - Learn web development
%; max-width: 900px; margin: 0 auto; font: .9em/1.2 Arial, Helvetica, sans-serif } .box { width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } If you save and refresh now, you'll see something much like what you'd expect -- the box is sitting above the text, in normal flow. To float the text around it add the float and margin-right properties to the .box rule: .box { float: left; margin-right: 15px; width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } Now if you save and refresh you'll see something like the following: Float Example 1 <h1>Simple float example</h1> <div class="box">Float</div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla luctus a...
Test your skills: floats - 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. Floats One In this task you need to float the two elements with a class of float1 and float2 left and right respectively. ...
Test your skills: Grid Layout - Learn web development
now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Three There are four direct children in this grid; the starting point has them displayed using auto-placement. Use the grid-area and grid-template-areas properties to lay the items out as shown in the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid and Flex Layout 4 You will need to use both Grid Layout and Flexbox to recreate the example as seen in the image. You do not need to make a...
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. ...
Practical positioning examples - Learn web development
bs -- the list items are all floated left to make them sit in a line together, their list-style-type is set to none to get rid of the bullets, and their width is set to 150px so they will comfortably fit across the info-box. The <a> elements are set to display inline-block so they will sit in a line but still be stylable, and they are styled appropriately for tab buttons, using a variety of other properties. Add the following CSS: .info-box li { float: left; list-style-type: none; width: 150px; } .info-box li a { display: inline-block; text-decoration: none; width: 100%; line-height: 3; background-color: red; color: black; text-align: center; } Finally for this section we'll set some styles on the link states. First, we'll set the :focus and :hover states of the tabs to look ...
Getting started with CSS - Learn web development
- you'll soon start to get the hang of it as you write more CSS. Wrapping up In this tutorial, we have taken a look at a number of ways in which you can style a document using CSS. We will be developing this knowledge as we move through the rest of the lessons. However you now already know enough to style text, apply CSS based on different ways of targeting elements in the document, and look up properties and values in the MDN documentation. In the next lesson we will be taking a look at how CSS is structured. 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 ...
Styling text - Learn web development
teach you all of the essentials behind styling HTML text content. Fundamental text and font styling In this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. Styling lists Lists behave like any other text for the most part, but there are some CSS properties specific to lists that you need to know about, and some best practices to consider. This article explains all. Styling links When styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs. We'll look at all these topics in this article. Web...
HTML forms in legacy browsers - Learn web development
legacy browsers. And HTML5 <input> types don't fail when not supported: they fall back to type=text. Learn about the issues To understand common patterns, it helps to read browser documentation. If you are reading this on MDN, you are at the right place to start. Just check the support of the elements (or DOM interface) you want to use. MDN has compatibility tables available for most elements, properties and APIs that can be used in a web page. There are other resources that can be amazingly helpful: Browser vendor documentation Mozilla: You're in the right place, just browse MDN Microsoft: Internet Explorer Standards Support Documentation WebKit: Because there are several different editions of this engine, things are a little trickier. The WebKit blog and Planet WebKit aggregate the ...
How to build custom form controls - Learn web development
short, this pretty new select box isn't accessible! Fortunately, there is a solution and it's called ARIA. ARIA stands for "Accessible Rich Internet Application", and it's a W3C specification specifically designed for what we are doing here: making web applications and custom controls accessible. It's basically a set of attributes that extend HTML so that we can better describe roles, states and properties as though the element we've just devised was the native element it tries to pass for. Using these attributes can be done by editing the HTML markup. We also update the ARIA attributes via JavaScript as the user updates their selected value. The role attribute The key attribute used by ARIA is the role attribute. The role attribute accepts a value that defines what an element is used for. Each r...
Web forms — Working with user data - Learn web development
...
Using data attributes - Learn web development
HTML syntax The syntax is simple. Any attribute on any element whose attribute name starts with data- is a data attribute. ...
Images in HTML - Learn web development
e solution, so that solution is not saved over the user code if(solution.value === 'Show solution') { userEntry = textarea.value; } else { solutionEntry = textarea.value; } updateCode(); }; CSS background images You can also use CSS to embed images into webpages (and JavaScript, but that's another story entirely). The CSS background-image property, and the other background-* properties, are used to control background image placement. For example, to place a background image on every paragraph on a page, you could do this: p { background-image: url("images/dinosaur.jpg"); } The resulting embedded image, is arguably easier to position and control than HTML images. So why bother with HTML images? As hinted to above, CSS background images are for decoration only. If you just wa...
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
styling information for an entire column of data all in one place -- the <col> and <colgroup> elements. These exist because it can be a bit annoying and inefficient having to specify styling on columns -- you generally have to specify your styling information on every <td> or <th> in the column, or use a complex selector such as :nth-child(). Note: Styling columns like this is limited to a few properties: border, background, width, and visibility. To set other properties you'll have to either style every <td> or <th> in the column, or use a complex selector such as :nth-child(). Take the following simple example: <table> <tr> <th>Data 1</th> <th style="background-color: yellow">Data 2</th> </tr> <tr> <td>Calcutta</td> <td style="background-color: yellow">Orange</td> </t...
Functions — reusable blocks of code - Learn web development
oks 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 string replace() function however needs two parameters -- the substring to find in the main string, and the substring to replace that string with: let myText = 'I ...
Fetching data from the server - Learn web development
r in the XHR-basic.html example. You will, however, need to add the error handling we showed you in the Fetch version of the Can Store: The response is found in request.response after the load event has fired, not in a promise then(). About the best equivalent to Fetch's response.ok in XHR is to check whether request.status is equal to 200, or if request.readyState is equal to 4. The properties for getting the status and status message are the same, but they are found on the request (XHR) object, not the response object. Note: If you have trouble with this, feel free to check your code against the finished version on GitHub (see the source here, and also see it running live). Summary This article shows how to start working with both XHR and Fetch to fetch data from the server...
Video and Audio APIs - Learn web development
ata-icon contains a capital "P". We apply the custom web font to our buttons using font-family. In this font, "P" is actually a "play" icon, so therefore the play button has a "play" icon displayed on it. Icon fonts are very cool for many reasons -- cutting down on HTTP requests because you don't need to download those icons as image files, great scalability, and the fact that you can use text properties to style them -- like color and text-shadow. Last but not least, let's look at the CSS for the timer: .timer { line-height: 38px; font-size: 10px; font-family: monospace; text-shadow: 1px 1px 0px black; color: white; flex: 5; position: relative; } .timer div { position: absolute; background-color: rgba(255,255,255,0.2); left: 0; top: 0; width: 0; height: 38px; z-ind...
Test your skills: Strings - Learn web development
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. Strings 3 In the next string task, you are given the same quote that you ended up with in the previous...
Useful string methods - Learn web development
is. Objective: To understand that strings are objects, and learn how to use some of the basic methods available on those objects to manipulate strings. Strings as objects Most things are objects in JavaScript. When you create a string, for example by using let string = 'This is my string'; your variable becomes a string object instance, and as a result has a large number of properties and methods available to it. You can see this if you go to the String object page and look down the list on the side of the page! Now, before your brain starts melting, don't worry! You really don't need to know about most of these early on in your learning journey. But there are a few that you'll potentially use quite often that we'll look at here. Let's enter some examples into the browser d...
Solve common problems in your JavaScript code - Learn web development
od? How do you create your own functions? How do you run (call, or invoke) a function? What is an anonymous function? How do you specify parameters (or arguments) when invoking a function? What is function scope? What are return values, and how do you use them? Objects How do you create an object? What is dot notation? What is bracket notation? How do you get and set the methods and properties of an object? What is this, in the context of an object? What is object-oriented programming? What are constructors and instances, and how do you create them? What different ways are there to create objects in JavaScript? JSON How do you structure JSON data, and read it from JavaScript? How can you load a JSON file into a page? How do you convert a JSON object to a text string, and bac...
Aprender y obtener ayuda - Learn web development
rch terms do you need to use in your favorite search engine to find the articles you need? It is often fairly obvious what to search for. For example: If you want to find out more about responsive web design, you could search for "responsive web design". If you want to find out more about a specific technology feature, such as the HTML <video> element, or the CSS background-color or opacity properties, or the JavaScript Date.setTime() method, you should just search for the feature's name. If you are looking for some more specific information, you can add other keywords as modifiers, for example "<video> element autoplay attribute", or "Date.setTime parameters". If you want to search for something that has less obvious buzzwords, you need to think about what is most likely to return what you...
HTML performance features - Learn web development
Complications can occur when, for example, the file size of a <video> embed is too large, or when a webpage is not optimized for mobile devices. This module intends to walk you through the key HTML performance features that can drastically improve the quality of your webpage. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. ...
Web performance - Learn web development
such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. This article looks in detail at how HTML can be used to ensure maximum performance. CSS performance features CSS may be a less important optimization focus for improved performance, but there are some CSS features that impact performance more than others. In this article we look at some CSS properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted. Fonts and performance A look at whether you need to include external fonts and, if you do, how to include the fonts your design requires with the least impact on your sites performance. Mobile performance With web access on mobile devices being so popular, and all mobile platfor...
Server-side web frameworks - Learn web development
e server will instead include the update information as "POST data" within the body of the request. The HTTP request may also include information about the current session or user in a client-side cookie. Web frameworks provide programming-language-appropriate mechanisms to access this information. For example, the HttpRequest object that Django passes to every view function contains methods and properties for accessing the target URL, the type of request (e.g. an HTTP GET), GET or POST parameters, cookie and session data, etc. Django can also pass information encoded in the structure of the URL by defining "capture patterns" in the URL mapper (see the last code fragment in the section above). Abstract and simplify database access Websites use databases to store information both to be shared with...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Getting started with Ember - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Ember resources and troubleshooting - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Routing in Ember - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Ember app structure and componentization - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Accessibility in React - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Getting started with React - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
React interactivity: Editing, filtering, conditional rendering - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
React resources - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Beginning our React todo list - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Starting our Svelte Todo list app - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Componentizing our Svelte app - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Deployment and next steps - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Working with Svelte stores - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Getting started with Vue - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Adding a new todo form: Vue events, methods, and models - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Focus management with Vue refs - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Styling Vue components with CSS - Learn web development
interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte stores TypeScript support in Sv...
Understanding client-side JavaScript frameworks - Learn web development
, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. This is what we'll cover in this article. 5. Styling Vue components with CSS The time has finally come to make our app look a bit nicer. In this article, we'll explore the different ways of styling Vue components with CSS. 6. Using Vue computed properties In this article we'll add a counter that displays the number of completed todo items, using a feature of Vue called computed properties. These work similarly to methods but only re-run when one of their dependencies changes. 7. Vue conditional rendering: editing existing todos Now it is time to add one of the major parts of functionality that we're still missing -- the ability to edit existing...
Handling common accessibility problems - Learn web development
yboard. We check what button was pressed via the event object's keyCode property; if it is the keycode that matches Return/Enter, we run the function stored in the button's onclick handler using document.activeElement.onclick(). activeElement gives us the element that is currently focused on the page. Note: This technique will only work if you set your original event handlers via event handler properties (e.g. onclick). addEventListener won't work. This is a lot of extra hassle to build the functionality back in. And there's bound to be other problems with it. Better to just use the right element for the right job in the first place. Text alternatives Text alternatives are very important for accessibility -- if a person has a visual or hearing impairment that stops them being able to see or he...
Setting up your own test automation environment - Learn web development
alert.getText().then(function(text) { console.log('Alert text is \'' + text + '\''); }); alert.accept(); Next, let's try entering some text into one of the form elements. Add the following code and try running your test again: const input = driver.findElement(By.id('name')); input.sendKeys('Filling in my form'); You can submit key presses that can't be represented by normal characters using properties of the webdriver.Key object. For example, above we used this construct to tab out of the form input before submitting it: driver.sleep(1000).then(function() { driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB); }); Waiting for something to complete There are times where you'll want to make WebDriver wait for something to complete before carrying on. For example if you load a new p...
Introducing a complete toolchain - Learn web development
run the following command in your terminal: npm install --save-dev parcel-bundler Using future features The code for our project is using some new web features including features that are so new they aren't fully standardised yet. For example, instead of reaching for a tool like Sass, this particular project uses the W3C proposal for CSS nesting. CSS nesting allows us to nest CSS selectors and properties inside one another thus creating more specific selector scope. Sass was one of the first preprocessors to support nesting (if not the first) but now after many years, nesting looks like it will soon be standardised, which means that we will have it available in our browsers without needing build tools. Until then, Parcel will do the transformation between nested CSS and natively supported CSS wi...
Chrome Worker Modules
.build (if your code is part of the platform) or on chrome manifests (if your code is part of an add-on). Stack traces Unfortunately, the module loader doesn't play nicely with error stack traces. That is, the following will not show human-readable stacks: try { MyModule.foo(); } catch (ex) { log("Exception raised at " + ex.fileName) log("Stack: " + ex.stack); } Rather, you should use properties moduleName and moduleStack, as follows: try { MyModule.foo(); } catch (ex) { log("Exception raised at " + ex.moduleName) log("Stack: " + ex.moduleStack); } Subtleties You shouldn't mix both styles exports.foo = bar and module.exports = {foo: bar}. If you do, know that any call to module.exports will overwrite all calls to `exports.foo = bar. You should not modify exports or module...
Accessibility Features in Firefox
cript is allowed to do while you browse. For example, you can disable functions that websites use to move or resize windows, or to remove your status bar, to disable right-click contextual menus, change the status bar text, etc. You can furthermore control javascript capabilities to remove scrollbars, toolbars or system buttons like minimize, close and maximize by editing the about:config related properties or by editing accordingly the user.js file as explained in this "Disable Other JavaScript Window Features" document. Moving back and forward by web page (Alt+Left and Alt+Right) occurs near-instantaneously The download manager provides keyboard access to all of your recent downloads Operating System "Look and Feel" Support: Mozilla's default skin will match the colors and sizes currently being...
Debugging JavaScript
versee or even bad syntax. (The pref also warns on common JavaScript idioms that are not errors). Console.log in Browser Console You can dump variables in the Browser Console from addon code, by adding this line to import the console utility: const { console } = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {}); This has an advantage over dump in that you can list out properties of an object logged with console.log. dump() The dump() function allows you to print text on the native console. Use \n to output a newline at the end. To see anything, you need to set the pref browser.dom.window.dump.enabled to true, e.g. in about:config (add new pref, it doesn't exist per default). Under Microsoft Windows you additionally need to start Firefox via the following command to h...
Configuring Build Options
directly after a clobber build, so pulling in new updates and rebasing is less time-consuming. Example mozconfig Files Mozilla's official builds use mozconfig files from the appropriate directory within each repository. Warning: These mozconfig files are taken from production builds and are provided as examples only. It is recommended to use the default build options, and only change the properties from the list above as needed. The production builds aren't really appropriate for local builds. Firefox, Debugging Build (Mac OS X 64bits) Thunderbird, Debugging Build (Linux 64 bits) Building multiple applications from the same source tree It is possible to build multiple applications from the same source tree, as long as you use a different objdir for each application. You c...
Gecko Logging
, "timestamp" and "rotate": set MOZ_LOG="example_logger:3,timestamp,sync,rotate:10" To adjust the logging after Firefox has started, you can set prefs under the logging. prefix. For example, setting logging.foo to 3 will set the log module foo to start logging at level 3. The special boolean prefs logging.config.sync and logging.config.add_timestamp can be used to control the sync and timestamp properties described above. Redirecting logging output to a file Logging output can be redirected to a file by passing its path via an environment variable. By default logging output goes to stderr. set MOZ_LOG_FILE="log.txt" The rotate and append options described above only apply when logging to a file. The special pref logging.config.LOG_FILE can be set at runtime to change the log file being ou...
Interface Compatibility
ages involved. Web Content APIs which are visible to web content are not modified, except as a last resort when inherent security vulnerabilities or incompatibility with other browsers make it the only option. Any changes, including new features, must have super-review. One exception to this rule is APIs which are explicitly shipped with Mozilla prefixes as a technology preview. This includes CSS properties that begin with the -moz- prefix (e.g. -moz-box-shadow), or JavaScript APIs that begin with the moz prefix (e.g. canvasrenderingcontext.mozDrawText). These APIs may be removed or replaced with standard interfaces in future releases of Mozilla. Jetpack The Jetpack SDK and APIs are not yet complete. The stable version 1.0 of the Jetpack SDK is planned for later in 2010. Documented APIs which are ...
Obsolete Build Caveats and Tips
rce using CVS. In reality, you should probably not need to do this, since that code is very obsolete. This note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx Note: Starting with Gecko 7.0, you should no longer include "-Zc:wchar_t-" in the command line when building on Windows. If you're using Visual Studio, go to Project Properties > C/C++ > Language > Treat wchar_t as Built-in Type and set it to "yes". From Source_Code/Mercurial mozilla-2.0 (Firefox 4.0) Code for the Firefox 4.0 (Gecko 2.0) release lives in releases/mozilla-2.0. To get this code, do the following: # Pull the Mozilla source to the folder 20src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.o...
Experimental features in Firefox
an audio output device on an HTMLMediaElement, thereby changing where the audio is being output. See bug 934425 for more details. Release channel Version added Enabled by default? Nightly 64 No Developer Edition 64 No Beta 64 No Release 64 No Preference name media.setsinkid.enabled HTMLMediaElement properties: audioTracks and videoTracks Enabling this feature adds the HTMLMediaElement.audioTracks and HTMLMediaElement.videoTracks properties to all HTML media elements. However, because Firefox doesn't currently suport multiple audio and video tracks, the most common use cases for these properties don't work, so they're both disabled by default. See bug 1057233 for more details. Release channe...
Limitations of chrome scripts
e shim The shim will give you a CPOW for the content object in these situations. In some situations, the content process may not be initialized when an add-on asks for access to its content. In this case, the shim will return a JavaScript object that looks somewhat like a window or a document for about:blank. However, this "dummy" object is completely static and only exposes a few of the normal properties that windows and documents have. For this reason, add-ons that try to access content objects in fresh <browser> elements may run into trouble. To make the shim unnecessary: factor the code that needs to access content into a separate script, load that script into the content process as a frame script, and communicate between the chrome script and the frame script using the message-passing APIs. ...
Performance best practices for Firefox front-end engineers
nk about the problem. Note that some items in the list may be browser-specific or subject to change, and that an item not occurring explicitly in the list doesn't mean it doesn't cause reflow. For instance, at time of writing accessing event.rangeOffset triggers reflow in Gecko, and does not occur in the earlier link. If you're unsure whether something causes reflow, check! Note how abundant the properties in that first list are. This means that when enumerating properties on DOM objects (e.g. elements/nodes, events, windows, etc.) accessing the value of each enumerated property will almost certainly (accidentally) cause uninterruptible 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 1434...
HTMLIFrameElement.getContentDimensions()
ment.body.scrollWidth and document.body.scrollHeight. 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. The X and Y dimensions are available in the request.result.x and request.result.y properties, respectively. Parameters None. Examples var browser = document.querySelector('iframe'); var request = browser.getContentDimensions(); request.onsuccess = function() { console.log("page size:", request.result.width + "x" + request.result.height); } request.onerror = function() { console.log("Download error"); } Specification Not part of any specification. ...
mozbrowseraudioplaybackchange
will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowseraudioplaybackchange event is fired when audio starts or stops playing within a browser <iframe>. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Boolean Indicates whethe...
mozbrowserclose
it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowserclose event is fired when the content of a browser <iframe> calls the window.close() method. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. Example var br...
mozbrowserdocumentfirstpaint
ll not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowserdocumentfirstpaint event is fired when a new paint occurs on any document in the browser <iframe>. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. Example var br...
mozbrowserfirstpaint
also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowserfirstpaint event is fired when the <iframe> paints content for the first time (this doesn't include the initial paint from about:blank). General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. Example var br...
mozbrowserloadstart
future. The mozbrowserloadstart event is fired when the browser <iframe> starts to load a new page. This can be used when the embedder wants to start spinning a loading indicator, or update the UI in some other way to indicate loading has started. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> 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. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. Example In thi...
mozbrowsertitlechange
ery user. There may also be large incompatibilities between implementations and the behavior may change in the future. The mozbrowsertitlechange event is fired when the title of a browser <iframe> (i.e. the contents of the <title> element) changes. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. detail Read only String The title of the d...
mozbrowserusernameandpasswordrequired
en the content within a browser <iframe> requires an HTTP authentification. The embedder is supposed to retrieve the necessary credentials, usually using a dialog or a database of username/passwords, and then call authenticate() or cancel() as appropriate. General info Specification Non standard Interface CustomEvent Bubbles Yes Cancelable Yes Target <iframe> Default Action None Properties Property Type Description target Read only EventTarget The browser iframe type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
::-moz-tree-indentation
Activated by the properties attribute. Associated Elements <xul:treeitem> Style Properties position ...
::-moz-tree-progressmeter
Activated when the type attribute is set to progressmeter. Associated elements <xul:treecell> Style properties margin color ...
::-moz-tree-twisty
Activated by the properties attribute. Associated Elements <xul:treecell> Style Properties border margin padding display list-style position -moz-appearance ...
overflow-clip-box
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 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 ...
smartcard-insert
typeRead only DOMString The type of event. ...
smartcard-remove
typeRead only DOMString The type of event. ...
Gecko Chrome
This page contains information specific to Chrome code running in Gecko. Chrome-only API referenceThis page lists APIs that only run in Gecko Chrome code (and sometimes in other privileged circumstances.)Chrome-only CSS referenceThis page lists CSS properties that are only available in Gecko Chrome code (and sometimes in other privileged circumstances, eg. UA stylesheets.) Chrome-only Events referenceThis page lists events that are only available in Gecko Chrome code (and sometimes in other privileged circumstances, eg. UA widgets). ...
Embedding the editor
omposer window is current owned by the nsEditorShell, which in turn is created, owned and destroyed by the nsEditorBoxObject. The box object is a layout structure that is owned by content nodes, and survives frame destruction/recreation. The box object also has a reference to the docShell for the editor frame. XBL creates an nsEditorBoxObject for each <editor> tag, and allows JavaScript to access properties of this box object (such as the nsIEditorShell). The <editor> tag is simply a <iframe> on which an editor is created; in all other respects, it behaves like a XUL <iframe>. The problem with this ownership model is that there can be only one editor per <editor> tag, yet the document loaded in the <iframe> may itself contain multiple <iframe>s (consider a frameset document, or a document itself con...
Embedding Tips
uld create the new browser window in the specified style and hand back the nsIWebBrowserChrome interface to it. nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); if (wwatch) { wwatch->SetWindowCreator(myWindowCreator); } I need the JavaScript inside the browser window to talk to my embedding client. ...
Gecko Keypress Event
Gecko 1.9 key handling changed significantly after Beta 5 (bug 359638, bug 429510 and the bugs on which they depend). The changes were risky so late in the release schedule, but they were necessary for fixing the many key handling bugs. charCode of DOM keypress event If a keypress event is fired without any modifier keys (Ctrl/Alt(Option)/Meta(Win/Command)), then the properties of the event are the same as they were in Gecko1.8.1. That is, when the currently selected keyboard layout produces a Unicode character (according to the current state of CapsLock and NumLock), the charCode property contains that character. When the keypress event includes modifier keys, sometimes the charCode value is replaced with an ASCII character according to the following rules. The accel key depends on the...
AddonInstall
e() or getInstallForURL() methods on the AddonManager. Once you have an instance the install() method is used to start automatic download and installation. This can be canceled at any time with the cancel() method. Method Overview void install() void cancel() void addListener(in InstallListener listener) void removeListener(in InstallListener listener) Properties Attribute Type Description name string The name of the add-on being installed. version string The version of the add-on being installed. iconURL string The icon of the add-on being installed. releaseNotesURI nsIURI The URI of release notes for this install. type string The type of the add-on being installed...
AddonManager
autoUpdateDefault boolean Whether add-ons should auto-update by default (overrideable per add-on). Corresponds to the extensions.autoUpdateDefault preference. Callbacks InstallCallback() A callback that is passed a single AddonInstall void ...
AddonType
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. ...
UpdateInfo
...
Add-on Repository
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 th...
AsyncShutdown.jsm
// No specific guarantee about completion of profileBeforeChange }); If the promise returned by condition is not resolved/rejected within one minute, the process will crash to avoid blocking system shutdown, preventing the user from restarting Firefox or burning through battery. This is by design. It is the caller's responsibility to ensure that the promise is eventually resolved/rejected. Properties Attribute Type Description profileBeforeChange Read only Phase The profile is about to be unmounted. This phase represents the last chance to write data to the profile directory. sendTelemetry Read only Phase Telemetry is being sent. This phase represents the last chance for Telemetry to write data. webWorkersShut...
Dict.jsm
u 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 element being the key and the second being the value. Note: The order in which items are returned is arbitrary, and may...
DownloadList
e already in the list. Promise addView( Object aView ); Parameters aView The view object to add. The following methods may be defined: onDownloadAdded: Optional This function is called with a single Download argument, after the download is added to the end of the list. onDownloadChanged: Optional This function is called with a single Download argument, after the properties of the download change. onDownloadRemoved: Optional This function is called with a single Download argument, after the download is removed from the list. Promise resolves to undefined when the view has been registered and all the onDownloadAdded notifications for the existing downloads have been sent. removeView() Removes a view that was previously added using addView(). Promise re...
DownloadSource
isPrivate Read only boolean Indicates whether the download originated from a private window. This determines the context of the network request that is made to retrieve the resource. ...
DownloadSummary
Provides an aggregated view on the contents of a DownloadList. A reference to a DownloadSummary object can be obtained using the Downloads.getSummary() function. Method overview Promise bindToList(DownloadList aList); Promise addView(Object aView); Promise removeView(Object aView); Properties Attribute Type Description allHaveStopped Read only boolean Indicates whether all the downloads are currently stopped. progressTotalBytes Read only number Indicates the total number of bytes to be transferred before completing all the downloads that are currently in progress. For downloads that do not have a known final size, the number of bytes cu...
Log.jsm
doAppend(); getInputStream(); newOutputStream(); outputStream reset(); 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: "W...
NetUtil.jsm
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.nsIProperties). get("TmpD", Ci.nsIFile); file.append("test-file.tmp"); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); // Then, we need an output stream to our output file. var ostream = Cc["@mozilla.org/network/file-output-stream;1"]. createInstance(Ci.nsIFileOutputStream); ostream.init(file, -1, -1, 0); // Finally, we need an input stream to take data from. const TEST_DATA = ...
Deferred
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 no...
Promise
hen(). Promise catch( Function onReject ); The following calls are therefore identical: p.then(undefined, logError); p.catch(logError); Debugging By design, the instant state and value of a promise cannot be inspected synchronously from code, without calling the then() method. To help with debugging, only when inspecting a promise object manually, you can see more information as special properties that are inaccessible from code (this, at present, is implemented by randomizing the property name, for the lack of more sophisticated language or debugger support). These code-inaccessible, inspectable properties are: {{private:status}}: 0 for pending, 1 for fulfilled, or 2 for rejected. {{private:value}}: Fulfillment value or rejection reason, for fulfilled or rejected promises only. {{pr...
Promise.jsm
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 for details. resolve() Creates a new promise fulfilled with the specified value, or propagates the state of an existing promise. Promise resolve( aValue ); Parameters aValue Optional If this value is not a promise, including undefined, it becomes the fulfillment value of the returned promise. If this value is a promise, then the returned promise will be ...
Deferred
Methods resolve() Fulfills the associated promise with the specified value, or propagates the state of an existing promise. ...
PromiseUtils.jsm
ides 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. ...
PromiseWorker.jsm
rd) messages (optional) dump('Worker: ' + args.join(' ') + '\n'); }; // Connect it to message port. self.addEventListener('message', msg => worker.handleMessage(msg)); AbstractWorker is a base class for the worker, and it's designed to be used by derived class, which provides above four methods (dispatch, postMessage, close, and log). but you can instantiate AbstractWorker itself and set its properties later, instead of creating derived class. Main thread file The BasePromiseWorker object needs to be imported: const { utils: Cu } = Components; const { BasePromiseWorker } = Cu.import('resource://gre/modules/PromiseWorker.jsm', {}); let myWorker = new BasePromiseWorker('path_to_worker_file.js'); You're now ready to start using PromiseWorker. Sending a message from main thread To send a me...
Services.jsm
rd nsIClipboard Clipboard console nsIConsoleService Error console service contentPrefs nsIContentPrefService Content Preferences service cookies nsICookieManager2 Cookie Manager 2 service cpmm nsIMessageSender Child process message manager4 crashmanager CrashManager.jsm dirsvc nsIDirectoryService nsIProperties Directory service domStorageManager nsIDOMStorageManager DOM Storage Manager DOMRequest nsIDOMRequestService DOMRequest service downloads nsIDownloadManager Download manager droppedLinkHandler nsIDroppedLinkHandler Dropped link handler service els nsIEventListenerService Event listener service eTLD nsIEffect...
Sqlite.jsm
n by the onRow handler, the exception is logged and processing of subsequent rows occurs as if nothing happened. The promise is still resolved (not rejected). The return promise will be rejected with an Error instance if the statement did not finish execution fully. The Error may have an errors property. If defined, it will be an Array of objects describing individual errors. Each object has the properties result and message. result is a numeric error code and message is a string description of the problem. If onRow is specified, the returned promise will be resolved with a boolean indicating whether the onRow handler was called. Else, the resolved value will be an array of mozIStorageRow. executeTransaction(func, type) This function is used to execute a database transaction. A transaction is a ...
Task.jsm
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 Constructor Constructs a special exception that, when thrown inside a legacy generator function, allows the associated task to be resolved with a specific value. Example: Task.spawn( function() { yield ... ; throw new Task.Result("Value"); } Note: If you want to exit early from a generator function, without retu...
Using JavaScript code modules
// 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 "[object Object]" The main effect of the by-value copy is that global variables of simple types won't be shared across scopes. Always put va...
Localization notes
lizable files themselves, too. These comments are generally referred to as localization notes. There is an established format for those, which is described in this document. It's important to follow the format as closely as possible. There are a number of automated tools that parse these comments for easier access and use by localizers. DTD files <!-- LOCALIZATION NOTE (entity name): comment --> Properties files # LOCALIZATION NOTE (key): comment File-wide comments should use the same format, be at the top of the file (after the license header, though) and just drop the (entity name/key) reference. ...
Localizing extension metadata on addons.mozilla.org
for AMO fields localization on the forums, and these fields will be added soon to the Web Translation System. Amazon Mechanical Turk This is not free, but for a very modest amount of money you can get your AMO page quickly translated by native speakers. Create an account and then, using the "Basic Open-ended Question" template, follow the instructions to upload the text of your AMO page. On the Properties page you can specify the location of the worker in order to restrict to people living in the country where the language is spoken. The Reward is up to you, but $5-10 per translation seems to work well. Localization codes AMO offers 33 localizations, including English. Here is a list of the codes: Arabic (ar), Catalan (ca), Czech (cs), Danish (da), German (de), Greek (el), Basque (eu), Spanish ...
Localizing with Mercurial
id> cd C:\mozilla-build\hg PS C:\mozilla-build\hg> .\add_path.exe /result . Note the dot (".") at the end of the second command, which means the current directory. If the utility modified your %PATH% successfully, a dialog will open saying, "%PATH% has been updated correctly." Alternatively, you can edit the %PATH% variable manually. In order to do so, right-click on your computer icon, choose Properties > Advanced > Environmental Variables, select PATH and click Edit. If you don't see PATH among the options, you'll have to click Add and edit it within the Add dialog. See the screenshot for an example. Did it work? Go to Start > Run... Type cmd.exe and click OK. A new shell window should appear. Type hg --version in the new shell window. If you see a message about the version of Mercurial ...
Patching a Localization
dir (in this example it is located in your home directory): mkdir ~/localization-workdir Navigate to the directory you just created. cd ~/localization-workdir Clone the localization repository for your locale and for the version you want to patch: hg clone http://hg.mozilla.org/releases/l10n/mozilla-aurora/gl Now that you have the code and your working directory, edit the DTD and properties files to make your necessary changes. Creating a l10n patch You've made your changes, now create your patch. Navigate to your working localization directory. cd ~/localization-workdir/gl Create a patch (also known as a diff) using the diff command. hg diff This command creates a patch and lists your modifications through displaying the differences in a unified patch's files. These modi...
QA phase
s with 2 changes to 2 files bb/acl: your_id is allowed. accepted payload. quota: 979.7 KB in use, 150.0 MB available (0.64% used) Your changeset has been successfully pushed to your repository! As you begin to move through your translations, you should commit the changes locally and push your work to this experimental repository. For instance, if you have finished translating all the .dtd and .properties files in your x-testing/browser/chrome/browser/ directory, then you should run these commands: $ hg status $ hg commit -m "Translated browser/chrome/browser/" $ hg outgoing $ hg push http://hg.mozilla.org/l10n-central/x-testing Note that due to the distributed nature of Hg, hg commit saves the changes locally (i.e., in your computer's Hg repository). You can see the history of commits with hg l...
Creating localizable web content
player on the page instead of linking to a video section in English. Per-locale customizations Check if there are alternative links for localized pages (e.g., links to MDN, Addons.mozilla.org, or other external resources, are there translated equivalents we can use). If there are alternatives, use them by adding the $lang; parameter in the urls Evaluate the impact of new pages on all our web properties, especially links to community sites and redirects. Sometimes you can leave some freedom of modification for a block of text so that the localizers link to relevant local resources. Images Check that images are not going to be a problem for the audience (cultural references, positionning, mirroring for rtl, text in images...) and spot what sizes/margins can be tweaked by CSS or have to be fixe...
Writing localizable code
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 them as long variable names. If you change the semantics of a localized string, change the key. This will more likely be a good key name, and it will help tools to pick up that the change you do is different from just a spell fix. Try not to assume grammar in composite strings Splitting sentences into several keys often inadvertently presumes a grammar, a...
Mozilla DOM Hacking Guide
oInstance so there is no real point in documenting them further. GetClassInfoInstance is used in the NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO macro, which is used to implement QueryInterface for the nsIClassInfo interface in most of the DOM classes, and in the NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO macro, which is used to implement QueryInterface for the nsIClassInfo interface in most global object properties. I think that's all there is to say about this function. If you think of something else don't hesitate to contact me, as usual. nsWindowSH::GlobalResolve() This Section will describe in detail the absolutely horrific GlobalResolve() member function of the nsWindowSH helper, as an example of those functions. This is not for the faint of heart, and is not absolutely necessary, so you might want ...
Measuring performance using the PerfMeasurement.jsm code module
fore calling code_to_be_benchmarked(), and disable it as soon as it returns, the code in set_up_some_state() and clean_up_afterward() is not measured. The monitor object automatically accumulates counts over start/stop cycles (that is, it doesn't automatically zero the counters each time you start recording). When you're done benchmarking, you can read out each of the counters you asked for as properties: let report = "CPU cycles: " + monitor.cpu_cycles + "\n" + "Cache refs: " + monitor.cache_references + "\n" + "Cache misses: " + monitor.cache_misses + "\n"; monitor.reset(); alert(report); The reset() method clears all of the enabled counters, as you might expect. When you're done with your measurements, just let the monitor object go out of scope. ...
MailNews automated testing
vel. Testing frameworks The AsyncTestUtils Extended Framework supports: Asynchronous test operation: A reasonably convenient means of writing tests that involve asynchronous operations by using generators. In the long term we would like to lose this extra complexity in favor of the event-loop-spinning style of operation used by mozmill. Message synthesis: Create messages by specifying what properties the messages should have. Message injection: Inject synthesized messages via local or IMAP (using a fake server). Message manipulation: Mark messages as read, tag them, untag them, move them to other folders, trash them, etc. Enhanced logging: Supports generating rich JSON streams to disk or over the network for consumption by LogSploder or other tools. Performance testing Mail leak and blo...
Midas
ocument editable by setting the designMode property of the document object; this is how Midas is invoked in Gecko. Internet Explorer also supports the ability to edit specific elements using the contentEditable attribute; Starting with Firefox 3, Gecko also supports contentEditable. Once Midas is invoked, a few more methods of the document object become available. You can try demo of this here. Properties document.designMode By setting this property to "on", the document becomes editable. Notes Since an entire document becomes editable, authors often load the editable document into an IFRAME and do the bulk of the scripting in the parent document. According to standards, The IFRAME element has the contentDocument property that refers to the document in the inline frame. It also has a proper...
NSS Tools
CMS operations such as encrypting, decrypting, and signing messages. Source, Documentation crlutil Manage certificate revocation lists (CRLs). Source, Documentation, dbck 1.0 Analyze and repair certificate databases (not working in NSS 3.2) Source, Tasks/Plans modutil 1.1 Manage the database of PKCS11 modules (secmod.db). Add modules and modify the properties of existing modules (such as whether a module is the default provider of some crypto service). Source, Documentation, Tasks/Plans pk12util 1.0 Import and export keys and certificates between the cert/key databases and files in PKCS12 format. Source, Documentation, Tasks/Plans signtool 1.3 Create digitally-signed jar archives containing files and/or code. Source,...
Rhino FAQ
ay[0] = "hi". Creating arrays of primitive types is slightly different: you must use the TYPE field. For example, creating an array of seven ints can be done with the code var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 7); When I try to execute a script I get the exception Required security context missing. What's going on? You've likely missed placing the Security.properties file in your class path at org.mozilla.javascript.resources. Can I use Rhino in a web browser? Rhino is a library for Java use, and not for general web browsers. However, a Java-based browser may use Rhino with scripts from a page in the same manner that any other Java program would. ...
Performance Hints
...
JS::Add*Root
oot. Note that this means that if the root is meant to live past the end of a function, the address of a local (stack-based) variable may not be used for vp/rp. If JS::Add*Root succeeds, then as long as this variable points to a JavaScript value or pointer to GC-thing, that value/GC-thing is protected from garbage collection. If the variable points to an object, then any memory reachable from its properties is automatically protected from garbage collection, too. An entry for rp is added to the garbage collector's root set for the JSRuntime associated with cx (or, in JS::AddNamedValueRootRT, the runtime rt). The name parameter, if present and non-null, is stored in the JSRuntime's root table entry along with rp. The name string's lifetime must last at least until the balancing call to JS::Remove*Ro...
JS::CreateError
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::CreateError JSExnType JSErrorReport bug 984048 bug 1038238 -- change stack parameter from JS::HandleString to JS::HandleObject ...
JSCheckAccessOp
ss. (It is also the type of the callback set by JS_SetCheckObjectAccessCallback.) Syntax typedef JSBool (* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode, jsval *vp); Name Type Description 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 succ...
JSConstDoubleSpec
n 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 spare ...
JSDeletePropertyOp
bool *succeeded); 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 within an active request on cx. The callback does not need to call JS_BeginRequest()). obj JS::HandleObject The object whose properties are being deleted. id JS::HandleId The name or index of the property being deleted. This is either a string (Unicode property identifier) or an integer (element index). succeeded bool * Out parameter. Receives the result of deletion. Description JSDeletePropertyOp callback is a hook that applications may install to be called at some point during property acce...
JSEnumerateOp
Name Type Description cx JSContext * Pointer to the JS context in which the enumeration is taking place. obj JS::HandleObject Pointer to the object to be enumerated. Description JSEnumerateOp is called just before an object is enumerated (via a for...in statement, an array comprehension, or a call to JS_Enumerate). It should define any remaining lazy properties that should be enumerable but are not yet defined in obj. This hook does not implement iteration: once the properties are defined, the JavaScript engine can enumerate them. JSClass hooks JSClass offers following hook: The JSClass.enumerate hook is for classes that implement lazy properties using JSClass.resolve. See Also MXR ID Search for JSEnumerateOp JSNewEnumerateOp JSClass ...
JSErrorReport
If NULL, the error is local to the script in the current HTML page. lineno unsigned Line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. ...
JSExtendedClass
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. JSExtendedClass is an extended version of JSClass with additional hooks. A C/C++ program can use a JSExtendedClass with the JS_InitClass and JS_NewObject APIs to create objects that have custom methods and properties implemented in C/C++. Syntax struct JSExtendedClass { JSClass base; JSEqualityOp equality; JSObjectOp outerObject; JSObjectOp innerObject; JSIteratorOp iteratorObject;// Added in SpiderMonkey 1.8 JSObjectOp wrappedObject; // Added in SpiderMonkey 1.8 ...and additional reserved fields. }; Name Type Descrip...
JSExtendedClass.wrappedObject
...
JSFunctionSpec
fines the attributes for a single JS function to associate with an object. An application typically has an array of JSFunctionSpec to define all the functions for an object and calls JS_DefineFunctions or JS_InitClass to create the functions and assign them to an object. JSFunctionSpec can also be used to 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 ...
JSIdArray
Use JS_IdArrayLength and JS_IdArrayGet to access the property, and JS_DestroyIdArray to free, or use JS::AutoIdArray as a local variable. ...
JSNewResolveOp
_NEW_RESOLVE bit is set in the JSClass.flags field. Syntax typedef bool (* JSNewResolveOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp); Name Type Description cx JSContext * Pointer to the JS context in which the property access is taking place. obj JS::HandleObject Pointer to the object whose properties are being accessed. id JS::HandleId Name or index of the property being accessed. flags uint32_t Obsolete since JSAPI 31 Flags giving contextual information about the ongoing property access. objp JS::MutableHandleObject Out parameter. On success, the resolve hook must set *objp to the object in which the property has been defined, or NULL if it was no...
JSObjectOps.dropProperty
torage and locking scheme (by copying all or most of the built-in JSObjectOps) or replace it entirely. Threads. In a JS_THREADSAFE build, any consistency observed by multiple threads operating on the same data is provided solely by the property locking scheme described above. In SpiderMonkey 1.8 and earlier, the main built-in JSObjectOps implementation serialized all accesses to a given object's properties. (That is, for each object, all property accesses happened in some order, and what each thread observed was consistent with that order: no stale reads, for example.) However, SpiderMonkey does not guarantee this high degree of serialization. ...
JSObjectOps.lookupProperty
uch as JSObjectOps.getProperty, is overloaded in a way that does not call lookupProperty). Syntax typedef JSBool (*JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp); Name Type Description cx JSContext * Pointer to the JS context in which the property lookup is happening. obj JSObject * The object whose properties are being searched. id jsid The name or index of the property to look up. objp JSObject ** Out parameter. If the property is found, the callback stores the object on which the property was found in *objp. propp JSProperty ** Out parameter. On success, the callback stores in *propp a pointer to the property, if it exists, or NULL if it doesn't. D...
JSProperty
Internal use only. The type of JavaScript object properties, used by the JSObjectOps layer. Syntax struct JSProperty { jsid id; }; Description JSProperty is the abstract base class of all object properties. It is used internally in JSObjectOps.lookupProperty, getAttributes, setAttributes, and dropProperty. See Also bug 483473 ...
JS_Add*Root
oveRoot. Note that this means that if the root is meant to live past the end of a function, the address of a local (stack-based) variable may not be used for rp. If JS_Add*Root succeeds, then as long as this variable points to a JavaScript value or pointer to GC-thing, that value/GC-thing is protected from garbage collection. If the variable points to an object, then any memory reachable from its properties is automatically protected from garbage collection, too. JS_AddGCThingRoot allows the caller to have a single root that may hold either strings or objects. A jsval is not a GC-thing (it has tag bits and may be a different size altogether) and thus the address of a jsval variable must not be passed to JS_AddGCThingRoot. Do not pass a pointer to a JS string or object to any of these functions--r...
JS_AliasProperty
an alias does not change the length of the property array. If the property name you specify does not exist, JS_AliasProperty reports an error, and returns JS_FALSE. If the property is currently out of scope, already exists, or the alias itself cannot be assigned to the property, JS_AliasProperty does not report an error, but returns JS_FALSE. Once you create an alias, you can reassign it to other properties as needed. Aliases can also be deleted. Deleting an alias does not delete the property to which it refers. See Also JS_DefineProperty JS_DefinePropertyWithTinyId JS_DeleteProperty JS_GetProperty JS_LookupProperty JS_SetProperty bug 576034 ...
JS_ClearScope
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. Remove all properties associated with an object. Syntax void JS_ClearScope(JSContext *cx, JSObject *obj); Name Type Description cx JSContext * The context in which to clear the object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object from which to delete all properties. Description JS_ClearScope removes all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation. Properties belonging to objects on obj's prototype chain are not affected. To remove a single...
JS_DefineElement
for the new property. On success, JS_DefineElement returns true. Otherwise it returns false. Obsolete since JSAPI 32. ...
JS_DefineFunction
ch apply to the new property. On success, JS_DefineFunction and JS_DefineUCFunction return a pointer to the new function. ...
JS_DefineOwnProperty
terpretable 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 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_DeleteElement
ed. If deletion is successful, JS_DeleteElement returns true. Otherwise it returns false. For JavaScript 1.2 and earlier, if failure occurs because you attempt to delete a permanent or read-only element, JS_DeleteElement reports the error before returning false. For JavaScript 1.3 and later, the attempt is silently ignored. To truncate an array, use JS_SetArrayLength. To remove all elements and properties from an object, call JS_ClearScope. See Also MXR ID Search for JS_DeleteElement bug 1113369 -- added result parameter ...
JS_DeleteProperty
e property is removed. These functions return true on success, regardless of whether a property was actually deleted, and false on error or exception. (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.) Internally, property deletion is implemented by the JSObjectOps.deleteProperty callback. To remove all properties from an object, call JS_ClearScope. See Also MXR ID Search for JS_DeleteProperty MXR ID Search for JS_DeletePropertyById JS_DeleteProperty2 JS_DeletePropertyById2 bug 461163 bug 1113369 -- added result parameter and JS_DeleteUCProperty ...
JS_DeleteProperty2
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_DeleteUCProperty2 MXR ID Search for JS_DeletePropertyById2 bug 461163 bug 1113369 -- renamed to JS_DeleteProperty ...
JS_ExecuteRegExp
ified 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. If successful, JS_ExecuteRegExp and JS_NewRegExpObjectNoStatics returns true and stores the result to *rval, otherwise returns false and the value of *rval is undefined See Also MXR ID Search for JS_ExecuteRegExp MXR ID Search for JS_ExecuteRegExpNoStatics RegExp bug 571355 - added JS_ExecuteRegExpNoStatics function ...
JS_FreezeObject
FreezeObject(JSContext *cx, JS::Handle<JSObject*> obj); 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::Handle&lt;JSObject*&gt; An object to freeze. Description Freezes an object. This means that other code cannot delete, add or change any properties on the object. See ES5's Object.freeze method. See also MXR ID Search for JS_FreezeObject JavaScript Reference: The Object.freeze method of Object JS_DeepFreezeObject bug 492849 ...
JS_GetFunctionObject
nction implemented by a JSNative (or JSFastNative) or the result of a call to JS_CompileFunction or similar functions. In other cases, the object returned by JS_GetFunctionObject is not necessarily safe to call and should not be exposed to script. In the JavaScript language, functions are objects. But in the JSAPI there are two separate concepts: a JSObject is what is exposed to scripts and has properties and can be stored in variables; and the corresponding JSFunction contains the code of a function. For certain functions, the two have a strictly one-to-one relationship, and for those functions it is safe to call JS_GetFunctionObject to move from the JSFunction to the JSObject. However, for other functions, and particularly for JavaScript closures, many JSObjects may share the same JSFunction. I...
JS_GetGlobalObject
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. Retrieves a context's global object. (In JavaScript, global variables are stored as properties of the global object.) Syntax JSObject * JS_GetGlobalObject(JSContext *cx); Name Type Description cx JSContext * The context from which to retrieve the global object. Description This function is obsolete: use JS_GetGlobalForObject or JS_GetGlobalForScopeChain instead. The concept of a global object belonging to a context will likely be phased out in future versions of SpiderMonkey. JS_GetGlobalObject retrieves the global object for a specified JSContext *, cx. This returns NULL...
JS_GetProperty
r of Proxy (only if the object is a Proxy) or its JSObjectOps.getProperty method is called. Otherwise the property is found on a native object. If the property has a JavaScript getter, it is called. Otherwise *vp is set to the property's stored value, or undefined if the property does not have a stored value, and then the property's getter is called with the arguments (cx, obj, id, vp). For many properties, the getter does nothing and returns true, so the property get succeeds and the property's stored value is left in *vp. Internally, property retrieval, including all the behavior described above, is implemented by obj's JSObjectOps.getProperty callback. On success, these functions set *vp to the current value of the property, or undefined if obj has no such property, and return true. On an err...
JS_GetPrototype
equires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object for which to retrieve the prototype. protop JS::MutableHandleObject Out parameter. If successful, Receives prototype object of obj. Description JS_GetPrototype retrieves the prototype of a specified object, obj. A prototype object provides properties inherited by similar JS objects. This is the equivalent of Object.getPrototypeOf(obj) from javascript. If JS_GetPrototype returns false, that signals an exception, which should be handled as usual. Otherwise, it stores a pointer to the prototype or null to *protop and returns true. To set an object's prototype, use JS_SetPrototype. See Also MXR ID Search for JS_GetPrototype JS_SetPrototype...
JS_GetReservedSlot
live. 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. See Also MXR ID Search for JS_GetReservedSlot MXR ID Search for JS_SetReservedSlot bug 1184564 -- Changed jsval to JS::Value ...
JS_GetScopeChain
peChain(JSContext *cx); Name Type Description cx JSContext * The context to query. Description JS_GetScopeChain returns the first JSObject on the scope chain for the JavaScript code currently running in the given context, cx. The ECMAScript standard, ECMA 262-3 ?10, describes execution contexts and scope chains. A scope chain is a sequence of objects whose properties are searched whenever a script or function refers to a variable. These objects represent the lexical scope of the currently executing statement or expression, not the call stack, so they include: the variable objects of any enclosing functions or let statements or expressions, and any objects selected by enclosing with statements, in order from the most-nested scope outward; lastly the global...
JS_InstanceOf
his way, pass the arguments provided by the engine for args with JS::CallArgsFromVp(argc, vp). When args is non-null, JS_InstanceOf behaves as follows. If obj is of the given class, it returns true. Otherwise, it returns false; it also reports a TypeError containing the function's name. Note that JS_InstanceOf is not the equivalent of the JavaScript instanceof keyword, which examines constructor properties along the prototype chain. JS_HasInstance is similar to instanceof. See Also MXR ID Search for JS_InstanceOf JS_HasInstance JS_GetClass bug 959787 ...
JS_LookupElement
arch. index uint32_t The numeric id of the property to look up. vp JS::MutableHandleValue Out parameter. On success, *vp receives the stored value of obj[index], or undefined if the element does not exist. Description JS_LookupElement examines a specified JavaScript object, obj, for a numeric property numbered index. Note: In the JavaScript language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. For example, obj[6] is always exactly the same as obj["6"]. The ECMAScript standard also specifies this behavior: see ECMA 262-3 ?11.2.1, step 6. So any call to JS_LookupElement is equivalent to a call to JS_LookupProperty passing a numeric string for the name. If the property obj[index] exists, JS_LookupEleme...
JS_LookupProperty
to tell the difference between not finding any property and finding a property whose value is undefined. Sorry. Use JS_GetPropertyDescriptorById instead. JS_LookupUCProperty is the Unicode version of JS_LookupProperty. Flags JS_LookupPropertyWithFlags and JS_LookupPropertyWithFlagsById allow the caller to specify flags requesting special lookup behavior. When executing JavaScript code that uses properties, SpiderMonkey looks up properties using slightly different rules depending on the syntactic context in which the property name appears. (The JavaScript engine simply passes these flags through to the object when it calls the object's JSClass.resolve callback, so objects of a custom JSClass may interpret these flags however they like.) If flags is 0, JS_LookupPropertyWithFlags uses the default loo...
JS_NewObject
null, the caller must ensure that the JSClass remains alive throughout the lifetime of the new object, including the garbage collection cycle that finally frees it. The usual way to do this is to make JSClasses global or static. proto JS::Handle&lt;JSObject*&gt; Pointer to the prototype object to use for the new object. The new object will inherit all of the prototype object's properties and methods, and the new object's __proto__ property will be a reference to the prototype object. JS_NewObject: If this is NULL, a default prototype object is used. Obsolete since JSAPI 38 JS_NewObject now always uses a default prototype object. JS_NewObjectWithGivenProto: If this is NULL, the new object has no prototype; its __proto__ property is undefined. parent ...
JS_NewRegExpObject
JSREG_FOLD Fold uppercase to lowercase. i JSREG_GLOB Global execution, creates array of matches. g JSREG_MULTILINE Treat ^ and $ as begin and end of line. m JSREG_STICKY Only match starting at lastIndex. y Description JS_NewRegExpObject and JS_NewUCRegExpObject create a new RegExp instance. The flags from the built-in RegExp constructor properties ignoreCase, global, multiline, and sticky are OR'd in with the provided flags parameter. JS_NewRegExpObjectNoStatics and JS_NewUCRegExpObjectNoStatics create a new RegExp instance. They do not OR in any RegExp constructor properties. See Also MXR ID Search for JS_NewRegExpObject MXR ID Search for JS_NewUCRegExpObject MXR ID Search for JS_NewRegExpObjectNoStatics MXR ID Search for JS_New...
JS_NewScriptObject
ated JSObject script object. As long as the script object is reachable, the JSScript and its components are protected from garbage collection; when the script object is collected, the JSScript and its contents are freed. Once you have created a script, you should immediately ensure that its script object is reachable (perhaps by using JS_AddRoot or JS_EnterLocalRootScope). A script object has no properties, and its prototype is Object.prototype. So a script object can be used to expose a JSScript to JavaScript code, but the code can't do much of anything with it. On success, JS_NewScriptObject returns a pointer to the script's object. Otherwise it returns NULL. (The name "JS_NewScriptObject" suggests that the script object is freshly allocated; this was the case in older versions of the API, but ...
JS_SetAllNonReservedSlotsToUndefined
egardless of the associated property descriptor. Syntax void JS_SetAllNonReservedSlotsToUndefined(JSContext *cx, JSObject *objArg); Name Type Description cx JSContext * The context in which to clear the object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object from which to delete all properties. Description JS_SetAllNonReservedSlotsToUndefined assignes undefined to all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation. Properties belonging to objects on obj's prototype chain are not affected. See Also MXR ID Search for JS_SetAllNonReservedSlotsToUndefined bug 749371 ...
JS_SetCheckObjectAccessCallback
Description JS_SetCheckObjectAccessCallback sets the runtime-wide check-object-access callback, which is used as the fallback JSClass.checkAccess method for all classes that leave the checkAccess field NULL. This callback is also used to check access to the caller property of function objects (as, for example, when the JavaScript engine creates a stack trace) and to check access from scripts to properties with scripted getters or setters. JS_SetCheckObjectAccessCallback returns the previous check-object-access callback. MXR ID Search for JS_SetCheckObjectAccessCallback ...
JS_SetGlobalObject
ULL. 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_SetProperty
ect, 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 property is added, the JSClass.addProperty hook is called ...
JS_SetPropertyAttributes
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 *. 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. Other...
JS_SetPrototype
e context in which to set the object's prototype. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The object to modify. proto JS::HandleObject The object to set as the new prototype of obj. Description JS_SetPrototype sets the prototype object for a specified object. A prototype object provides properties that are shared by similar JS object instances. Ordinarily you set a prototype for an object when you create the object with JS_NewObject, but if you do not set a prototype at that time, you can later call JS_SetPrototype to do so. obj is a pointer to an existing JS object, and proto is a pointer to second existing object upon which the first object is to be based. On success, JS_SetPrototype ret...
JSDBGAPI
gerFrame 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 JSPropertyDesc JSPD_ENUMERATE JSPD_READONLY JSPD_PERMANENT JSPD_ALIAS JSPD_ARGUMENT JSPD_VARIABLE JSPD_EXCEPTION JSPD_ERROR typedef JSPropertyDescArray JS_PropertyIterator JS_GetPropertyDesc JS_GetPropertyDescArray JS_PutPropertyDescArray Hooks JS_SetDebuggerHandler JS_SetSourceHandler JS_SetExecuteHook JS_SetCallHook JS_SetObjectHook JS_SetThrowHook JS...
Setting up CDT to work on SpiderMonkey
ll, there are a quite a few things that CDT does not pick up yet: For everything to be indexed, CDT has to be aware of the project's build details. Step 3 - Index all the code To let CDT know about the build, it has to invoke make itself (or, as is done in the guide for the whole Mozilla codebase on MDN, read a log of the build), which can be setup with these simple steps: Open the project's properties by selecting its root and clicking "Properties" in the "File" menu and select "C/C++ Build". Under the "Builder Settings" group tab, deactivate "Use default build command". Instead, change "Build command" to read make -w (this is required because CDT needs detailed information about which directories make operates on, which using -w causes make to provide). Change the "Build location" to the b...
TPS Formdata Lists
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 Web PKI x509 certificate primer
iew of what these are and how they work. Three versions of the x509 standard have been defined for web-pki. In this document we will be referring to the current standard in use for web pki: x509 v3, which is described in detail in RFC 5280. In general, x509 certificates bind a signature to a validity period, a public key, a subject, an issuer, and a set of extensions. The extensions define extra properties of the certificate such as extra attributes of the certificate or constraints on the use of the certificate. In order for a certificate to be valid these three requirements must be met: There is a verification path from the site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is considered trusted by the br...
Setting up an update server
e other win64 files that are part of that nightly release). If you've built your own MAR, you can obtain its sha512 checksum by running the following command, which should work in Linux, macOS, or Windows in the MozillaBuild environment: shasum --algorithm 512 <filename> On Windows, you can get the exact file size in bytes for your MAR by right clicking on it in the file explorer and selecting Properties. You'll find the correct size in bytes at the end of the line that begins "Size", not the one that begins "Size on disk". Be sure to remove the commas when you paste this number into the XML file. On macOS, you can get the exact size of your MAR by running the command: stat -f%z <filename> Or on Linux, the same command would be: stat --format "%s" <filename> Starting your update server Now,...
Gecko events
<< AT APIs Support Page This page offers a list of Accessibility-related events supported by Gecko. Event constants are defined in nsIAccessibleEvent interface. EVENT_DOM_CREATE An object has been created. Is Supported: yes EVENT_DOM_DESTROY An object has been destroyed. Is Supported: yes EVENT_DOM_SIGNIFICANT_CHANGE An object's properties or content have changed significantly so that the type of object has really changed, and therefore the accessible should be destroyed or recreated. Is Supported: yes EVENT_ASYNCH_SHOW A hidden object is shown -- this is a layout occurance and is thus asynchronous Is Supported: yes EVENT_ASYNCH_HIDE An object is hidden -- this is a layout occurance and is thus asynchronous Is Supported: yes EVENT_ASYNCH_SIGNIFICANT_CHANGE An object had a signifi...
Feed content access API
to fetch the feed's title as HTML-encoded text. We could, alternatively, use its plainText() method to get a copy of the title translated into plain text. We then scan the array of items in the feed by looking at the feed.items nsIArray. This array contains nsIFeedEntry objects that describe each feed item. We build the contents of the document by looking at the title, link, summary, and content properties for each item. The full URL of the link is retrieved using the link's resolve() method. To initialize a fetch of the feed, we simply call fetch(url). This opens a new window containing the feed contents, with each item's title a clickable link that takes you to the article itself. For details on each of the feed access interfaces, visit their respective reference pages. ...
Mork
Mozilla › Tech › Mork
typically column-scoped (:c). Next is the status column (s), which is defined as a single digit that is the priority (which appears to be unused), a 'u' if it is unique (i.e., the only table of its kind), and a 'v' if it is verbose (which also appears to be unused). The presence of a row or rowReference in the meta-table indicates that said row is the meta-row of the table: it contains arbitrary properties for the entire table just like a normal row. For example, the message summary format files use a table for each thread, where the meta-rows represent information about the thread in general. The last important point about tables is the meaning of the minuses. A minus before the table ID indicates that all the rows currently stored in the table should be removed before adding more rows. A minus ...
History Service Design
e foreign key on other tables. This table has common attributes for a page like typed, hidden and frecency. Certain scheme are excluded from history, so they will never be added, for example: about, view-source, chrome. If a page can be added we first check if it exists already, then it is added or updated accordingly to the previous check, and common attributes are set based on concurrent visit properties. Typed means the page as a typed visit, hidden means the page should not be shown in autocomplete, while frecency is the relevance the page will have in locationbar queries. Finally observers are notified a new visit has been added. Every visit is identified by its visit date, and a visit type (also known as transition type) that represents how we have come to that page (typed, click, redirect, ...
Querying Places
ers 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. RESULTS_AS_VISIT: This option returns one entry for each time a page was v...
XML Extras
es is through examples. There are some in extensions/xmlextras/tests/. If you follow that link to look at the examples you will need to look at page source for the HTML documents. For XMLHttpRequest object you can mostly rely on the Microsoft XMLHttpRequest documentation, with some caveats: all functions and property names begin with a lower case letter and the object creation is different. Some properties are not implemented. Thad Hoffman has written a document that shows how you can mimic XML Data Islands in Mozilla. Edmond Woychowsky has also written articles on XML Data Islands in Mozilla: "Make XML data islands work in Mozilla", "Build cross-browser XML paging code" and "Implement a flexible shopping cart with XML and ASP". The Mozilla Developer Center has several pages for XMLHttpRequest. B...
Accessing the Windows Registry Using XPCOM
ntVersion", wrk.ACCESS_READ); var id; if (subkey.hasValue("ProductId")) id = subkey.readStringValue("ProductId"); subkey.close(); } wrk.close(); Enumerating Registry Keys and Values In some situations, you may want to enumerate a number of keys or values whose names you do not know. The nsIWindowsRegKey interface provides the childCount, getChildName(), valueCount, and getValueName() properties and methods for enumerating keys and values respectively. You can use these methods to read a list of values or recursively access a branch of the registry. This example reads all the startup programs in one key of the registry. var wrk = Components.classes["@mozilla.org/windows-registry-key;1"] .createInstance(Components.interfaces.nsIWindowsRegKey); wrk.open(wrk.ROOT_KEY_LO...
Aggregating the In-Memory Datasource
nce that would never unwind. Notes Describing all of the vagaries of XPCOM aggregation is beyond the scope of this document. The basic idea is to overload QueryInterface(), allowing it to return adelegate object that supports the interface. There is some trickery involved on the delegate's part to ensure that reference counting is done sanely, and that the reflexive, symmetric, and transitive properties of QueryInterface() are preserved. If you're really interested, I'd recommend reading about it in a COM book. For more information on writing a datasource, see the RDF Datasource How-To document. You could also forward other interfaces to the mInner that youknow it can support; however, this is extremely risky. It's risky because another implementation of the same object mightnot support those ...
XPCOM glue
Mozilla › Tech › XPCOM › Glue
6.0. Use this when you have a custom application where you want to embed Gecko to show webpages in your own window. I.e. this linkage strategy is used when an embedder needs to bootstrap XPCOM by finding a compatible GRE on disk and loading it. In order to use XPCOM, the embedding application first needs to find where the XPCOM runtime is located. This is typically done using GRE_GetGREPathWithProperties. Then, the code must call XPCOMGlueStartup, which will dynamically link against the XPCOM runtime. Only then can the embedding application initialize and use XPCOM. Embedding code which wishes to use only frozen symbols and cannot tolerate a load-time dependency on xpcom.dll should #define XPCOM_GLUE 1 while compiling, and link against xpcomglue.lib. It should not link against xpcomglue_s.lib or...
Setting up the Gecko SDK
ings are typically handled in a Makefile. The Makefile allows you to specify any number of options for your build environment, including the path and configuration updates you need to build with the Gecko SDK. Below is a listing for a Makefile that configures your compiler to work with the SDK. Explaining the details of the Makefile is outside the scope of this appendix, but it modifies the same properties that are configured in the Visual C++ project (see Building a Microsoft Visual Cpp Project). For a listing of the commands that appear in this listing, see the Make manual. Sample Makefile for the Gecko SDK MODULE = MozShim # Change this to point at your Gecko SDK directory. GECKO_SDK_PATH ?= $(HOME)/tmp/xr XPIDL ?= $(GECKO_SDK_PATH)/bin/xpidl CXX ?= c++ XPIDLSRCS = \ Inter...
Introduction to XPCOM for the DOM
tion 1.E.d. These rules are pretty simple, and are widely used in the DOM code. It gets trickier with a lot of classes and interfaces, but you can always reduce the problem to the above situation. Example Let's take a look at a simple example, the HTML Anchor Element. First, let's illustrate the interface inheritance rules. If we look at nsIDOMHTMLAnchorElement (which contains the methods and properties defined by the W3C for this element), we can see that it inherits from another interface, nsIDOMHTMLElement: interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement This means that whatever class implements the nsIDOMHTMLAnchorElement interface will also have to implement the nsIDOMHTMLElement interface. If we look at nsIDOMHTMLElement, we can see that it inherits from nsIDOMElement, which inher...
Components.classesByID
Each property represents one of the classes of XPCOM components that can be constructed or accessed as an XPCOM service. Components.classesByID is exactly like Components.classes except that the elements are indexed by the canonical form of their CID, and does not only represent the component classes that have been registered with the component manager using a ContractID, but also those registered using a plain CID. ...
Components.lastResult
own 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 returned by bar() (assuming that bar() is called via XPConnect), and Components.lastResult contains the success code...
Components.results
Elements in this array can be used to test against 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. ...
Components.utils.cloneInto
; In this way privileged code, such as an 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 omitte...
Components.utils.evalInSandbox
Sandbox() to evaluate JSON strings; instead, use the techniques discussed in the article on JSON. You can also find Firefox 3.5 specific information in Using JSON in Firefox. Use To use evalInSandbox(), you must first create a sandbox object using its constructor, Components.utils.Sandbox. In the constructor you define the security principal for code running in the sandbox, and can make various properties available to code running in the sandbox. The sandbox 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/...
Components.utils.import
. 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 mozIJSSubScriptLoader: The behavior when importing/loading the same code from different locations: the subscript loader evaluat...
Components.utils.isXrayWrapper
rivileged JavaScript in Gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "Xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways. For example, privileged code using an Xray to a DOM object sees only the original, native version of the DOM object. Any expando properties are not visible, and if any native properties have been redefined, this has no effect. Use this function to determine whether a given object is an Xray or not. Syntax boolean Components.utils.isXrayWrapper(obj); Parameters obj The object to check. Returns true if the object is an Xray: false otherwise. Example var isXray = Components.utils.isXrayWrapper(gBrowser.contentWindow); /...
Components.utils.unwaiveXrays
Undo a previous call to Components.utils.waiveXrays(), restoring Xray vision for the caller. For example, if privileged code accesses a DOM object belonging to web content, it will by default see it using Xray vision, meaning that among other things expando properties added to the object by content are not visible. Privileged code can waive Xray vision using waiveXrays, and it will then see expandos. It can then use unwaiveXrays to restore its Xray vision for the object. The waiveXrays operation is transitive: it waives Xrays not just for the given object, but for all properties of the object (and their properties, and so on). The unwaiveXrays operation undoes the operation, so Xray vision is restored transitively as well. Syntax xray = Components.utils.unwaiveXrays(obj); Parameters o...
Components object
time! In current versions of Firefox only a few interfaces required for compatibility are still accessible. Don't use Components! The Components object is the object through which XPConnect functionality is reflected into JavaScript. The Components object is actually a native instance of the nsIXPCComponents interface which is reflected into JavaScript as a top level object using XPConnect. Some properties of Components require advanced privileges and may not work in web pages. The Components object has the following members: classes array of classes by ContractID classesByID array of classes by CID Constructor constructor for constructor of components Exception constructor for XPConnect exceptions ID constructor for XPCOM nsIDs interfaces array of i...
HOWTO
...
XPCShell Reference
t(prop + "=" + arguments[prop]); } Entering the following at the command line should 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 ...
Observer Notifications
n Manager Topic Subject Data Description perm-changed nsIPermission "deleted"/"added"/"changed"/"cleared" This notification is sent when a permission changes. The subject of the notification is the permission object. Context menu Topic Subject Data Description content-contextmenu An object containing two properties: event The event that triggered the context menu. addonInfo An empty object that add-ons can use to send data to the main process. null This notification is sent when the context menu is displayed. It is sent, and received, in the content process: you can't listen to it in the chrome process. It's used by the context-menu module in the Add-on SDK...
amIInstallTrigger
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 method is deprecated, please use install() in the future. boolean installChrome( in PRUint...
mozIJSSubScriptLoader
tWithOptions(in string url, in Object options); Methods loadSubScript() Synchronously loads and executes the script from the specified URL. As of Gecko 8.0, scripts are loaded from the startup cache where possible. The loaded script is executed with the principal associated with the target object. Any top-level functions or variables created by 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 ch...
mozIRegistry
ring CLSID information in the registry and using that information, along with nsRepository, to implement some instance creation protocol on top of the core XPCOM services. I think these things can be divided into two categories, according to the basic service they provide: Identifying the implementers of a given interface. Figuring out an appropriate implementation given some arbitrary desired properties. nsRepository This is basically the same as is provided today (see mozilla/xpcom/public/nsRepository.h). The primary change to this component is that we will modify it to utilize the new mozIRegistry interface versus the NSReg.h functions it calls today. In addition, it likely will have a couple of minor extensions: Support for specifying the .reg file name on Initialize(). I think this mig...
mozIStorageStatementWrapper
ntWrapper interface is a storage statement wrapper. When you call the mozIStorageConnection interface's createStatement() method, you get a mozIStorageStatement which has just direct bindings to SQLITE. You can then wrap that statement with a wrapper, which implements nsIXPCScriptable and provides scriptable helpers letting you execute the statement as a function, access bind variables by name as properties, etc. Firefox 3.5 note Firefox 3.5 adds support for these features directly into the mozIStorageStatement interface, so this interface is essentially deprecated. storage/public/mozIStorageStatementWrapper.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 ...
Attributes
<< nsIAccessible Page Summary Attributes of accessible. ...
GetState
Many states are only valid given a certain role attribute that supports them. Refer to states documentation for more information. ...
nsIAccessibleEvent
NT_ATK_WINDOW_DEACTIVATE 0x0120 EVENT_ATK_WINDOW_DESTROY 0x0121 EVENT_ATK_WINDOW_MAXIMIZE 0x0122 EVENT_ATK_WINDOW_MINIMIZE 0x0123 EVENT_ATK_WINDOW_RESIZE 0x0124 EVENT_ATK_WINDOW_RESTORE 0x0125 EVENT_DOM_CREATE 0x0001 An object has been created. EVENT_DOM_DESTROY 0x0002 An object has been destroyed. EVENT_DOM_SIGNIFICANT_CHANGE 0x0003 An object's properties or content have changed significantly so that the type of object has really changed, and therefore the accessible should be destroyed or recreated. EVENT_ASYNCH_SHOW 0x0004 A hidden object is shown -- this is a layout occurrence and is thus asynchronous. EVENT_ASYNCH_HIDE 0x0005 An object is hidden -- this is a layout occurrence and is thus asynchronous. EVENT_ASYNCH_SIGNIFICANT_CHA...
nsIAccessibleHyperLink
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Method overview nsIAccessible getAnchor(in long index); Note: Renamed from getObject in Gecko 1.9 nsIURI getURI(in long index); boolean isSelected(); Obsolete since Gecko 1.9 boolean isValid(); Obsolete since Gecko 1.9 Attributes Attribute Type Description anchorCount long The number of anchors within this Hyperlink. Is normally 1 for anchors. ...
nsIBlocklistPrompt
ons, [optional] in PRUint32 aCount); Methods prompt() Prompt the user about newly blocked addons. The prompt is then responsible for soft-blocking any addons that need to be afterwards. void prompt( [array, size_is(aCount)] in nsIVariant aAddons, in PRUint32 aCount Optional ); Parameters aAddons An array of addons and plugins that are blocked. ...
nsIBrowserBoxObject
...
nsIClassInfo
sID 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 The language type in which this class is implemented. See nsIProgrammingLanguage.Constants for a list of possible values. Read only. Constants Bitflags for 'flags' attribute. Constant Value Descr...
nsIContainerBoxObject
...
nsIDOMNSHTMLDocument
dom/interfaces/html/nsIDOMNSHTMLDocument.idlScriptable This interface defines methods and properties supported by Gecko on the document object that are not part of DOM Level 2. Inherits from: nsISupports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview void captureEvents(in long eventFlags); void clear(); boolean execCommand(in DOMString commandID, in boolean doShowUI, in DOMString value); boolean execCommandShowHelp(in DOMString commandID); Obsolete since Gecko 14.0 DOMString getSelection(); nsIDOMDocument open(in ACString aContentType, in boolean aReplace); boolean queryCommandEnabled(in DOMString commandID); boolean queryCommandIndeterm(in DOMString commandID); ...
nsIDownloadManager
tion 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-progress. This calls cancel(NS_BINDING_ABORTED) on the nsICancelable ...
nsIDragService
nd drop operations. Inherits from: nsISupports Last changed in Gecko 43 (Firefox 43 / Thunderbird 43 / SeaMonkey 2.40) Note: Using this interface directly from add-on code is deprecated. Add-ons should use the standard dataTransfer drag and drop API instead. The only exception is getCurrentSession(), since there's currently no way to check for a drag in progress using standard DOM methods or properties. Method overview void endDragSession( in PRBool aDoneDrag ) ; void dragMoved(in long aX, in long aY); Native code only! void fireDragEventAtSource(in unsigned long aMsg); Obsolete since Gecko 43 void fireDragEventAtSource(in mozilla::EventMessage aEventMessage); Native code only! nsIDragSession getCurrentSession( ) ; void invokeDragSessio...
nsIEditorBoxObject
...
nsIExternalHelperAppService
e helper app with this data. nsIStreamListener doContent( in ACString aMimeContentType, in nsIRequest aRequest, in nsIInterfaceRequestor aWindowContext, in boolean aForceSave ); Parameters aMimeContentType The content 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. ...
nsIFilePicker
cker dialog was closed by the user hitting 'Ok' returnCancel 1 The file picker dialog was closed by the user hitting 'Cancel' returnReplace 2 The user chose an existing file and acknowledged that they want to overwrite the file Filter constants These constants are used to create filters for commonly-used file types. For the most up to date list see filepicker.properties. Constant Value Description filterAll 0x001 Corresponds to the *.* filter for file extensions. All files will pass through the filter. filterHTML 0x002 Corresponds to the *.html, *.htm, *.shtml and *.xhtml filters for file extensions. filterText 0x004 Corresponds to the *.txt and *.text filter for file extensions. filterImages ...
nsIFrameMessageListener
face is used when implementing out-of-process handling of frames; the process handling 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. sync A boolean value indicating whether or not the message should be handled synchronously. If true, the response should be returned in the specified JSON object. json The JSON object in which to return the response if the message is being handled synchronously. objects Unimplemented An array of cpow, or null ...
nsIIFrameBoxObject
iframe element implements this interface. Note: Please consider using nsIContainerBoxObject instead. Attributes Attribute Type Description docShell nsIDocShell Read only. Obsolete since Gecko 1.9 The nsIDocShell object that manages the contained document. The general.xml binding uses this property to gain access to the webNavigation, contentDocument and contentWindow properties. ...
nsIINIParserWriter
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 AUTF8String aKey, in AUTF8String aValue); void writeFile([optional] in nsIFile aINIFile, [optional] in unsigned long aFlags); Constants File writing constants These constants...
nsIJumpListItem
m 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 nsIJumpListItem item ); Parameters item Another nsIJumpListItem to compare to. Return value true if items are the same, otherwise false ...
nsILoginMetaInfo
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 nsIUUIDGenerator is recommended. For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}" timeCreated unsigned long long The time, in Unix Epoch milliseconds, when the login was first created. timeLastUse...
nsIMarkupDocumentViewer
Inherits from: nsISupports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Method overview void scrollToNode(in nsIDOMNode node); void sizeToContent(); Attributes Attribute Type Description allowPlugins boolean If true, plugins are allowed within the doc shell. default = true. ...
nsIMessageBroadcaster
s crashed. Parameters Name Type Description messageName String The name of the message. Optional. This becomes the name property of the received message. obj Object. The message payload. A structured clone of this becomes the data property of the received message. objects Object. An object each of whose properties is an object. This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. getChildAt() Return a single subordinate message manager. Parameters Name Type Description aIndex Number The index of the subordinate message manager to retrieve. Returns nsIMessageListenerMana...
nsIMessageSender
s crashed. Parameters Name Type Description messageName String The name of the message. Optional. This becomes the name property of the received message. obj Object. The message payload. A structured clone of this becomes the data property of the received message. objects Object. An object each of whose properties is an object. This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. principal nsIPrincipal ...
nsIMimeConverter
tring 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. 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() v...
Building an Account Manager Extension
: Create the new panel As next Step we create the XUL and the property file for your new panel. We defined in Step 1 "devmo-account" as name and "example@mozilla.org" as chrome package. This means the XUL file for the new panel has to be located in chrome://example@mozilla.org/content/am-devmo-account.xul. And the property file needs to be in chrome://example@mozilla.org/locale/am-devmo-account.properties. The XUL file needs a page element as root element, with a special on load command. Furthermore you should include the AccountManager.js script and accountManage.css styles. It is common practice to use for the JavaScript of the new panel, the same naming as used for the XUL. This means in our example, the JavaScript file should be located in chrome://example@mozilla.org/content/am-devmo-account...
nsIMsgDatabase
r GetMsgHdrForKey(in nsMsgKey key); Parameters key getMsgHdrForMessageID() nsIMsgDBHdr getMsgHdrForMessageID(in string messageID); Parameters messageID ContainsKey() Returns whether or not this database contains the given key. boolean ContainsKey(in nsMsgKey key); Parameters key CreateNewHdr() Must call AddNewHdrToDB after creating. The idea is that you create a new header, fill in its properties, and then call AddNewHdrToDB. AddNewHdrToDB will send notifications to any listeners. nsIMsgDBHdr CreateNewHdr(in nsMsgKey key); AddNewHdrToDB() void AddNewHdrToDB(in nsIMsgDBHdr newHdr, in boolean notify); CopyHdrFromExistingHdr() nsIMsgDBHdr CopyHdrFromExistingHdr(in nsMsgKey key, in nsIMsgDBHdr existingHdr, in boolean addHdrToDB); ListAllKeys() [noscript] void ListAllKeys(in nsMsgKeyArr...
nsIMsgFolder
ttings nsIMsgDownloadSettings sortOrder long Used for order in the folder pane, folder pickers, etc. lastMessageLoaded nsMsgKey Unique ID to the folder, it is not a globally unique identifier. Will return nsMsgKey_None if there was no last message loaded. Note: Does not persist across sessions. URI ACString Readonly: Old nsIFolder properties and methods. name AString Old nsIFolder properties and methods. prettyName AString Old nsIFolder properties and methods. abbreviatedName AString Readonly: Old nsIFolder properties and methods. parent nsIMsgFolder Old nsIFolder properties and methods. parentMsgFolder nsIMsgFolder Readonly: Handy accessor when we want a msg ...
nsINavBookmarkObserver
temChanged( 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 the automatic regeneration of properties that will then be leaked into the database, causing trouble later. aIsAnnotationProperty Indicates whether or not aProperty is the name of an item annotation. If this is true, aNewValue is always an empty string. aNewValue The items...
get
...
getKeys
...
has
...
set
...
undefine
...
nsIPropertyBag2
xpcom/ds/nsIPropertyBag2.idlScriptable This interface extends nsIPropertyBag with some methods for getting properties in specific formats. Inherits from: nsIPropertyBag Last changed in Gecko 1.0 Method overview nsIVariant get(in AString prop); ACString getPropertyAsACString(in AString prop); AString getPropertyAsAString(in AString prop); AUTF8String getPropertyAsAUTF8String(in AString prop); boolean getPropertyAsBool(in AString prop); double getPropertyAsDouble(in AString prop); PRInt32 getPropertyAsInt32(in AString prop); PRInt64 getPropertyAsInt64(in AString prop); void getPropertyAsInterface(in AString prop, in nsIIDRef iid, [iid_is(iid), retval] out nsQIResult result); PRUint32 getPropertyA...
nsIPropertyElement
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. ...
nsIScriptableUnicodeConverter
This legacy API represents binary data using the lower haft of each 16-bit code unit in a JavaScript string. If the other APIs you are reading data from or writing data to don't require you to use this legacy representation, you should use TextDecoder and TextEncoder (available to chrome JavaScript via Components.utils.importGlobalProperties) instead of this API. intl/uconv/idl/nsIScriptableUConv.idlScriptable This interface is a Unicode encoder for use by scripts. Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/scriptableunicodeconverter. To create an instance, use: var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Components.inter...
nsISessionStore
ring getWindowState( in nsIDOMWindow aWindow ); Parameters aWindow The browser window whose state is to be returned. See #Note on windows. Return value A JSON string representing a session state that contains only the window specified by aWindow. If the preference browser.sessionstate.enabled is false when this method is called, then you will get an exception about "aWindows[i] has no properties". getWindowValue() Returns the string value associated with a given key for a window. AString getWindowValue( in nsIDOMWindow aWindow, in AString aKey ); Parameters aWindow The window from which the value is to be retrieved. aKey The key whose corresponding value is to be retrieved. Return value The string value that was previously assigned to aKey using nsISessionStore.setWindo...
nsITaskbarPreviewButton
These buttons are displayed below the window preview. 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) You can't directly instantiate this interface. Instead, you use the nsITaskbarWindowPreview.getButton() to get the objects representing the buttons. Attributes Attribute Type Description disabled boolean If true, the button is disabled. ...
nsITaskbarPreviewController
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) Clients should provide their own implementation of this interface. Depending on whether the controller is connected to an nsITaskbarTabPreview or nsITaskbarWindowPreview, only certain methods and attributes need to be implemented. ...
nsITelemetry
readonly boolean A flag indicating whether Telemetry is recording pre-release data. Does not indicate whether Telemetry will send any data. That is governed by user preference and other 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 newHisto...
nsITreeSelection
rameters 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. getRangeCount() R...
nsIWritablePropertyBag2
xpcom/ds/nsIWritablePropertyBag2.idlScriptable This interface extends nsIPropertyBag2 with methods for setting properties. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIPropertyBag2 Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void setPropertyAsACString(in AString prop, in ACString value); void setPropertyAsAString(in AString prop, in AString value); void setPropertyAsAUTF8String(in AString prop, in AUTF8String value); void setPropertyAsBool(in AString prop, in boolean value); void setPropertyAsDouble(in AString prop, in double value); void setPropertyAsInt32(in AString prop, in PRInt32 value); void setPropertyAsInt64(in AString prop, in PRInt64 value); ...
nsIXMLHttpRequest
the DOM XMLHttpRequest object. Note: If you're a web developer or a Mozilla add-on developer, please refer to the XMLHttpRequest documentation instead. This page contains documentation, specific to Mozilla application and add-on developers. The interface definition: //github.com/RealityRipple/UXP/blob/master/dom/xhr/nsIXMLHttpRequest.idl Elevated Privileges As mentioned in the "Non-Standard Properties" the property of channel was read-only. When using the XPCOM interface, as seen below in Example 2, we can get access to this. The most obvious benefit is that we can set nsiRequest - Constants in the xhr.channel.loadFlags. For instance, as done in Example 2, the flag of LOAD_ANONYMOUS is added, this strips all user data (cookies, tokens, etc). Using event handlers from native code (Not sure if...
nsIXPConnect
cript,notxpcom] PRBool defineDOMQuickStubs( in JSContextPtr cx, in JSObjectPtr proto, in PRUint32 flags, in PRUint32 interfaceCount, [array, size_is(interfaceCount)] in nsIIDPtr interfaceArray ); Parameters cx A context. Requires request. proto The (newly created) prototype object for a DOM class. The JS half of an XPCWrappedNativeProto. flags Property flags for the quick stub properties--should be either JSPROP_ENUMERATE or 0. interfaceCount The number of interfaces the class implements. interfaceArray The interfaces the class implements; interfaceArray and interfaceCount are like what nsIClassInfo.getInterfaces returns. Return value Missing Description Exceptions thrown Missing Exception Missing Description Native code only!evalInSandboxObject Evaluate script i...
nsMsgRuleActionType
Defined in comm-central/ mailnews/ base/ search/ public/ nsMsgFilterCore.idl typedef long nsMsgRuleActionType; [scriptable, uuid(59af7696-1e28-4642-a400-fa327ae0b8d8)] interface nsMsgFilterAction { /* if you change these, you need to update filter.properties, look for filterActionX */ /* these longs are all actually of type nsMsgFilterActionType */ const long Custom=-1; /* see nsMsgFilterAction */ const long None=0; /* uninitialized state */ const long MoveToFolder=1; const long ChangePriority=2; const long Delete=3; const long MarkRead=4; const long KillThread=5; const long WatchThread=6; const long MarkFlagged=7; const long Label=8; const long Reply=9; const long Forward=10; const long StopExecution=11; c...
XPCOM Interface Reference
IPasswordnsIPasswordManagernsIPermissionnsIPermissionManagernsIPipensIPlacesImportExportServicensIPlacesViewnsIPluginHostnsIPrefBranch2nsIPrefLocalizedStringnsIPrefServicensIPrincipalnsIPrinterEnumeratornsIPrintingPromptnsIPrivateBrowsingServicensIProcessnsIProcess2nsIProcessScriptLoadernsIProfilensIProfileLocknsIProfileUnlockernsIProgrammingLanguagensIProgressEventSinknsIPromptnsIPromptServicensIPropertiesnsIPropertynsIPropertyBagnsIPropertyBag2nsIPropertyElementnsIProtocolHandlernsIProtocolProxyCallbacknsIProtocolProxyFilternsIProtocolProxyServicensIProxyInfonsIPushMessagensIPushServicensIPushSubscriptionnsIRadioInterfaceLayernsIRandomGeneratornsIRequestnsIRequestObservernsIResumableChannelnsIRunnablensISHEntrynsISHistorynsISHistoryListenernsISOCKSSocketInfonsISSLErrorListenernsISSLSocketControlns...
XPCOM Interface Reference by grouping
nsIThreadObserver nsIThreadPool nsIThreadPoolListener nsIToolkit Util nsIVersionComparator nsIWeakReference nsIFactory nsIInterfaceRequestor nsIJSCID nsIJSID nsIJSIID nsIModule nsIObserver nsIObserverService nsIProperties nsIProperty nsIPropertyBag nsIPropertyBag2 nsIPropertyElement nsIServerSocket nsIServerSocketListener nsIServiceManager nsISocketProvider nsISocketProviderService nsISocketTransport nsISocketTransportService nsISupports nsIUUIDGenerator Debug nsIStackFrame ...
XPCOM reference
ng). This macro is meant for critical errors; like assertions, NS_ERRORs should not be reachable.NS_IF_ADDREFMacroNS_IF_RELEASEMacroNS_RELEASEMacroNS_WARNINGMacronsGetModuleProcThis 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. nsMsgNavigationTyp...
Setting HTTP request headers
s. You can add your own HTTP headers to any request the application makes, whether the request is initiated by your code explicitly opening an HTTP channel, because of XMLHttpRequest activity, an <img> element in content, or even from CSS. HTTP Channels When you deal with HTTP requests and responses, typically you are doing this with an nsIHttpChannel. The nsIHttpChannel interface has a number of properties and methods, but the method that is of interest to us is setRequestHeader. This method allows us to set an HTTP request header. Below is some sample code where we set an HTTP header. // adds "X-Hello: World" header to the request httpChannel.setRequestHeader("X-Hello", "World", false); In the example code above we have a variable named httpChannel which points to an object implementing nsIHttpCh...
Working with out parameters
lled 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: getTransferData: function(aFlavor, aData, aDataLen) { .. .. aData.value = resultData; aDataLen.value = resultData.length; } ...
wrappedJSObject
two kinds of XPConnect wrappers that support the wrappedJSObject property: XPCNativeWrappers which are used to protect the chrome code working with content objects. See XPCNativeWrapper for detailed documentation. Regular XPConnect wrappers which you can encounter, for example, when using XPCOM components implemented in JS. This article focuses on the latter kind of wrappers, which hide any properties or methods on the component that are not part of the supported interfaces as declared in xpidl. The rest of this article demonstrates what XPConnect wrappers do and how wrappedJSObject can be used to bypass them. Example component To see how the wrappedJSObject property works, we need an example XPCOM component implemented in JS. See How to Build an XPCOM Component in Javascript for details on...
XPCOM
that answers it. You'll have to turn to the XPCOM newsgroup or another experienced nsCOMPtr user, or find the answer by experimentation.Using nsIClassInfoIf you use a C++ class which implements nsIClassInfo from JavaScript, then you don't have to explicitly call QueryInterface on the JavaScript object to access the object's interfaces.Using nsIDirectoryServicensDirectoryService implements the nsIProperties interface. This implementation will allow you to Get(), Set(), Define(), and Undefine() nsIFile.Using nsIPasswordManagerTechnical review completed.Using nsISimpleEnumeratorUsing the clipboardThis section provides information about cutting, copying, and pasting to and from the clipboard.Using the Gecko SDKWeak referenceIn XPCOM, a weak reference is a special object that contains a pointer to an XP...
DB Views (message lists)
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 the thread pane. See the tutorial for information about styling trees using css, and the Thunderbird source for some example css. Text nsITreeView.getCellText (implementation) Tells the nsITreeView what...
MailNews Filters
Finally, add protocol-specific code to apply your filter action in the various ApplyFilterHit methods IMAP POP3 News and "after the fact" Since SeaMonkey and Thunderbird share the filter code, you will also need to update the SeaMonkey .dtd and .property files. I may have missed some places, but that's a start, anyway. It would be really nice if we had a me...
Filter Incoming Mail
You can take a look at a working code in the CapsKiller add-on repository. ...
Use SQLite
// initialization code this.initialized = true; this.dbInit(); }, dbConnection: null, dbSchema: { tables: { attachments:"id INTEGER PRIMARY KEY, \ name TEXT \ encoded TEXT NOT NULL" } }, dbInit: function() { var dirService = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); var dbFile = dirService.get("ProfD", Ci.nsIFile); dbFile.append("tbird.sqlite"); var dbService = Cc["@mozilla.org/storage/service;1"]. getService(Ci.mozIStorageService); var dbConnection; if (!dbFile.exists()) dbConnection = this._dbCreate(dbService, dbFile); else { dbConnection = dbService.openDatabase(dbFile); } this.dbConnection = dbConne...
Styling the Folder Pane
This content covers features introduced in Thunderbird 3 The folder pane in Thunderbird is predominantly controlled by code in folderPane.js. Since Thunderbird 3, the folder pane is designed in a more modular and extensible fashion. It is now possible to place non-mail entities in the folder pane. Treeview row/cell properties CSS Property Equivalent call Explanation folderNameCol -- A property for indicating that a column is the folder name column. hasUnreadMessages-true aFolder.getNumUnread(false) > 0 Indicates that the folder (but not subfolders) has unread messages. isServer-true aFolder.isServer Indicates that the folder is a root folder (one that represents a server). serverType-server aFolder.server.type Retur...
customDBHeaders Preference
act the 'X-Superfluous' field var key = gDBView.getKeyAt(row); var hdr = gDBView.db.GetMsgHdrForKey(key); var retval = hdr.getStringProperty("x-superfluous"); dump("x-superfluous: " + retval + "\n"); return retval; }, getSortStringForRow: function(hdr) { return hdr.getStringProperty("x-superfluous"); }, isString: function() {return true;}, getCellProperties: function(row, col, props){}, getImageSrc: function(row, col) {return null;}, getSortLongForRow: function(hdr) {return 0;} } function addCustomColumnHandler() { gDBView.addColumnHandler("colSuperfluous",columnHandler); dump("column handler being added: " + columnHandler + "\n"); } var CreateDbObserver = { // Components.interfaces.nsIObserver observe: function(aMsgFolder,...
Working with windows in chrome code
able in the above section, which is assigned the return value of window.open. It can be used to access the opened window. The return value of window.open (and similar methods) is a Window object (usually ChromeWindow) - the same type as the window variable. Technically speaking, it implements a number of interfaces, including nsIDOMJSWindow and nsIDOMWindow, but it also contains the user-defined properties for global variables and functions of the window. So, for example, to access the DOM document corresponding to the window, you can use win.document. Note however, that the open() call returns before the window is fully loaded, so some calls, like win.document.getElementById() will fail. To overcome this difficulty, you can move the initialization code to a load handler of the window being opened...
Add to iPhoto
to a temporary file; it then returns the local pathname of the downloaded file to the caller. ...
Type conversion
ng()); // 'POINT(10, 20)' myStruct.v = { x: 10 }; // throws Error myStruct.v = { x: 10, y: 20, z: 30 }; // throws Error myStruct.v = { x: 10, z: 10 }; // throws Error Target Type Source Converted value any struct types JS object (Only if the object has properties for all fields and no other properties) implicitly convert each enumerable property to corresponding field Explicit convert In js-ctypes, data could be converted explicitly, when passing to CData constructor: ctypes.int32_t("123"); // string "123" is parsed as 10-base string Explicit convert tries implicit convert first, and if it fails, the following rules are applied: Boolean typ...
FunctionType
eN 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 Description abi One of the ABI constants The ABI of the function. Read only. argTypes CType[] A sealed array of the argument types. Read only. returnType CType The return type of the function. Read only. Properties inherited from CType These properties are available on all CType objects. Property Type ...
ctypes
used to create and manage a library. Method overview CType ArrayType(type[, length]); CData cast(data, type); CType FunctionType(abi, returnType[, argType1, ...]); CData Int64(n); String libraryName(name); Library open(libSpec); CType PointerType(typeSpec); CType StructType(name[, fields]); CData UInt64(n); Properties Property Type Description errno Number The value of the latest system error. Similar to errno in libc, available on all platforms. Cannot be set. winLastError Number|undefined The value of the latest Windows error. Similar to GetLastError under Windows, available only for Windows. Cannot be set. Constants ABI constants These constants are use...
Constants - Plugins
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 enumerate the properties of an NPObject of that class. << Previous ...
Introduction to DOM Inspector - Firefox Developer Tools
Bindings viewer lists the XBL bindings attached to elements. If a binding extends another binding, the binding menulist will list them in descending order to to "root" binding. The CSS Rules viewer shows the CSS rules that are applied to the node. Alternatively, when used in conjunction with the Style Sheets viewer, the CSS Rules viewer lists all recognized rules from that style sheet in order. Properties may be also be edited. Rules applying to pseudo-elements do not appear. The JavaScript Object viewer gives a hierarchical tree of the object pane's subject. The JavaScript Object viewer also allows JavaScript to be evaluated by selecting the appropriate menuitem in the context menu. Basic actions of the DOM Nodes viewer Selecting elements by click Another powerful interactive feature of the D...
Examine, modify, and watch variables - Firefox Developer Tools
er: Variables are grouped by scope: in Function scope you'll see the built-in arguments and this variables as well as local variables defined by the function like user and greeting. Similarly, in Global scope you'll see global variables you've defined, like greetme, as well as built-in globals like localStorage and console. Each object can be expanded, using a disclosure triangle, to show its properties. Pointing your cursor at a variable's name displays a tooltip that provides additional information about the variable. See Object.defineProperty() for 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...
Use watchpoints - Firefox Developer Tools
In a large, complex codebase, it's not always easy to know where in the code 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. ...
Debugger-API - Firefox Developer Tools
er.Frame represents a running stack frame. You can use these to walk the stack and find each frame's script and environment. You can also set onStep and onPop handlers on frames. A Debugger.Environment represents an environment, associating variable names with storage locations. Environments may belong to a running stack frame, captured by a function closure, or reflect some global object's properties as variables. The Debugger instance itself is not really a shadow of anything in the debuggee; rather, it maintains the set of global objects which are to be considered debuggees. A Debugger observes only execution taking place in the scope of these global objects. You can set functions to be called when new stack frames are pushed; when new code is loaded; and so on. Omitted from this pictu...
Deprecated tools - Firefox Developer Tools
with 3D contexts. Web Audio editor Bugzilla issue: bug 1403944 Removed as of Firefox 67 Description The Web Audio Editor allowed you to examine an audio context constructed in the page and provided a visualization of its graph. This gave a high-level view of its operation, and enabled you to ensure that all the nodes are connected in the way you expect. It was possible to edit the AudioParam properties for each node in the graph. Some non-AudioParam properties, like an OscillatorNode's type property, were displayed and editable as well. It was deprecated due to lack of use. More details about the Web Audio Editor Alternatives Alternatives include AudioN and https://github.com/spite/WebAudioExtension web extensions. Shader editor Bugzilla issue: bug 1342237 Removed as of Firefox 67 Desc...
Dominators view - Firefox Developer Tools
also see that these objects have a relatively tiny "Shallow Size", so almost all of the retained size is in the objects that they dominate. Immediately under each GC root, you'll see all the nodes for which this root is the immediate dominator. These nodes are also ordered by their retained size. For example, if we click on the first Window object: We can see that this Window dominates a CSS2Properties object, whose retained size is 2% of the total snapshot size. Again the shallow size is very small: almost all of its retained size is in the nodes that it dominates. By clicking on the disclosure arrow next to the Function, we can see those nodes. In this way you can quickly get a sense of which objects retain the most memory in the snapshot. You can use Alt + click to expand the whole graph u...
Monster example - Firefox Developer Tools
; } for (var i = 0; i &lt; MONSTER_COUNT; i++) { monsters.undecided.push(new Monster()); } console.log(monsters); } var makeMonstersButton = document.getElementById("make-monsters"); makeMonstersButton.addEventListener("click", makeMonsters); The page contains a button: when you push the button, the code creates some monsters. Specifically: the code creates an object with three properties, each an array: one for fierce monsters one for friendly monsters one for monsters who haven't decided yet. for each array, the code creates and appends 5000 randomly-initialized monsters. Each monster has: a string, for the monster's name a number representing the number of eyes it has a number representing the number of tentacles it has. So the structure of ...
Network monitor toolbar - Firefox Developer Tools
The network monitor provides two toolbar areas, one above the main section, and another below. Toolbar The toolbar is at the top of the main network monitor window. (Prior to Firefox 77, this toolbar was arranged somewhat differently.) It provides: An icon to clear the network request list. A box enabling you to filter requests by URL and by properties. A set of tool icons: Pause (or resume) recording network log Search the log Request Blocking An array of buttons to filter the network request list by type: by the content type of the response XHR requests WebSocket upgrades and messages (labeled WS) Other requests A checkbox that allows you to disable caching. Throttling menu, to simulate various connection types A menu of other actions: Pers...
Edit CSS filters - Firefox Developer Tools
You can edit these lines, remove them individually, or drag the effects to change the order in which they are applied. You can also add new effects by selecting an effect from the dropdown list at the bottom of the dialog. Once you have selected the effect you want to add, click the plus sign (+) to the right of the dropdown list. Once you have added an effect, enter the settings you want and then press Enter to update the effect. The change will be apparent as soon as youpress Enter. ...
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
In the CSS pane In the CSS pane's Rules view, any instance of a display: grid declaration gets a grid icon included within it: . Clicking the icon toggles the display of a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: The overlay is still shown when you select other elements, so you can edit related CSS properties and see how the grid is affected. The Layout view Grid section When grids are included on a page, the CSS pane's Layout view includes a "Grid" section containing a number of options for viewing those Grids. You can find out more about those in the section below. Note: The Layout view can be found underneath the Layout tab on the right-hand pane of the Page Inspector. The above and below scree...
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. ...
Reposition elements in the page - Firefox Developer Tools
New in Firefox 48 Starting in Firefox 48 you can move absolutely positioned elements by dragging them around the page. If an element has its position property set to absolute, relative or fixed and one or more of the top, bottom , left or right properties, the Box Model view displays a button: If you click that button, two handles appear next to the element: You can use these handles to drag the element around the page. If the element is absolutely positioned, dashed lines are shown representing the offset parent. For relatively positioned elements the dashed lines indicate the original position of the node. The offsets are indicated by a line and a tooltip for each side. ...
UI Tour - Firefox Developer Tools
e 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. Click the name of the property to open the reference article for that property on MDN Web Docs. The "Browser compatibility" section of the article gives details of browser support for the property. In ...
Performance - Firefox Developer Tools
verall responsiveness. Call Tree Find bottlenecks in your site's JavaScript. Allocations See the allocations made by your code over the course of the recording. Waterfall Understand the work the browser's doing as the user interacts with your site. Flame Chart See which JavaScript functions are executing, and when, over the course of the recording. Scenarios Animating CSS properties Uses the Waterfall to understand how the browser updates a page, and how animating different CSS properties can affect performance. Intensive JavaScript Uses the frame rate and Waterfall tools to highlight performance problems caused by long-running JavaScript, and how using workers can help in this situation. ...
Rich output - Firefox Developer Tools
When the Web console prints objects, it includes a richer set of information than just the object's name. In particular, it: provides extra information for certain types enables detailed examination of the object's properties provides richer information for DOM elements, and enables you to select them in the Inspector Type-specific rich output The Web Console provides rich output for many object types, including the following: Object Array Date Promise RegExp Window Document Element Event Examining object properties When an object is logged to the console it has a right-pointing triangle next to it, indicating that it can be expanded. Click on the triangle, a...
Firefox Developer Tools
the UI inside which the DevTools all live is the Toolbox. More Tools These developer tools are also built into Firefox. Unlike the "Core Tools" above, you might not use them every day. Memory Figure out which objects are keeping memory in use. Storage Inspector Inspect cookies, local storage, indexedDB, and session storage present in a page. DOM Property Viewer Inspect the page's DOM properties, functions, etc. Eyedropper Select a color from the page. Style Editor View and edit CSS styles for the current page. Taking screenshots Take a screenshot of the entire page or of a single element. Measure a portion of the page Measure a specific area of a web page. Rulers Overlay horizontal and vertical rulers on a web page For the latest developer tools and features, try Firefo...
AbortController - Web APIs
The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired. You can create a new AbortController object using the AbortController.AbortController() constructor. Communicating with a DOM request is done using an AbortSignal object. Constructor AbortController() Creates a new AbortController object instance. Properties AbortController.signal Read only Returns a AbortSignal object instance, which can be used to communicate with/abort a DOM request. Methods AbortController.abort() Aborts a DOM request before it has completed. This is able to abort fetch requests, consumption of any response Body, and streams. Examples In the following snippet, we aim to download a video using the Fetch API. We first...
AbortSignal - Web APIs
AbortSignal.aborted Read only A Boolean that indicates whether the request(s) the signal is communicating with is/are aborted (true) or not (false). Events Listen to this event using addEventListener() or by assigning an event listener to the oneventname property of this interface. ...
AbsoluteOrientationSensor - Web APIs
' device sensors through the Permissions API. 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. Constructor AbsoluteOrientationSensor.AbsoluteOrientationSensor() Creates a new AbsoluteOrientationSensor object. Properties No specific properties; inherits methods from its ancestors OrientationSensor and Sensor. Event handlers No specific event handlers; inherits methods from its ancestor, Sensor. Methods No specific methods; inherits methods from its ancestors OrientationSensor and Sensor. Examples Basic Example The following example, which is loosely based on Intel's Orientation Phone demo, instantiates a...
AbstractRange - Web APIs
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...
AbstractWorker - Web APIs
The AbstractWorker interface of the Web Workers API is an abstract interface that defines properties and methods that are common to all types of worker, including not only the basic Worker, but also ServiceWorker and SharedWorker. As an abstract class, you don't directly interact with AbstractWorker. Properties The AbstractWorker interface doesn't inherit any properties. Event handlers AbstractWorker.onerror An EventListener which is invoked whenever an ErrorEvent of type error bubbles through the worker. Methods The AbstractWorker interface doesn't implement or inherit any methods. Example As an abstract interface, you won't directly use AbstractWorker in your code. Instead, you'll interact with either Worker or SharedWorker, both of which inherit the properties of AbstractWorker. Thi...
Accelerometer - Web APIs
ermission to the 'accelerometer', device sensor through the Permissions API. If a feature policy blocks the 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. Constructor Accelerometer.Accelerometer() Creates a new Accelerometer object. Properties Accelerometer.x Read only Returns a double containing the acceleration of the device along the device's x axis. Accelerometer.y Read only Returns a double containing the acceleration of the device along the device's y axis. Accelerometer.z Read only Returns a double containing the acceleration of the device along the device's z axis. Example Acceleration is typically read in the Sen...
AesCbcParams - Web APIs
This should be set to AES-CBC. iv A BufferSource. The initialization vector. Must be 16 bytes, unpredictable, and preferably cryptographically random. ...
AesCtrParams - Web APIs
hey must not be reused with the same key. A counter. This part of the block gets incremented each time a block is encrypted. Essentially: the nonce should ensure that counter blocks are 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. ...
AesGcmParams - Web APIs
of the Web Crypto API represents the object that should be passed as the algorithm parameter into SubtleCrypto.encrypt(), SubtleCrypto.decrypt(), SubtleCrypto.wrapKey(), or SubtleCrypto.unwrapKey(), when using the AES-GCM algorithm. For details of how to supply appropriate values for this parameter, see the specification for AES-GCM: NIST SP800-38D, in particular section 5.2.1.1 on Input Data. Properties name A DOMString. This should be set to AES-GCM. iv A BufferSource -- the initialization vector. This must be unique for every encryption operation carried out with a given key. Put another way: never reuse an IV with the same key. The AES-GCM specification recommends that the IV should be 96 bits long, and typically contains bits from a random number generator. Section 8.2 of the specifica...
AesKeyGenParams - Web APIs
This should be set to AES-CBC, AES-CTR, AES-GCM, or AES-KW, depending on the algorithm you want to use. length A Number -- the length in bits of the key to generate. ...
AmbientLightSensor - Web APIs
'ambient-light-sensor' device sensor through the Permissions API. 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. Constructor AmbientLightSensor.AmbientLightSensor() Creates a new AmbientLightSensor object. Properties AmbientLightSensor.illuminance Returns the current light level in lux of the ambient light level around the hosting device. 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.mess...
AnalyserNode - Web APIs
eight="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="341" y="30" font-size="12px" font-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. 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 visualizati...
Animation.commitStyles() - Web APIs
Syntax animation.commitStyles(); Parameters None. Return value None. ...
AnimationEffect.getTiming() - Web APIs
Syntax animationTiming = animation.getTiming(); Returns An EffectTiming object. ...
AnimationEffect - Web APIs
ture 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 - Web APIs
ll="#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">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.animationName Read only Is a DOMString containing the value of the animation-name that generated the animation. AnimationEvent.elapsedTime Read only 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, ...
AnimationTimeline - Web APIs
The AnimationTimeline interface 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. ...
AudioBuffer - Web APIs
ode are more suitable. The buffer contains data in the following format: non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffer. Constructor AudioBuffer() Creates and returns a new AudioBuffer object instance. Properties AudioBuffer.sampleRate Read only Returns a float representing the sample rate, in samples per second, of the PCM data stored in the buffer. AudioBuffer.length Read only Returns an integer representing the length, in sample-frames, of the PCM data stored in the buffer. AudioBuffer.duration Read only Returns a double representing the duration, in seconds, of the PCM data stored in the bu...
AudioBufferSourceNode.loopEnd - Web APIs
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 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...
AudioBufferSourceNode.loopStart - Web APIs
io buffer at which each loop should begin during playback. This value is only used when the loop parameter is true. Example In this example, the AudioContext.decodeAudioData() function is used to decode an audio track and put it into an AudioBufferSourceNode. Buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackRate, 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, the audio will start to loop between 20 and 25 seconds in to the track. For a full working example, see this code running live, or view the source. function getData() { source = audioCtx.cr...
AudioBufferSourceNode - Web APIs
ioBufferSourceNode has not already reached the end of the buffer. Number of inputs 0 Number of outputs 1 Channel count defined by the associated AudioBuffer Constructor AudioBufferSourceNode() Creates and returns a new AudioBufferSourceNode object. An AudioBufferSourceNode can be instantiated using the AudioContext.createBufferSource() method. Properties Inherits properties from its parent, AudioNode. AudioBufferSourceNode.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 sp...
AudioConfiguration - Web APIs
The AudioConfiguration dictionary of the 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', ...
AudioContext() - Web APIs
The AudioContext() constructor creates a new AudioContext object which represents an audio-processing graph, built from audio modules linked together, each represented 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.b...
AudioContext.getOutputTimestamp() - Web APIs
n 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 rendered. Syntax var timestamp = AudioContext.getOutputTimestamp() Parameters None. Returns An AudioTimestamp object, which has the following properties. contextTime: A point in the time coordinate system of the currentTime for the BaseAudioContext; the time after the audio context was first created. performanceTime: A point in the time coordinate system of a Performance interface; the time after the document containing the audio context was first rendered Examples In the following code we start to play an audio file after a play button is...
AudioContext - Web APIs
" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">AudioContext</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor AudioContext() Creates and returns a new AudioContext object. Properties Also inherits properties from its parent interface, BaseAudioContext. AudioContext.baseLatency Read only Returns the number of seconds of processing latency incurred by the AudioContext passing the audio from the AudioDestinationNode to the audio subsystem. AudioContext.outputLatency Read only Returns an estimation of the output latency of the current audio context. Methods Also i...
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 specifi...
AudioDestinationNode - Web APIs
of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. The AudioDestinationNode of a given AudioContext can be retrieved using the AudioContext.destination property. Number of inputs 1 Number of outputs 0 Channel count mode "explicit" Channel count 2 Channel interpretation "speakers" Properties Inherits properties from its parent, AudioNode. AudioDestinationNode.maxChannelCount Is an unsigned long defining the maximum number of channels that the physical device can handle. Methods No specific method; inherits methods from its parent, AudioNode. Example There is no complex set up for using an AudioDestinationNode -- by default, this simply represents the output of the user's sy...
AudioListener.dopplerFactor - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.forwardX - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.forwardY - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.forwardZ - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.positionX - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.positionY - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.positionZ - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.setOrientation() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.setPosition() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.speedOfSound - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.upX - Web APIs
Web › API › AudioListener › upX
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.upY - Web APIs
Web › API › AudioListener › upY
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioListener.upZ - Web APIs
Web › API › AudioListener › upZ
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
AudioNodeOptions - Web APIs
onary of the Web Audio API specifies options that can be used when creating new AudioNode objects. AudioNodeOptions is inherited from by the option objects of the different types of audio node constructors. See for example AnalyserNode.AnalyserNode or GainNode.GainNode. 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...
AudioParam.value - Web APIs
Web › API › AudioParam › value
dioParam.defaultValue. Setting value has the same effect as calling AudioParam.setValueAtTime with the time returned by the AudioContext's currentTime property.. Syntax var curValue = audioParam.value; audioParam.value = newValue; Value A floating-point Number indicating the parameter's value as of the current time. This value will be between the values specified by the minValue and maxValue properties. Usage notes Value precision and variation The data type used internally to store value is a single-precision (32-bit) floating point number, while JavaScript uses 64-bit double-precision floating point numbers. As a result, the value you read from the value property may not always exactly equal what you set it to. Consider this example: const source = new AudioBufferSourceNode(...); const r...
AudioParam - Web APIs
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. Properties AudioParam.defaultValue Read only Represents the initial volume of the attribute as defined by the specific AudioNode creating the AudioParam. AudioParam.maxValue Read only Represents the maximum possible value for the parameter's nominal (effective) range. AudioParam.minValue Read only Represents the minimum possible value for the parameter's nominal (effective) range. AudioParam.v...
AudioParamDescriptor - Web APIs
It is used to create custom AudioParams on an AudioWorkletNode. If the underlying AudioWorkletProcessor has a parameterDescriptors static getter, then the returned 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. 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. ...
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. 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. In addition, there are the following properties available: size ? Methods entries() ? forEach() ? has() ? keys() ? values() ? ...
AudioProcessingEvent - Web APIs
The Web Audio API AudioProcessingEvent represents events that occur when a ScriptProcessorNode input buffer is ready to be processed. 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 AudioWorklet. Properties The list below includes the properties inherited from its parent, Event. 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? playbackTime Read only double The time when the audio wi...
AudioScheduledSourceNode - Web APIs
heduledSourceNode 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 no time is specified,...
AudioTrack.enabled - Web APIs
t'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 Standard HTML5The definition of 'AudioTrack.enabled' in that specification. Recommendation ...
AudioTrack - Web APIs
Setting this value to false mutes the track's audio. id Read only A DOMString which uniquely identifies the track within the media. ...
AudioWorklet - Web APIs
to supply custom audio processing scripts that execute in a separate thread to provide very low latency audio processing. The worklet's code is run in the AudioWorkletGlobalScope global execution context, using a separate Web Audio thread which is shared by the worklet and other audio nodes. Access the audio context's instance of AudioWorklet through the BaseAudioContext.audioWorklet property. Properties The AudioWorklet interface does not define any properties of its own, but does inherit properties of Worklet. Methods This interface inherits methods from Worklet. The AudioWorklet interface does not define any methods of its own. Events AudioWorklet has no events to which it responds. Examples See AudioWorkletNode for complete examples of custom audio node creation. Specifications ...
AudioWorkletNode() - Web APIs
e BaseAudioContext instance this node will be associated with. name A string, which represents the name of the AudioWorkletProcessor this node will be based on. A processor with the provided name must first be registered using the AudioWorkletGlobalScope.registerProcessor() method. options Optional An object based on the AudioWorkletNodeOptions dictionary, which contains zero or more optional properties to configure the new node. The result of the structured clone algorithm applied to the object is also internally passed into the associated AudioWorkletProcessor() constructor -- this allows custom initialization of an underlying user-defined AudioWorkletProcessor. Available properties are as follows: numberOfInputs Optional The value to initialize the numberOfInputs property to. Defaults to 1...
AudioWorkletNode - Web APIs
tside them. The AudioWorkletNode interface of the Web Audio API represents a base class for a user-defined AudioNode, which can be connected to an audio routing graph along with other nodes. It has an associated AudioWorkletProcessor, which does the actual audio processing in a Web Audio rendering thread. Constructor AudioWorkletNode() Creates a new instance of an AudioWorkletNode object. Properties Also Inherits properties from its parent, AudioNode. AudioWorkletNode.port Read only Returns a MessagePort used for bidirectional communication between the node and its associated AudioWorkletProcessor. The other end is available under the port property of the processor. AudioWorkletNode.parameters Read only Returns an AudioParamMap -- a collection of AudioParam objects. They are instant...
AudioWorkletNodeOptions - Web APIs
Audio API is used to specify configuration options when constructing a new AudioWorkletNode object for custom audio processing. It is only used when calling the AudioWorkletNode() constructor. During internal instantiation of the underlying AudioWorkletProcessor, the the structured clone algorithm is applied to the options object and the result is passed into AudioWorkletProcessor's constructor. 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 seco...
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
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 Either "a-rate", or "k-rate" string which represents an automation r...
AudioWorkletProcessor.process - Web APIs
h sample value is in range of [-1 .. 1]. The number of inputs and thus the length of that array is fixed at the construction of the node (see AudioWorkletNodeOptions). If there is no active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels available). The number of channels in each input may vary, depending on channelCount and channelCountMode properties. outputs An array of outputs that is similar to the inputs parameter 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 de...
AudioWorkletProcessor - Web APIs
tantiated directly from a user-supplied code. Instead, they are created only internally by the creation of an associated AudioWorkletNodes. The constructor of the deriving class is getting called with an options object, so you can perform a custom initialization procedures -- see constructor page for details. AudioWorkletProcessor() Creates a new instance of an AudioWorkletProcessor object. Properties port Read only Returns a MessagePort used for bidirectional communication between the processor and the AudioWorkletNode which it belongs to. The other end is available under the port property of the node. Methods The AudioWorkletProcessor interface does not define any methods of its own. However, you must provide a process() method, which is called in order to process the audio stream. ...
AuthenticatorAssertionResponse - Web APIs
the Web Authentication API is returned by CredentialsContainer.get() when a PublicKeyCredential is passed, and provides proof to a service that it has a key pair and that the authentication request is valid and approved. This interface inherites from AuthenticatorResponse. Note: This interface is restricted to top-level contexts. Use from within an <iframe> element will not have any effect. Properties AuthenticatorAssertionResponse.clientDataJSON Secure contextRead only The client data for the authentication, such as origin and challenge. The clientDataJSON property is inherited from the AuthenticatorResponse. AuthenticatorAssertionResponse.authenticatorData Secure contextRead only An ArrayBuffer containing information from the authenticator such as the Relying Party ID Hash (rpIdHash)...
AuthenticatorAttestationResponse.attestationObject - Web APIs
ator will create a new keypair as well as an attestationObject for that keypair. The public key that corresponds to the private key that has created the attestation signature is well known; however, there are various well known attestation public key chains for different ecosystems (for example, Android or TPM attestations). Syntax attestObj = authenticatorAttestationResponse.attestationObject Properties After decoding the CBOR encoded ArrayBuffer, the resulting JavaScript object will contain the following properties: authData The same as AuthenticatorAssertionResponse.authenticatorData. Note that in AuthenticatorAssertionResponse, the authenticatorData is exposed as a property in a JavaScript object while in AuthenticatorAttestationResponse, the authenticatorData is a property in a CBOR map...
AuthenticatorAttestationResponse - Web APIs
ublicKeyCredential is passed, and provides a cryptographic root of trust for the new key pair that has been generated. This response should be sent to the relying party's server to complete the creation of the credential. This interface inherites from AuthenticatorResponse. Note: This interface is restricted to top-level contexts. Use from within an <iframe> element will not have any effect. Properties AuthenticatorAttestationResponse.clientDataJSON Secure contextRead only Client data for the authentication, such as origin and challenge. The clientDataJSON property is inherited from the AuthenticatorResponse. AuthenticatorAttestationResponse.attestationObject Secure contextRead only An ArrayBuffer containing authenticator data and an attestation statement for a newly-created key pair. ...
AuthenticatorResponse - Web APIs
that provide a cryptographic root of trust for a key pair. The child interfaces include information from the browser such as the challenge origin and either may be returned from PublicKeyCredential.response. Interfaces based on AuthenticatorResponse Below is a list of interfaces based on the AuthenticatorResponse interface. AuthenticatorAssertionResponse AuthenticatorAttestationResponse Properties AuthenticatorResponse.clientDataJSON A JSON string in an ArrayBuffer, representing the client data that was passed to CredentialsContainer.create() or CredentialsContainer.get(). Methods None. Examples Getting an AuthenticatorAssertionResponse var options = { challenge: new Uint8Array([/* bytes sent from the server */]) }; navigator.credentials.get({ "publicKey": options }) .then...
Background Tasks API - Web APIs
ay to its "nothing's happened yet" state. This example will create a random number of tasks (between 100 and 200 of them). To do so, we use the getRandomIntInclusive() function that's provided as an example in the documentation for Math.random() to get the number of tasks to create. Then we start a loop to create the actual tasks. For each task, we create an object, taskData, which includes two properties: count is the number of strings to output into the log from the task. text is the text to output to the log the number of times specified by count. Each task is then enqueued by calling enqueueTask(), passing in logTaskHandler() as the handler function and the taskData object as the object to pass into the function when it's called. Result Below is the actual functioning result of the ...
BaseAudioContext.createPanner() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
BaseAudioContext.createWaveShaper() - Web APIs
istortion effects to your audio. Syntax baseAudioCtx.createWaveShaper(); Returns A WaveShaperNode. 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. Their S-shape, for instance, helps create a smoother sounding result. We found the below distortion curve code on Stack Overflow. var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var distortion = audioCtx.createWaveShaper(); ... function makeDistortionCurve(amount) { var k = typeof amount === 'number' ? amount : 50, n_samples = 44100, curve = new Float32Ar...
BaseAudioContext - Web APIs
BaseAudioContext.currentTime Read only Returns a double representing an ever-increasing hardware time in seconds used for schedu...
BasicCardRequest.supportedNetworks - Web APIs
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 = [{ supportedMethods: 'basic-card', data: { supportedNetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'], supportedTypes: ['credit', 'debit'] } }]; var details = { ... }; var options = { ... }; var request = new PaymentRequest(supportedInstruments, details, options); Specifications ...
BasicCardRequest.supportedTypes - Web APIs
rdTypeN]; 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 supportedInstruments = [{ supportedMethods: 'basic-card', data: { supportedNetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'], supportedTypes: ['credit', 'debit'] } }]; var details = { ... }; var options = { ... }; var request = new PaymentRequest(supportedInstruments, details, options); ...
BasicCardRequest - Web APIs
The BasicCardRequest dictionary is a JavaScript object-structure that can be used in the Payment Request API. The properties of BasicCardRequest are defined in the Basic Card Payment spec). Properties BasicCardRequest.supportedNetworks Optional Secure context An optional array of DOMStrings representing the card networks that the retailer supports (e.g. "amex", "mastercard"); see Card network identifiers for a complete list. If the property is missing, it implies that all networks are supported. Obsolete properties These properties have been removed from the Payment Method: Basic Card specification and should no longer be used. BasicCardRequest.supportedTypes Optional Secure context This obsolete property was used to provide an optional array of DOMStrings representing the card type...
BasicCardResponse - Web APIs
The BasicCardResponse dictionary (related to the Payment Request API, although defined in the Basic Card Payment spec) 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. Properties BasicCardResponse.cardNumber Read only Secure context Contains the number of the card used to make the payment. BasicCardResponse.cardholderName Read only Secure context Optional Contains the cardholder name of the card used to make the payment. BasicCardResponse.cardSecurityCode Read only Secure context Optional Contains the security code of the card used to make the payment. BasicCardResponse.expiryMonth Read only Secure context Optional Contains the expiry month of the card used to make the payment. B...
BeforeInstallPromptEvent - Web APIs
l="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="236" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">BeforeInstallPromptEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor BeforeInstallPromptEvent() Creates a new BeforeInstallPromptEvent. Properties Inherits properties from its parent, Event. BeforeInstallPromptEvent.platforms Read only Returns an array of DOMString items containing the platforms on which the event was dispatched. This is provided for user agents that want to present a choice of versions to the user such as, for example, "web" or "play" which would allow the user to chose between a web version or an Android version. B...
BiquadFilterNode - Web APIs
, and graphic equalizers. A BiquadFilterNode always has exactly one input and one output. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor BiquadFilterNode() Creates a new instance of a BiquadFilterNode object. Properties Inherits properties from its parent, AudioNode. Note: Though the AudioParam objects returned are read-only, the values they represent are not. BiquadFilterNode.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 fre...
Blob() - Web APIs
Web › API › Blob › Blob
nation 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, (""). 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 th...
Blob - Web APIs
Web › API › Blob
that contains a subset of another blob's data, use the slice() method. To obtain a Blob object for a file on the user's file system, see the File documentation. The APIs accepting Blob objects are also listed in the File documentation. Constructor Blob() Returns a newly created Blob object which contains a concatenation of all of the data in the array passed into the constructor. Instance properties Blob.prototype.size Read only The size, in bytes, of the data contained in the Blob object. Blob.prototype.type Read only A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty. Instance methods Blob.prototype.arrayBuffer() Returns a promise that resolves with an ArrayBuffer containing the entire contents of the Blob as bina...
BluetoothAdvertisingData - Web APIs
The BluetoothDevice interface of the Web Bluetooth 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 whi...
BluetoothRemoteGATTDescriptor - Web APIs
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. BluetoothRemoteGATTDescriptor.valueRead only Returns the cu...
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 enviro...
getIncludedService() - Web APIs
The BluetoothGATTService.getIncludedService() method returns a Promise to an instance of BluetoothGATTService for a given universally unique identifier (UUID). Syntax bluetoothGATTServiceInstance.getIncludedService(service).then(function(BluetoothGATTService) { ... } ) Returns A Promise to an instance of BluetoothGATTService. Properties service The UUID of a Bluetooth service. Specifications Specification Status Comment Web BluetoothThe definition of 'getIncludedService()' in that specification. Draft Initial definition. ...
getIncludedServices() - Web APIs
The BluetoothGATTService.getIncludedServices() method returns a Promise to an Array of BluetoothGATTService instances for an optional universally unique identifier (UUID). Syntax bluetoothGATTServiceInstance.getIncludedService(service).then(function(BluetoothGATTService) { ... } ) Returns A Promise to an instance of BluetoothGATTService. Properties service The UUID of a Bluetooth service. Specifications Specification Status Comment Web BluetoothThe definition of 'getIncludedServices()' in that specification. Draft Initial definition. ...
BluetoothRemoteGATTService - Web APIs
BluetoothRemoteGATTService.isPrimaryRead only Returns a Boolean Indicating whether this is a primary or secondary service. BluetoothRemoteGATTService.uuidRead only Returns a DOMString representing the UUID of this service. Methods BluetoothRemoteGATTServ...
Body - Web APIs
Web › API › Body
The Body mixin of the Fetch API represents the body of the response/request, allowing you to declare what its content type is and how it should be handled. Body is implemented by both Request and Response. This provides these objects with an associated body (a stream), a used flag (initially unset), and a MIME type (initially the empty byte sequence). Properties Body.body Read only A simple getter used to expose a ReadableStream of the body contents. Body.bodyUsed Read only A Boolean that indicates whether the body has been read. Methods Body.arrayBuffer() Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer. Body.blob() Takes a Response stream and reads it to completion. It returns a promise that resolves with a Blob. Body.fo...
BroadcastChannel: messageerror event - Web APIs
onmessageerror Examples This code uses addEventListener to listen for messages and errors: const channel = new BroadcastChannel('example-channel'); channel.addEventListener('message', (event) => { received.textContent = event.data; }); channel.addEventListener('messageerror', (event) => { console.error(event); }); The same, but using the onmessage and onmessageerror event handler properties: const channel = new BroadcastChannel('example-channel'); channel.onmessage = (event) => { received.textContent = event.data; }; channel.onmessageerror = (event) => { console.log(event); }; Specifications Specification Status HTML Living Standard Living Standard ...
BroadcastChannel - Web APIs
"50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="231" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">BroadcastChannel</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor BroadcastChannel() Creates an object linking to the named channel. Properties This interface also inherits properties from its parent, EventTarget. BroadcastChannel.name Read only Returns a DOMString, the name of the channel. Event handlers BroadcastChannel.onmessage An EventHandler property that specifies the function to execute when a message event is fired on this object. BroadcastChannel.onmessageerror An EventHandler called when a MessageEvent of type M...
BudgetService - Web APIs
Methods BudgetService.getCost() Returns a Promise that resolves to a double, indicating the worst-case background operation cost of the provided background operation. BudgetService.getBudget() Returns a Promise that resolves to an array of BudgetState objects, indicating the expected state of the budget at times in the future. ...
BudgetState - Web APIs
BudgetState.time Returns a timestamp at which the budgetAt value is valid. Methods None. 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. ...
ByteLengthQueuingStrategy - Web APIs
Methods ByteLengthQueuingStrategy.size() Returns the given chunk's byteLength property. Examples const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 }); const readableStream = new ReadableStream({ start(controller) { ... ...
CSSConditionRule - Web APIs
An object implementing the CSSConditionRule interface represents a single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. Two objects derive from it : CSSMediaRule and CSSSupportsRule. Syntax The syntax is described using the WebIDL format. interface CSSConditionRule : CSSGroupingRule { attribute DOMString conditionText; } Properties The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all properties of these classes. It has one specific property: CSSConditionRule.conditionText Represents the text of the condition of the rule. Methods The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all methods of these classes. It has no specific property of its own. Specifications S...
CSSGroupingRule - Web APIs
within it. Objects deriving from it : CSSConditionRule and its children: CSSMediaRule, CSSSupportsRule, and CSSDocumentRule. CSSPageRule Syntax The syntax is described using the WebIDL format. interface CSSGroupingRule : CSSRule { readonly attribute CSSRuleList cssRules; unsigned long insertRule (DOMString rule, unsigned long index); void deleteRule (unsigned long index); } Properties common to all CSSGroupingRule instances The CSSGroupingRule derives from CSSRule and inherits all properties of this class. It has one specific property: CSSGroupingRule.cssRules Read only Returns a CSSRuleList of the CSS rules in the media rule. Methods common to all CSSGroupingRule instances The CSSGroupingRule derives from CSSRule and inherits all methods of this class. It has two spe...
CSSImageValue - Web APIs
The CSSImageValue object represents an <image> that involves an URL, such as url() or image(), but not linear-gradient() or element() . 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. ...
CSSKeywordValue - Web APIs
The CSSKeywordValue interface of the the CSS Typed Object Model API creates an object to represent CSS keywords and other identifiers. The interface instance name is a stringifier meaning that when used anywhere a string is expected it will return the value of CSSKeyword.value. Constructor CSSKeywordValue.CSSKeywordValue() Creates a new CSSKeywordValue object. Properties CSSKeywordValue.value Returns or sets the value of the CSSKeywordValue. Methods Inherits methods from CSSStyleValue. 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 co...
CSSMathProduct - Web APIs
The CSSMathProduct interface of the CSS Typed Object Model API represents the result obtained by calling add(), sub(), or toSum() on CSSNumericValue. Constructor CSSMathProduct.CSSMathProduct() Creates a new CSSMathProduct object. Properties CSSMathProduct.values Returns a CSSNumericArray object which contains one or more CSSNumericValue objects. Methods None. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSMathProduct' in that specification. Working Draft Initial definition. ...
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 const sty...
CSSMathValue - Web APIs
Event handlers No Methods None. ...
CSSMediaRule - Web APIs
The CSSMediaRule interface represents a single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). 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. It has the following specific property: CSSMediaRule.media Read only Specifies a MediaList representing the intended destination medium for style information. Methods As a CSSConditionRule, and therefore both a CSSGroupingRule and a CSSRule, CSSMediaRule also implements the methods of t...
CSSNamespaceRule - Web APIs
The CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). 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. CSSNamespaceRule.prefix Returns a DOMString with the name of the prefix associated to this namespace. If there is no such prefix, returns null. Methods As a CSSRule, CSSNamespaceRule also im...
CSSNumericValue - Web APIs
t 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. CSSNumericValue.min Returns the minimum value passed CSSNumericV...
CSSPageRule - Web APIs
CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). 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. Methods As a CSSRule, CSSPageRule also implements the methods of that interface. It has no specific methods. Specifications Specification Status ...
CSSPositionValue.CSSPositionValue() - Web APIs
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. ...
CSSPositionValue - Web APIs
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. ...
CSSRule.cssText - Web APIs
Web › API › CSSRule › cssText
ctual text of a CSSStyleSheet style-rule. Note: Do not confuse this property with element-style CSSStyleDeclaration.cssText. Be aware that this property can no longer be set directly, as it is now specified to be functionally modify-only, and silently so. In other words, attempting to set it does absolutely nothing, and doesn't even omit a warning or error. Furthermore, it has no settable sub-properties. Therefore, to modify it, use the stylesheet's cssRules[index] properties .selectorText and .style (or its sub-properties). See Using dynamic styling information for details. Syntax string = cssRule.cssText Example <style> body { background-color: darkblue; } </style> <script> var stylesheet = document.styleSheets[0]; alert(stylesheet.cssRules[0].cssText); // body { background-c...
CSSRule - Web APIs
Web › API › CSSRule
The CSSRule interface represents a single CSS rule. There are several types of rules, listed in the Type constants section below. The CSSRule interface specifies the properties common to all rules, while properties unique to specific 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, otherwis...
CSSRuleList - Web APIs
neither can it be assigned to one (as stylesheet.cssRules is read-only), but it must unfortunately be inserted into one, rule by rule, and unless combining lists, after any existing list therein is deleted, rule by rule. Example // get the first style sheet's first rule var first_rule = document.styleSheets[0].cssRules[0]; See also CSSRule CSSRuleList implementations There are multiple properties in the CSSOM that will return a CSSRuleList. They are: CSSStyleSheet property cssRules CSSMediaRule property cssRules CSSKeyframesRule property cssRules CSSMozDocumentRule property cssRules Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSRuleList' in that specification. Working Draft ...
CSSStyleDeclaration.setProperty() - Web APIs
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 html { background...
CSSStyleRule - Web APIs
"h1,h2". CSSStyleRule.style Read only Returns the CSSStyleDeclaration object for the rule. CSSStyleRule.styleMap Read only Returns a StylePropertyMap object which provides access to the rule's property-value pairs. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleRule' in that specification. ...
CSSSupportsRule - Web APIs
The CSSSupportsRule interface describes an object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). 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. Methods As a CSSConditionRule and therefore a CSSRuleand a CSSGroupingRule, CSSSupportsRule also implements the methods of that interface. It has no specific methods. Specification Specification Status Comment CSS Conditional Rules Module L...
CSSUnitValue - Web APIs
CSSUnitValue.unit Returns a USVString indicating the type of unit. Event handlers None. Methods None. ...
CSSUnparsedValue.CSSUnparsedValue() - Web APIs
Syntax var CSSUnparsedValue = new CSSUnparsedValue(members) Parameters members An array whose values must be either a USVString or a CSSVariableReferenceValue. ...
CSSUnparsedValue.entries() - Web APIs
Syntax CSSUnparsedValue.entries(obj) Parameters obj The CSSUnparsedValue whose enumerable own property [key, value] pairs are to be returned. ...
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). CSSUnparsedValue...
CSSValue - Web APIs
Web › API › CSSValue
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. ...
CSSVariableReferenceValue - Web APIs
eReferenceValue 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 Draft Initial defin...
CSS Object Model (CSSOM) - Web APIs
stListener event listener. CSS Object Model (CSSOM) Working Draft Extended the CSS interface and provides the base for the modern CSSOM specification. Screen Orientation API Working Draft CSS Fonts Module Level 3 Candidate Recommendation CSS Animations Working Draft CSS Transitions Working Draft CSS Custom Properties for Cascading Variables Module Level 1 Candidate Recommendation CSS Conditional Rules Module Level 3 Candidate Recommendation Defined the CSS interface. CSS Device Adaptation Working Draft CSS Counter Styles Level 3 Candidate Recommendation Document Object Model (DOM) Level 2 Style Specification Obsolete Initial definition. ...
Cache.delete() - Web APIs
Web › API › Cache › delete
he request, and if found, deletes the Cache entry and returns a Promise that resolves to true. If no Cache entry is found, it resolves to false. Syntax cache.delete(request, {options}).then(function(found) { // your cache entry 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 opera...
Cache.keys() - Web APIs
Web › API › Cache › keys
Requests with duplicate URLs but different headers can be returned if their responses have the VARY header set on them. Syntax cache.keys(request, {options}).then(function(keys) { // do something with your array of requests }); 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 operati...
CacheStorage.match() - Web APIs
convenience method. Equivalent functionality is to call cache.match() on each cache (in the order returned by caches.keys()) until a Response is returned. Syntax caches.match(request, options).then(function(response) { // Do something with 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 ma...
CanvasGradient - Web APIs
Methods There is no inherited method. CanvasGradient.addColorStop() Adds a new stop, defined by an offset and a color, to the gradient. ...
CanvasPattern - Web APIs
Methods There are no inherited method. ...
CanvasRenderingContext2D.addHitRegion() - Web APIs
The CanvasRenderingContext2D method addHitRegion() adds a hit region to the bitmap. Canvas hit regions make hit detection easy. They let you route events to DOM elements, and make it possible for users to explore the 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 examp...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
Note: Gradient coordinates are global, i.e., relative to the current coordinate space. When applied to a shape, the coordinates are NOT relative to the shape's coordinates. ...
CanvasRenderingContext2D.createPattern() - Web APIs
The CanvasRenderingContext2D.createPattern() method of the Canvas 2D API creates a pattern using the specified image and repetition. This method returns a CanvasPattern. This method doesn't draw anything to the canvas directly. The pattern it creates must be assigned to the CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle properties, after which it is applied to any subsequent drawing. Syntax CanvasPattern ctx.createPattern(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 indicatin...
CanvasRenderingContext2D.createRadialGradient() - Web APIs
Note: Gradient coordinates are global, i.e., relative to the current coordinate space. When applied to a shape, the coordinates are NOT relative to the shape's coordinates. ...
CanvasRenderingContext2D.ellipse() - Web APIs
entById('canvas'); const ctx = canvas.getContext('2d'); // Draw the ellipse ctx.beginPath(); ctx.ellipse(100, 100, 50, 75, Math.PI / 4, 0, 2 * Math.PI); ctx.stroke(); // Draw the ellipse's line of reflection ctx.beginPath(); ctx.setLineDash([5, 5]); ctx.moveTo(0, 200); ctx.lineTo(200, 0); ctx.stroke(); Result Various elliptical arcs This example creates three elliptical paths with varying properties. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = 'red'; ctx.beginPath(); ctx.ellipse(60, 75, 50, 30, Math.PI * .25, 0, Math.PI * 1.5); ctx.fill(); ctx.fillStyle = 'blue'; ctx.beginPath(); ctx.ellipse(150, 75, 50, 30, Math.PI * .25, 0, Math.PI); ctx.fill(); ctx.fillStyle = 'green'; ctx.begi...
CanvasRenderingContext2D.fillText() - Web APIs
imum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. The text is rendered using the font and text layout configuration as defined by the font, textAlign, textBaseline, and direction properties. To draw the outlines of the characters in a string, call the context's strokeText() method. Syntax CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction. x The x-axis coordinate of the point at whic...
CanvasRenderingContext2D.setTransform() - Web APIs
rtical 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 long as it contains the above components as properties). Examples Skewing a shape This example skews a rectangle both vertically (.2) and horizontally (.8). Scaling and translation remain unchanged. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.setTransform(1, .2, .8, 1, 0, 0); ctx.fillRect(0, 0, 100, 100); Result Retrieving and passing a DOMMatri...
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 shadowColor pr...
CanvasRenderingContext2D.shadowColor - Web APIs
RenderingContext2D.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 shadowOffsetY set their p...
CanvasRenderingContext2D.shadowOffsetX - Web APIs
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. ...
CanvasRenderingContext2D.shadowOffsetY - Web APIs
Syntax ctx.shadowOffsetY = offset; offset A float specifying the distance that shadows will be offset vertically. Positive values are down, and negative are up. ...
Advanced animations - Web APIs
ion itself and are going to add some physics to make our animations more advanced. Drawing a ball We are going to use a ball for our animation studies, so let's first draw that ball onto the canvas. The following code will set us up. <canvas id="canvas" width="600" height="300"></canvas> As usual, we need a drawing context first. To draw the ball, we will create a ball object which contains properties and a draw() method to paint it on the canvas. var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var ball = { x: 100, y: 100, radius: 25, color: 'blue', draw: function() { ctx.beginPath(); ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, true); ctx.closePath(); ctx.fillStyle = this.color; ctx.fill(); } }; ball.draw(); Nothin...
Basic usage of canvas - Web APIs
and have drawn a first example in your browser. The <canvas> element <canvas id="tutorial" width="150" height="150"></canvas> At first sight a <canvas> looks like the <img> element, with the only clear difference being that it doesn't have the src and alt attributes. Indeed, the <canvas> element has only two attributes, width and height. These are both optional and can also be set using DOM properties. When no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high. The element can be sized arbitrarily by CSS, but during rendering the image is scaled to fit its layout size: if the CSS sizing doesn't respect the ratio of the initial canvas, it will appear distorted. Note: If your renderings seem distorted, try specifying your width and heigh...
Transformations - Web APIs
arent white rectangle. So far this is pretty similar to what we've done in previous sections. However once we call the first restore() statement, the top drawing state is removed from the stack, and settings are restored. If we hadn't saved the state using save(), we would need to change the fill color and transparency manually in order to return to the previous state. This would be easy for two properties, but if we have more than that, our code would become very long, very fast. When the second restore() statement is called, the original state (the one we set up before the first call to save) is restored and the last rectangle is once again drawn in black. ScreenshotLive sample Translating The first of the transformation methods we'll look at is translate(). This method is used to move the ca...
ChannelMergerNode() - Web APIs
The ChannelMergerNode() constructor creates a new ChannelMergerNode object instance. Syntax var myNode = new ChannelMergerNode(context, options); Parameters context A BaseAudioContext representing the audio context you want the node to be associated with. 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()...
ChannelMergerNode - Web APIs
e AudioContext.listener object, supernumerary channels will be ignored. Number of inputs variable; default to 6. Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor ChannelMergerNode() Creates a new ChannelMergerNode object instance. Properties No specific property; inherits properties from its parent, AudioNode. Methods No specific method; inherits methods from its parent, AudioNode. Example The following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. To use them, you need to use the second and third parameters of the AudioNode.connect(AudioNode) met...
ChannelSplitterNode.ChannelSplitterNode() - Web APIs
plits the input into a separate output for each of the source node's audio channels. Syntax var splitter = new ChannelSpitterNode(context, options); Parameters Inherits parameters from the AudioNodeOptions dictionary. context A BaseAudioContext representing 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 : ...
ChannelSplitterNode - Web APIs
count mode "explicit" Older implementations, as per earlier versions of the spec use "max". Channel count Fixed to the number of outputs. Older implementations, as per earlier versions of the spec use 2 (not used in the default count mode). Channel interpretation "discrete" Constructor ChannelSplitterNode() Creates a new ChannelSplitterNode object instance. Properties No specific property; inherits properties from its parent, AudioNode. Methods No specific method; inherits methods from its parent, AudioNode. Example The following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. To use them, you need to use the second and third parameters of the AudioNode.connect(AudioNo...
Channel Messaging API - Web APIs
s) to communicate directly, passing messages between one another through two-way channels (or pipes) with a port at each end. Note: This feature is available in Web Workers. Channel messaging concepts and usage A message channel is created using the MessageChannel() constructor. ...
Client - Web APIs
Web › API › Client
The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. You can get Client/WindowClient objects from methods such as Clients.matchAll() and Clients.get(). Methods Client.postMessage() Sends a message to the client. Properties Client.id Read only The universally unique identifier of the client as a string. Client.type Read only The client's type as a string. It can be "window", "worker", or "sharedworker". Client.url Read only The URL of the client as a string. Specifications Specification Status Comment Service WorkersThe definition of 'Client' in that specification. Working Draft Initial definition. ...
ClipboardItem - Web APIs
ssion 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 ClipboardItem.C...
Comment - Web APIs
Web › API › Comment
Constructor Comment() Returns a Comment object with the parameter as its textual content. Methods This interface has no specific method, but inherits those of its parent, CharacterData, and indirectly those of Node. Specifications Specification Status ...
CompositionEvent - Web APIs
"50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="311" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CompositionEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor CompositionEvent() Creates a new CompositionEvent object instance. Properties This interface also inherits properties of its parent, UIEvent, and its ancestor -- Event. CompositionEvent.data Read only Returns the characters generated by the input method that raised the event; its varies depending on the type of event that generated the CompositionEvent object. CompositionEvent.locale Read only Returns the locale of current input method (for example, the keyboard...
Console.dir() - Web APIs
Web › API › Console › dir
The Console method dir() displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects. In other words, console.dir() is the way to see all the properties of a specified JavaScript object in console by which the developer can easily get the properties of the object. Note: This feature is available in Web Workers. Syntax console.dir(object); Parameters object A JavaScript object whose properties should be output. Specifications Specification Status Comment Console APIThe definition of 'console.dir()' in that specification. Living Standard Initial definition ...
Console.dirxml() - Web APIs
Web › API › Console › dirxml
Displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes. Syntax console.dirxml(object); Parameters object A JavaScript object whose properties should be output. Specifications Specification Status Comment Console APIThe definition of 'console.dirxml()' in that specification. Living Standard Initial definition ...
ConstantSourceNode() - Web APIs
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 with its offset initialized to 0.5. let ...
ConstantSourceNode - Web APIs
onstantSourceNode 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 value is 1.0. Event handle...
ConstrainDOMString - Web APIs
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 one of the listed values, matching will...
ConstrainDouble - Web APIs
er. 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. exact A double-precision floating-point number specifying a specific, required, value the property must have to be considered acceptable. ideal A double-precision floating-point number specifying a value the property would ideally ha...
ConstrainULong - Web APIs
n integral number. It extends the ULongRange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. In addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. Properties If the value of a ConstrainULong is an object rather than a number, it may have the properties below in addition to the properties it inherits from ULongRange. exact An integer specifying precise, required, value the property must have to be considered acceptable. ideal An integer specifying a value the property would ideally have, but which can be considered optional if necessary to find ...
Constraint validation API - Web APIs
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): HTMLButtonElement HTMLFieldsetElement HTMLInputElement HTMLObjectElement HTMLOutputElement HTMLSelectElement HTMLTextAreaElement Properties validity A read-only property that returns a ValidityState object, whose properties represent validation errors for the value of that element. validationMes...
ContentIndex - Web APIs
Methods ContentIndex.add Registers an item with the content index. ContentIndex.delete Unregisters an item from the currently indexed content. ContentIndex.getAll Returns a Promise that resolves with an iterable list of content index entries. Examples Feature Detection and Interface Access Here we get a reference to the ServiceWorkerRegistration, then check for the index property, which gives us access to the content index interface. ...
ContentIndexEvent - Web APIs
. It contains the id of the indexed content to be removed. The contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. It is not fired when the ContentIndex.delete method is called. Constructor ContentIndexEvent() Creates and returns a new ContentIndexEvent object whose type and other options are configured as specified. Properties In addition to the properties listed below, this interface inherits the properties of its parent interface, ExtendableEvent. id Read only A String which identifies the deleted content index via it's id. Methods While ContentIndexEvent offers no methods of its own, it inherits any specified by its parent interface, ExtendableEvent. Examples This example shows the sevice worker scrip...
ConvolverNode - Web APIs
output. Note: For more information on the theory behind Linear Convolution, see the Convolution article on Wikipedia. Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 1, 2, or 4 Channel interpretation "speakers" Constructor ConvolverNode() Creates a new ConvolverNode object instance. Properties Inherits properties from its parent, AudioNode. ConvolverNode.buffer A mono, stereo, or 4-channel AudioBuffer containing the (possibly multichannel) impulse response used by the ConvolverNode to create the reverb effect. ConvolverNode.normalize A boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is se...
CountQueuingStrategy - Web APIs
Methods CountQueuingStrategy.size() Returns 1. Examples const queueingStrategy = new CountQueuingStrategy({ highWaterMark: 1 }); const writableStream = new WritableStream({ // Implement the sink write(chunk) { ... }, close() { ... ...
CrashReportBody - Web APIs
The CrashReportBody interface of the Reporting API represents the body of a crash report (the return value of its Report.body property). 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. It is difficult to retrieve a crash report via a ReportingObserver, as by that point the page would have crashed! Some s...
Credential - Web APIs
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. ...
CredentialsContainer.get() - Web APIs
. Calls to it within an <iframe> element will resolve without effect. Syntax var promise = CredentialsContainer.get([options]) Parameters options Optional An object of type CredentialRequestOptions that contains options for the request. The options include criteria that the credentials are required or allowed to have, and options for interacting with the user. It can contain the following properties: password: a Boolean indicating that returned Credential instances should include user (as opposed to federated) credentials. federated: A FederatedCredentialRequestOptions object containing requirements for returned federated credentials. The available options are: providers: An array of DOMString instances of identity providers to search for. protocols An array of DOMString i...
CredentialsContainer - Web APIs
Event handlers None. Methods CredentialsContainer.create()Secure context Returns a Promise that resolves with a new Credential instance based on the provided options, or null if no Credential object can be created. In exceptional circumstances, the Promise may reject. ...
Crypto - Web APIs
Web › API › Crypto
The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. Note: This feature is available in Web Workers. The Web Crypto API is accessed through the Window.crypto property, which is a Crypto object. Properties This interface implements properties defined on RandomSource. Crypto.subtle Read only Secure context Returns a SubtleCrypto object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption. 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...
CryptoKey - Web APIs
Web › API › CryptoKey
"private": This key is the private half of an asymmetric algorithm's CryptoKeyPair. ...
CryptoKeyPair - Web APIs
The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm. A CryptoKeyPair object can be obtained using SubtleCrypto.generateKey(), when the selected algorithm is one of the asymmetric algorithms: RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP, ECDSA, or ECDH. It contains two properties, which are both CryptoKey objects: a privateKey property containing the private key and a publicKey property containing the public key. Properties CryptoKey.privateKey A CryptoKey object representing the private key. For encryption and decryption algorithms, this key is used to decrypt. For signing and verification algorithms it is used to sign. CryptoKey.publicKey A CryptoKey object representing the public key. For encrypti...
CustomEvent() - Web APIs
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) }); // create and dispatch the event var event = new CustomEvent("cat", { detail: { hazcheeseburger: true } }); obj.dispatchEvent(event); Additional examples can be found at Creating and triggering events...
DOMConfiguration - Web APIs
from the DOM specification. ...
DOMError - Web APIs
Web › API › DOMError
DOMError.message Read only Returns a DOMString representing a message or description associated with the given error type name. Error types Type Description IndexSizeError The index is not in the allowed range (e.g. thrown in a range object). HierarchyRequestError The node tree hierarchy is not correct. WrongDocumentError The object is in the wrong document. InvalidCharacterError The string contains invalid characters. ...
DOMException - Web APIs
bnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is basically how error conditions are described in web APIs. Each exception has a name, which is a short "CamelCase" style string identifying the error or abnormal condition. Constructor DOMException() Returns a DOMException object with a specified message and name. Properties DOMException.code Read only 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. DOMException.message Read only Returns a DOMString representing a message or description associated with the given error name. DOMExcept...
DOMHighResTimeStamp - Web APIs
// 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision 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...
DOMImplementationList - Web APIs
Methods DOMImplementationList.item() Returns the pos item. ...
DOMLocator - Web APIs
DOMLocator.columnNumber Read only Returns a positive integer or -1. DOMLocator.byteOffset Read only Returns a positive integer or -1. DOMLocator.utf16Offset Read only Returns a positive integer or -1. DOMLocator.relatedNode Read only Returns a positive integer or -1. DOMLocator.uri Read only Returns a positive integer or -1. Methods This interface neither implements, nor inherits, any method. ...
DOMParser - Web APIs
Web › API › DOMParser
rse 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 method has 2 parameters (both required): string The ...
DOMPoint.DOMPoint() - Web APIs
Web › API › DOMPoint › DOMPoint
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. ...
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. This is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward ...
DOMPointReadOnly.fromPoint() - Web APIs
The static DOMPointReadOnly method fromPoint() creates and returns a new DOMPointReadOnly object given a source point. The source point 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 pr...
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. ...
DOMPointReadOnly - Web APIs
y(100, 100, 100, 1.0); The other option is to use the static DOMPointReadOnly.fromPoint() method: const point = DOMPointReadOnly.fromPoint({x: 100, y: 100, z: 50; w: 1.0}); Constructor DOMPointReadOnly() Creates a new DOMPointReadOnly object given the values of its 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 coordinat...
DOMQuad - Web APIs
Web › API › DOMQuad
collection of four DOMPoints defining the corners of an arbitrary quadrilateral. Returning DOMQuads lets getBoxQuads() return accurate information even when arbitrary 2D or 3D transforms are present. It has a handy bounds attribute returning a DOMRectReadOnly for those cases where you just want an axis-aligned bounding rectangle. Constructor DOMQuad.DOMQuad() Creates a new DOMQuad object. Properties p1,p2,p3,p4 Read only are DOMPoint objects for each of the DOMQuad object's four corners. Methods DOMQuad.fromRect() Returns a new DOMQuad object based on the passed set of coordinates. DOMQuad.fromQuad() Returns a new DOMQuad object based on the passed set of coordinates. DOMQuad.getBounds() Returns a DOMRect object with the coordinates and dimensions of the DOMQuad object. DOMQu...
DOMRect - Web APIs
Web › API › DOMRect
t x="191" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="228.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">DOMRect</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor DOMRect() Creates a new DOMRect object. Properties 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. DOMRectReadOnly.top Returns the top coordinate v...
DOMRectReadOnly - Web APIs
Constructor DOMRectReadOnly() Defined to create a new DOMRectReadOnly object. Note that this constructor cannot be called by 3rd party JavaScript; doing 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. ...
DOMStringList - Web APIs
Methods DOMStringList.item() Returns a DOMString. ...
DOMTokenList - Web APIs
The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. Properties DOMTokenList.length Read only Is an integer representing the number of objects stored in the object. DOMTokenList.value A stringifier property that returns the value of the list as a DOMString. Methods DOMTokenList.item(index) Returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. DOMTokenList.contains(token) Returns true if the list contains the given token, otherwise...
DataTransfer.dropEffect - Web APIs
effect. The possible values are: copy A copy of the source item is made at the new location. move An item is moved to a new location. link A link is established to the source at the new location. none The item may not be dropped. Assigning any other value to dropEffect has no effect and the old value is retained. 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. </p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">Drop Zone</div> CSS Content div { margin: 0em; padding: 2em; } #source { color: blue; bor...
DelayNode - Web APIs
Web › API › DelayNode
e will be muted. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor DelayNode() Creates a new instance of an DelayNode object instance. Alternatively, you can use the BaseAudioContext.createDelay() factory method. Properties Inherits properties from its parent, AudioNode. DelayNode.delayTime Read only Is an a-rate AudioParam representing the amount of delay to apply, specified in seconds. Methods No specific methods; inherits methods from its parent, AudioNode. 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 ...
DeprecationReportBody - Web APIs
This can be used to group reports by deprecated feature. ...
Detecting device orientation - Web APIs
are reversed. Processing motion events Motion events are handled the same way as the orientation events except that they have their own event's name: devicemotion window.addEventListener("devicemotion", handleMotion, true); What's really changed are the information provided within the DeviceMotionEvent object passed as a parameter of the HandleMotion function. The motion event contains four properties: DeviceMotionEvent.acceleration DeviceMotionEvent.accelerationIncludingGravity DeviceMotionEvent.rotationRate DeviceMotionEvent.interval Motion values explained The DeviceMotionEvent objects provide web developers with information about the speed of changes for the device's position and orientation. The changes are provided along three axis (see Orientation and motion data explained for ...
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 - Web APIs
The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. Warning: Currently, Firefox and Chrome do not handle the coordinates the same way. Take care about this while using them. Constructor DeviceMotionEvent.DeviceMotionEvent() Creates a new DeviceMotionEvent. Properties DeviceMotionEvent.accelerationRead only An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2. DeviceMotionEvent.accelerationIncludingGravityRead only An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s2. DeviceMotionEvent.rotationRateRead only An object giving the rate of change of the dev...
DeviceMotionEventAcceleration - Web APIs
Read only. DeviceMotionEventAcceleration.y Read only The amount of acceleration along the Y axis. Read only. DeviceMotionEventAcceleration.z Read only The amount of acceleration along the Z axis. Read only. ...
DeviceMotionEventRotationRate - Web APIs
DeviceMotionEventRotationRate.beta Read only The amount of rotation around the X axis, in degrees per second. DeviceMotionEventRotationRate.gamma Read only The amount of rotation around the Y axis, in degrees per second. ...
DeviceOrientationEvent - Web APIs
The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. Warning: Currently, Firefox and Chrome do not handle the coordinates the same way. Take care about this while using them. Constructor DeviceOrientationEvent.DeviceOrientationEvent() Creates a new DeviceOrientationEvent. Properties DeviceOrientationEvent.absolute Read only A boolean that indicates whether or not the device is providing orientation data absolutely. 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...
DeviceProximityEvent - Web APIs
DeviceProximityEvent.min Read only The minimum sensing distance the sensor is able to report, in centimeters. Ususally zero. DeviceProximityEvent.value Read only The current device proximity, in centimeters. ...
DisplayMediaStreamConstraints - Web APIs
is used to specify whether or not to include video and/or 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. 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 a...
Document.characterSet - Web APIs
" and a "character encoding" are related, but different. Despite the name of this property, it returns the encoding. Users can override the developer-specified encoding inside the Content-Type header or inline like <meta charset="utf-8">, such as with Firefox's View -> Text Encoding menu. This override is provided to fix incorrect developer-specified encodings that result in garbled text. The properties document.charset and document.inputEncoding are legacy aliases for document.characterSet. Do not use them any more. Syntax var string = document.characterSet; Examples <button onclick="console.log(document.characterSet);"> Log character encoding </button> <!-- displays document's character encoding in the dev console, such as "ISO-8859-1" or "UTF-8" --> Specifications Specifica...
Document.createNodeIterator() - Web APIs
It is a convenient way of filtering for certain types of node. It defaults to 0xFFFFFFFF representing the SHOW_ALL constant. ...
Document.createTreeWalker() - Web APIs
The Document.createTreeWalker() creator method returns a newly created TreeWalker object. Syntax document.createTreeWalker(root, whatToShow[, filter[, entityReferenceExpansion]]); Parameters 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 onl...
Document.evaluate() - Web APIs
Web › API › Document › evaluate
any namespace prefixes and should return a string representing the namespace URI associated with that prefix. It will be 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 namespace prefixes are used. resultType is an integer that corresponds to the type of result XPathResult to return. Use named constant properties, such as XPathResult.ANY_TYPE, of the XPathResult constructor, which correspond to integers from 0 to 9. result is an existing XPathResult to use for the results. null is the most common and will create a new XPathResult Example var headings = document.evaluate("/html/body//h2", document, null, XPathResult.ANY_TYPE, null); /* Search the document for all h2 elements. * The result will likely ...
Document.ononline - Web APIs
Web › API › Document › ononline
ffline 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.body to a JavaScript Function object. (Note: using window.ononline or window.onoffline will not work for compatibility reasons.) By specifying ononline="..." or onoffline="..." attributes on the <body> tag in the HTML markup. Example There's a simple test case that you can run to verify that the events are working. References Online and offline events [en-US] WHAT...
Document.open() - Web APIs
Web › API › Document › open
ument.open() call happens when document.write() is called after the page has loaded. For years Firefox and Internet Explorer additionally erased all JavaScript variables, etc., in addition to removing all nodes. This is no longer the case.document non-spec'ed parameters to document.open Gecko-specific notes Starting with Gecko 1.9, this method is subject to the same same-origin policy as other properties, and does not work if doing so would change the document's origin. Starting with Gecko 1.9.2, document.open() uses the principal of the document whose URI it uses, instead of fetching the principal off the stack. As a result, you can no longer call document.write() into an untrusted document from chrome, even using wrappedJSObject. See Security check basics for more about principals. Three-argu...
Document.registerElement() - Web APIs
eturns a constructor for the new element. Note: This is an experimental technology. The browser you use it in must support Web Components. See Enabling Web Components in Firefox. Syntax var constructor = document.registerElement(tag-name, options); Parameters tag-name The name of the custom element. The name must contain a dash (-), for example my-tag. optionsOptional An object with properties prototype to base the custom element on, and extends, an existing tag to extend. Both of these are optional. Example Here is a very simple example: var Mytag = document.registerElement('my-tag'); Now the new tag is registered in the browser. The Mytag variable holds a constructor that you can use to create a my-tag element in the document as follows: document.body.appendChild(new Mytag()...
Document: wheel event - Web APIs
nt 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>Scale me with your mouse wheel.</div> body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: cent...
DocumentFragment - Web APIs
" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="346" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">DocumentFragment</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor DocumentFragment() Creates and returns a new DocumentFragment object. Properties This interface has no specific properties, but inherits those of its parent, Node, and implements those of the ParentNode interface. ParentNode.children Read only Returns a live HTMLCollection containing all objects of type Element that are children of the DocumentFragment object. ParentNode.firstElementChild Read only Returns the Element that is the first child of the DocumentFragment...
DocumentOrShadowRoot.activeElement - Web APIs
The activeElement read-only property of the Document and ShadowRoot interfaces returns the Element within the DOM or shadow DOM tree that currently has focus. Often activeElement will return a HTMLInputElement or HTMLTextAreaElement object if it has the text selection at the time. If so, you can get more detail by using the object's selectionStart and selectionEnd properties. Other times the focused element might be a <select> element (menu) or an <input> element, of type "button", "checkbox", or "radio". Typically a user can press the tab key to move the focus around the page among focusable elements, and use the space bar to activate one (that is, to press a button or toggle a radio button). Which elements are focusable varies depending on the platform and the browser's current configuration. F...
DocumentOrShadowRoot.getSelection() - Web APIs
etRangeAt(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 error if it does not have that property or method and may return unexpected results if it does. To use a Selection object as a string, call its toSt...
DocumentOrShadowRoot - Web APIs
DocumentOrShadowRoot.fullscreenElementRead only Returns the Element that's currently in full screen mode for this document. DocumentOrShadowRoot.pointerLockElement Read only Returns the element set as the target for mouse events while the pointer is locked. ...
DocumentTimeline - Web APIs
The DocumentTimeline interface of the the Web Animations 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.querySele...
Events and the DOM - Web APIs
ert('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 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 var...
Using the W3C DOM Level 1 Core - Web APIs
this script as a complete example. How can I learn more? Now that you are familiar with the basic concepts of the DOM, you may want to learn about the DOM Level 1 fundamental methods. See also the DOM Level 1 Core specification from the W3C. It's a reasonably clear spec, although it is formal. The main thing that's useful to authors is the description of the different DOM objects and all their properties and methods. Also see our other DOM documentation. Original Document Information Author(s): L. David Baron <dbaron at dbaron dot org> Copyright Information: (C) 1998-2005 by individual mozilla.org contributors; content available under a Creative Commons license ...
Document Object Model (DOM) - Web APIs
Static type SVGAngle SVGColor SVGICCColor SVGElementInstance SVGElementInstanceList SVGLength SVGLengthList SVGMatrix SVGNameList SVGNumber SVGNumberList SVGPaint SVGPathSeg SVGPathSegClosePath SVGPathSegMovetoAbs SVGPathSegMovetoRel SVGPathSegLinetoAbs SVGPathSegLinetoRel SVGPathSegCurvetoCubicAbs SVGPathSegCurvetoCubicRel SVGPathSeg...
DoubleRange - Web APIs
min A floating-point value specifying the smallest permissible value of the property it describes. ...
DragEvent() - Web APIs
This constructor is used to create a synthetic DragEvent object. Although this interface has a constructor, it is not possible to create a useful DataTransfer object from script, since DataTransfer objects have a processing and security model that is coordinated by the browser during drag-and-drops. This interface inherits properties from MouseEvent and Event. Syntax event = new DragEvent(type, DragEventInit); Arguments type Is a DOMString representing the name of the event (see DragEvent event types). DragEventInitOptional Is a DragEventInit dictionary, having the following fields: "dataTransfer", optional and defaults to "null". The type is DataTransfer. The DragEventInit dictionary inherits from the MouseEventInit dictionary. Specifications Specification S...
DragEvent - Web APIs
Web › API › DragEvent
The DragEvent interface is a DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. This interface inherits properties from MouseEvent and Event. Properties DragEvent.dataTransfer Read only The data that is transferred during a drag and drop interaction. Constructors Although this interface has a constructor, it is not possible to create a useful DataTransfer object from script, since DataTransfer objects have a processing and security model that is coordinated by the browser during drag-and-drops. DragEvent() Creates a sy...
DynamicsCompressorNode - Web APIs
exactly one input and one output; it is created using the AudioContext.createDynamicsCompressor() method. Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 2 Channel interpretation "speakers" Constructor DynamicsCompressorNode() Creates a new instance of an DynamicsCompressorNode object. Properties Inherits properties from its parent, AudioNode. DynamicsCompressorNode.threshold Read only Is a k-rate 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 porti...
EcKeyGenParams - Web APIs
This should be set to ECDSA or ECDH, depending on the algorithm you want to use. namedCurve A DOMString representing the name of the elliptic curve to use. ...
EcKeyImportParams - Web APIs
This should be set to ECDSA or ECDH, depending on the algorithm you want to use. namedCurve A DOMString representing the name of the elliptic curve to use. ...
EcdhKeyDeriveParams - Web APIs
consisting of a public and a private key to derive a shared secret. They exchange public keys and use the combination of their private key and the other entity's public key to derive a secret key that they -- and noone else -- share. The parameters for ECDH deriveKey() therefore include the other entity's public key, which is combined with this entity's private key to derive the shared secret. Properties name A DOMString. This should be set to ECDH. public A CryptoKey object representing the public key of the other entity. Examples See the examples for SubtleCrypto.deriveKey(). Specifications Specification Status Comment Web Cryptography APIThe definition of 'SubtleCrypto.EcdhKeyDeriveParams' in that specification. Recommendation ...
EcdsaParams - Web APIs
This should be set to ECDSA. hash A DOMString. An identifier for the digest algorithm to use. This should be one of the following: SHA-256: selects the SHA-256 algorithm. SHA-384: selects the SHA-384 algorithm. SHA-512: selects the SHA-512 algorithm. ...
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. 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...
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". This v...
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-defined ...
EffectTiming.endDelay - Web APIs
is 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: delayInMilliseconds } timingProperties.endDelay = delayInMilliseconds; Value A number representing the end delay, specified in milliseconds. The...
EffectTiming.iterations - Web APIs
erations 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; Value A floating-point value specifying the number of times the ...
Element: DOMMouseScroll event - Web APIs
his event on Gecko because If scroll amount by a native mouse wheel event is less than 1 line (or less than 1 page when the system setting is by page scroll), 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. 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 ...
Element: MSManipulationStateChanged event - Web APIs
of an element being manipulated has changed (ie. whenever you start or finish panning or zooming an element). It is a proprietary event specific to Microsoft Edge and Internet Explorer. Bubbles Unknown Cancelable Unknown Interface MSManipulationEvent Event handler property Unknown Get manipulation states using the lastState and currentState properties. Examples // Listen for panning state change events outerScroller.addEventListener("MSManipulationStateChanged", function(e) { // Check to see if they lifted while pulled to the top if (e.currentState == MS_MANIPULATION_STATE_INERTIA && outerScroller.scrollTop === 0) { refreshItemsAsync(); } }); Specifications Not part of any specification. ...
Element.animate() - Web APIs
Web › API › Element › animate
ng 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 0. direction Optional Whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each i...
Element.scrollHeight - Web APIs
For example: HTML <form name="registration"> <p> <textarea id="rules">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at laoreet magna. Aliquam erat volutpat. Praesent molestie, dolor ut eleifend aliquam, mi ligula ultrices sapien, quis cursus neque dui nec risus. Duis tincidunt lobortis purus eu aliquet. Quisque in dignissim magna. Aenean ac lorem at velit ultrices ...
Element.scrollIntoView() - Web APIs
ible area of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "start", inline: "nearest"}. This is the default value. 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"}. scrollIntoViewOptions Optional Is an Object with the following properties: behavior Optional Defines the transition animation. One of auto or smooth. Defaults to auto. block Optional Defines vertical alignment. One of start, center, end, or nearest. Defaults to start. inline Optional Defines horizontal alignment. One of start, center, end, or nearest. Defaults to nearest. Example var element = document.getElementById("box"); element.scroll...
Element: wheel event - Web APIs
eelEvent 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) wheel. <div>Scale me with your mouse wheel.</div> body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify...
ElementCSSInlineStyle - Web APIs
The ElementCSSInlineStyle mixin describes CSSOM-specific features common to the HTMLElement, SVGElement and MathMLElement interfaces. Each of these interfaces can, of course, add more 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 (CSSO...
Comparison of Event Targets - Web APIs
There are five targets to 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. ...
EventSource - Web APIs
oss all of the tabs to www.example1.com and another 6 SSE connections to www.example2.com. (from Stackoverflow). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100). Constructor EventSource() Creates a new EventSource to handle receiving server-sent events from a specified URL, optionally in credentials mode. 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 inst...
ExtendableEvent - Web APIs
text-anchor="middle" alignment-baseline="middle">ExtendableEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Note: This interface is only available when the global scope is a ServiceWorkerGlobalScope. It is not available when it is a Window, or the scope of another kind of worker. Constructor ExtendableEvent() Creates a new ExtendableEvent object. Properties Doesn't implement any specific properties, but inherits properties from its parent, Event. Methods Inherits methods from its parent, Event. ExtendableEvent.waitUntil() Extends the lifetime of the event. It is intended to be called in the install EventHandler for the installing worker and on the activate EventHandler for the active worker. Examples This code snippet is from the serv...
ExtendableMessageEvent - Web APIs
sageEvent interface of the Service Worker API represents the event object of a message event fired on a service worker (when a message is received on the ServiceWorkerGlobalScope from another context) -- extends the lifetime of such events. This interface inherits from the ExtendableEvent interface. Constructor ExtendableMessageEvent() Creates a new ExtendableMessageEvent object instance. Properties Inherits properties from its parent, ExtendableEvent. ExtendableMessageEvent.data Read only Returns the event's data. It can be any data type. ExtendableMessageEvent.origin Read only Returns the origin of the Client that sent the message. ExtendableMessageEvent.lastEventId Read only Represents, in server-sent events, the last event ID of the event source. This is an empty string. Ext...
FederatedCredential - Web APIs
n entity that a website trusts to correctly authenticate a user, and that provides an API for that purpose. OpenID Connect is an example of a federated identity provider framework. In browsers that support it, an instance of this interface may be passed in the credential member of the init object for global fetch. Constructor FederatedCredential() Creates a new FederatedCredential object. Properties Inherits properties from its ancestor, Credential. FederatedCredential.provider Read only Returns a USVString containing a credential's federated identity provider. FederatedCredential.protocol Read only Returns a DOMString containing a credential's federated identity protocol. Event handlers None. Methods None. Examples var cred = new FederatedCredential({ id: id, name: name,...
FetchEvent - Web APIs
pe. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch. Constructor FetchEvent() Creates a new FetchEvent object. This constructor is not typically used. The browser creates these objects itself and provides them to fetch event callbacks. Properties Inherits properties from its ancestor, Event. FetchEvent.clientId Read only The id of the same-origin client that initiated the fetch. FetchEvent.preloadResponse Read only A Promise for a Response, or undefined if this fetch is not a navigation, or navigation preload is not enabled. FetchEvent.replacesClientId Read only The id of the client that is being replaced during a page navigat...
Using Fetch - Web APIs
ders a headers object read-only. Note: You may not append or set a request guarded Headers' Content-Length header. Similarly, inserting Set-Cookie into a response header is not allowed: ServiceWorkers are not allowed to set cookies via synthesized responses. Response objects As you have seen above, Response instances are returned when fetch() promises are resolved. The most common response properties you'll use are: Response.status -- An integer (default value 200) containing the response status code. Response.statusText -- A string (default value "OK"), which corresponds to the HTTP status code message. Response.ok -- seen in use above, this is a shorthand for checking that status is in the range 200-299 inclusive. This returns a Boolean. They can also be created programmatically via ...
FileList - Web APIs
Web › API › FileList
odes have a files attribute of type FileList on them which allows access to the items in this list. For example, if the HTML includes the following file input: <input id="fileItem" type="file"> The following line of code fetches the first file in the node's file list as a File object: var file = document.getElementById('fileItem').files[0]; Method overview File item(index); Properties Attribute Type Description length integer A read-only value indicating the number of files in the list. Methods item() Returns a File object representing the file at the specified index in the file list. File item( index ); Parameters index The zero-based index of the file to retrieve from the list. Return value The File representing the requ...
FileReader - Web APIs
to simply read a file by pathname from a file system. To read files by pathname in JavaScript, standard Ajax solutions should be used to do server-side file reading, with CORS permission if reading cross-domain. Note: This feature is available in Web Workers. Constructor FileReader() Returns a newly constructed FileReader. See Using files from web applications for details and examples. Properties FileReader.error Read only A DOMException representing the error that occurred while reading the file. FileReader.readyState Read only A number indicating the state of the FileReader. This is one of the following: EMPTY 0 No data has been loaded yet. LOADING 1 Data is currently being loaded. DONE 2 The entire read request has be...
FileReaderSync - Web APIs
Methods FileReaderSync.readAsArrayBuffer() This method converts a specified Blob or a File into an ArrayBuffer representing the input data as a binary string. FileReaderSync.readAsBinaryString() This method converts a specified Blob or a File into a DOMString representing the input data as a binary string. ...
FileRequest.onprogress - Web APIs
erty specifies a callback function to be run repeatedly while the operation represented by a FileRequest object is in progress. Syntax instanceOfFileRequest.onprogress = function; Where instanceOfFileRequest is a FileRequest object and function is the JavaScript function to execute. Each time the function callback is called, it gets an object as its first parameter. Those objects contain two properties: loaded A number representing the current amount of bytes processed by the operation. total A number representing the total amount of bytes that will be processed by the operation. Example // Assuming 'request' which is a FileRequest object request.onprogress = function (status) { var progress = document.querySelector('progress'); progress.value = status.loaded; progress.max = ...
FileRequest - 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 The FileRequest interface extends the DOMRequest interface to provide some extra properties necessary for the LockedFile objects. Properties FileRequest.lockedFile Read only The LockedFile object from which the request was started. FileRequest.onprogress A callback handler called repeatedly while the operation represented by the FileRequest is in progress. The FileRequest interface also inherits from the DOMRequest interface. Methods None. Specifications Specification Status C...
FileSystem - Web APIs
ccess to a FileSystem object: You can directly ask for one representing a sandboxed file system created just for your web app directly by calling window.requestFileSystem(). If that call is successful, it executes a callback handler, which receives as a parameter a FileSystem object describing the file system. You can get it from a file system entry object, through its filesystem property. Properties FileSystem.name Read only A USVString representing the file system's name. This name is unique among the entire list of exposed file systems. FileSystem.root Read only A FileSystemDirectoryEntry object which represents the file system's root directory. Through this object, you can gain access to all files and directories in the file system. Specifications Specification Stat...
FileSystemEntry - Web APIs
fic prefixes. window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; ... // Opening a file system with temporary storage window.requestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, function(fs) { fs.root.getFile('log.txt', {}, function(fileEntry) { fileEntry.remove(function() { console.log('File removed.'); }, onError); }, onError); }, onError); Properties This interface provides the following properties. filesystem Read only A FileSystem object representing the file system in which the entry is located. fullPath Read only A USVString object which provides the full, absolute path from the file system's root to the entry; it can also be thought of as a path which is relative to the root directory, prepended with a "/" character. isDirector...
FileSystemFlags - Web APIs
{ create: true }, function(entry) { }); Here, we see that the create property is provided, with a value of true, indicating that the directory should be created if it's not already there. 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. Properties create 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 fals...
FileSystemSync - Web APIs
About this document This document was last updated on March 2, 2012 and follows the W3C Specifications (Working Draft) drafted on April 19, 2011. The specification is abandonned for the moment, failing to get significant traction. Basic concepts The FileSystemSync object is your gateway to the entire API and you will use it a lot. So once you have a reference, cache the object in a global variable or class property. Attributes Attribute Type Description name readonly DOMString Name of the file system. ...
FocusEvent() - Web APIs
typeArg Is a DOMString representing the name of the event. ...
FocusEvent - Web APIs
eight="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="281" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">FocusEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor FocusEvent() Creates a FocusEvent event with the given parameters. Properties This interface also inherits properties from its parent UIEvent, and indirectly from Event. FocusEvent.relatedTarget Is an EventTarget representing a secondary target for this event. In some cases (such as when tabbing in or out a page), this property may be set to null for security reasons. Methods This interface has no specific methods. It inherits methods from its parent UIEvent, and i...
FontFace.FontFace() - Web APIs
Web › API › FontFace › FontFace
Takes the same type of values as the font-family descriptor of @font-face . source The font source. This can be either: A URL Binary font data descriptors Optional A set of optional descriptors passed as an object. ...
FontFace.featureSettings - Web APIs
It is equivalent to the font-feature-settings descriptor. Syntax var featureSettingDescriptor = FontFace.featureSettings; FontFace.featureSettings = featureSettingDescriptor; Value A CSSOMString containing a descriptor. ...
FontFaceSet - Web APIs
It will be one of 'loading' or 'loaded'. FontFaceSet.ready Read only Promise which resolves once font loading and layout operations have completed. Events FontFaceSet.onloading An EventListener called whenever an event of type loading is fired, indicating a font-face set has started loading. ...
FontFaceSetLoadEvent - Web APIs
Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSetLoadEvent' in that specification. Working Draft Initial definition. ...
Force Touch events - Web APIs
een applied for it to qualify as a "force click". webkitmouseforceup This event is fired after the webkitmouseforcedown event as soon as the pressure has been reduced sufficiently to end the "force click". webkitmouseforcechanged This event is fired each time the amount of pressure changes. This event first fires after the mousedown event and stops firing before the mouseup event. ...
FormDataEvent - Web APIs
mitted, but can also be triggered by the invocation of a FormData() constructor. This allows a FormData object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself when you wish to submit form data via a method like XMLHttpRequest (see Using FormData objects). Constructor FormDataEvent() Creates a new FormDataEvent object instance. Properties Inherits properties from its parent interface, Event. FormDataEvent.formData Contains the FormData object representing the data contained in the form when the event was fired. Methods Inherits methods from its parent interface, Event. Examples // grab reference to form const formElem = document.querySelector('form'); // submit handler formElem.addEventListener('submit', (e) => { //...
Frame Timing API - Web APIs
ed to the browser's performance timeline and the frame's duration (length of time) will be available. This data can be used to help identify areas that take too long to provide a good user experience. Example code of the interfaces described in this document is included in Using the Frame Timing API. Performance frames The PerformanceFrameTiming interface extends the following PerformanceEntry properties (for "frame" performance entry types) by qualifying and constrainting the properties as follows: PerformanceEntry.entryType Set to "frame". PerformanceEntry.name Set to the document's address. PerformanceEntry.startTime Set to the DOMHighResTimeStamp when the frame was started. PerformanceEntry.duration Set to a timestamp indicating the difference between the startTimes of two successiv...
FullscreenOptions - Web APIs
The FullscreenOptions dictionary is used to provide configuration options when calling requestFullscreen() on an element to place that element into full-screen mode. Properties navigationUIOptional A string controlling whether or not to keep browser user interface elements visible while the element is in full-screen mode. The default, "auto", lets the browser make this decision. ...
GainNode - Web APIs
Web › API › GainNode
interface. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor GainNode() Creates a new instance of a GainNode object. You shouldn't manually create a gain node; instead, use the method AudioContext.createGain(). Properties Inherits properties from its parent, AudioNode. 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 Ga...
Gamepad - Web APIs
Web › API › Gamepad
The Gamepad interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. A Gamepad object can be returned in one of two ways: via the gamepad property of the gamepadconnected and gamepaddisconnected events, or by grabbing any position in the array returned by the Navigator.getGamepads() method. Properties Gamepad.axes Read only An array representing the controls with axes present on the device (e.g. analog thumb sticks). Gamepad.buttons Read only An array of gamepadButton objects representing the buttons present on the device. Gamepad.connected Read only A boolean indicating whether the gamepad is still connected to the system. Gamepad.id Read only A DOMString containing identifying inf...
GamepadEvent - Web APIs
Examples The gamepad property being called on a fired Window.gamepadconnected event. ...
GamepadHapticActuator - Web APIs
The GamepadHapticActuator interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. This interface is accessible through the Gamepad.hapticActuators property. Properties GamepadHapticActuator.type Read only Returns an enum representing the type of the haptic hardware. Methods GamepadHapticActuator.pulse() Read only Makes the hardware pulse at a certain intensity for a specified duration. Examples TBD. Specifications Specification Status Comment Gamepad ExtensionsThe definition of 'GamepadHapticActuator' in that specification. Editor's Draft Initial definition ...
Geolocation - Web APIs
customized results based on the user's location. An object with this interface is obtained using the navigator.geolocation property implemented by the Navigator object. Note: For security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. Be aware that each browser has its own policies and methods 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...
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 ...
GeolocationPositionError - Web APIs
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. ...
GestureEvent - Web APIs
The GestureEvent is a proprietary interface specific to WebKit which gives information regarding multi-touch gestures. Events using 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. 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 ...
GlobalEventHandlers.onanimationcancel - Web APIs
Sans", "Arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "Lucida Grande", "Open Sans", sans-serif; } Leaving out some bits of the CSS that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. First is the box itself, with all its properties, including animation, defined. We go ahead and describe the animation in-place here because the animation is intended to begin as soon as the page loads, rather than based on an event. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788FF; margin: 0; position: relative; background-color: #2233FF; display: flex; justify-content: cen...
Gyroscope - Web APIs
Web › API › Gyroscope
the user must grant permission to the 'gyroscope' device sensor through the Permissions API. 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. Constructor Gyroscope.Gyroscope() Creates a new Gyroscope object. Properties Gyroscope.x Read only Returns a double, containing the angular velocity of the device along the device's x axis. Gyroscope.y Read only Returns a double, containing the angular velocity of the device along the device's y axis. Gyroscope.z Read only Returns a double, containing the angular velocity of the device along the device's z axis. Example The gyroscope is typically read in the...
HTMLCanvasElement.height - Web APIs
The HTMLCanvasElement.height property is a positive integer reflecting the height HTML attribute of the <canvas> element interpreted in CSS pixels. 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. This is one of the two properties, the other being HTMLCanvasElement.width, that controls the size of the canvas. Syntax var pxl = canvas.height; canvas.height = pxl; Examples Given this <canvas> element: <canvas id="canvas" width="300" height="300"></canvas> You can get the height of the canvas with the following code: var canvas = document.getElementById('canvas'); console.log(canvas.height); // 300 Specifications Specification Status Comment HTML Living StandardThe definition of...
HTMLCanvasElement.width - Web APIs
The HTMLCanvasElement.width property is a positive integer reflecting the width HTML attribute of the <canvas> element interpreted in CSS pixels. 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. This is one of the two properties, the other being HTMLCanvasElement.height, that controls the size of the canvas. Syntax var pxl = canvas.width; canvas.width = pxl; Examples Given this <canvas> element: <canvas id="canvas" width="300" height="300"></canvas> You can get the width of the canvas with the following code: var canvas = document.getElementById('canvas'); console.log(canvas.width); // 300 Specifications Specification Status Comment HTML Living StandardThe definition of 'HTM...
HTMLContentElement - Web APIs
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. ...
HTMLDocument - Web APIs
The HTMLDocument interface, which may be accessed through the Window.HTMLDocument property, extends the Window.HTMLDocument property to include methods and properties that are specific to HTML documents. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="midd...
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. 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 app...
HTMLElement: input event - Web APIs
<textarea> element has been changed. 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. However, historically this has not always been the case. Check compatibility, or use the change event instead for elements of these types. No...
HTMLFontElement - Web APIs
HTMLFontElement.color Is a DOMString that reflects the color HTML attribute, containing either a named color or a color specified in the hexadecimal #RRGGBB format. HTMLFontElement.face Is a DOMString that reflects the face HTML attribute, containing a comma-separated list of one or more font names. ...
HTMLFrameSetElement - Web APIs
HTMLFrameSetElement.cols Is a DOMString structured as a comma-seperated list specifing the width of each column inside a frameset. HTMLFrameSetElement.rows Is a DOMString structured as a comma-seperated list specifing the height of each column inside a frameset. Methods No specific method; inherits methods from its parent, HTMLElement and from WindowEventHandlers. ...
HTMLHyperlinkElementUtils - Web APIs
These utilities allow to deal with common features like URLs. There are no objects of this type, but several objects such as HTMLAnchorElement and HTMLAreaElement implement it. Properties Note: This interface doesn't inherit any property. HTMLHyperlinkElementUtils.href This a stringifier property that returns a USVString containing the whole URL, and allows the href to be updated. HTMLHyperlinkElementUtils.protocol This is a USVString containing the protocol scheme of the URL, including the final ':'. ...
HTMLIFrameElement.contentWindow - Web APIs
Example of contentWindow var x = document.getElementsByTagName("iframe")[0].contentWindow; //x = window.frames[0]; x.document.getElementsByTagName("body")[0].style.backgroundColor = "blue"; // this would turn the 1st iframe in document blue. ...
Image() - Web APIs
nction notation. Syntax var htmlImageElement = new Image(width, height); Parameters width The width of the image (i.e., the value for the width attribute). height The height of the image (i.e., the value for the height attribute). Usage note The entire bitmap is loaded regardless of the sizes specified in the constructor. 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.j...
HTMLImageElement.align - Web APIs
ult 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 Floats the image over to place the left edge flush against the curent margin. Any text that follows will flow against the image...
HTMLImageElement.currentSrc - Web APIs
currentSrc indicates the URL of the image which is currently presented in the <img> element it represents. Syntax let currentSource = htmlImageElement.currentSrc; Value A USVString indicating the full URL of the image currently visible in the <img> element represented by the HTMLImageElement. 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. Example In this example, two different sizes are provided for an image of a clock. One is 200px wide and the other is 400px wide. The sizes attribute is provided to indicate that the image should be drawn at 50% of the document width if the viewport is under 400px wide; otherwise, the image i...
HTMLImageElement.hspace - Web APIs
> 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 Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.hspace' in that specification. Living Standard HTML 4.0...
HTMLImageElement.vspace - Web APIs
e 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 StandardThe definition of 'HTMLImageElement.vspace' in that specification. Living Standard HTML 4.
HTMLInputElement.setSelectionRange() - Web APIs
or <textarea> element. Optionally, in newer browser versions, you can specify the direction in which selection should be considered to have occurred. This lets you indicate, for example, that the selection was set by the user clicking and dragging from the end of the selected text toward the beginning. This method updates the HTMLInputElement.selectionStart, selectionEnd, and selectionDirection properties in one call. Note that accordingly to the WHATWG forms spec selectionStart, selectionEnd properties and setSelectionRange method apply only to inputs of types text, search, URL, tel and password. Chrome, starting from version 33, throws an exception while accessing those properties and method on the rest of input types. For example, on input of type number: "Failed to read the 'selectionStart' p...
HTMLKeygenElement - Web APIs
Note: This page describes the Keygen Element interface as specified, not as currently implemented by Gecko. See bug 101019 for details and status. The <keygen> elements expose the HTMLKeygenElement interface, which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance) for manipulating the layout and presentation of keygen elements. Properties autofocus Is a Boolean that reflects the autofocus HTML attribute, indicating that the form control should have input focus when the page loads. challenge Is a DOMString that reflects the challenge HTML attribute, containing a challenge string that is packaged with the submitted key. form Read only Is a HTMLFormElement that indicates the control's form owner...
HTMLMediaElement: loadedmetadata event - Web APIs
The loadedmetadata event is fired when the metadata has been loaded. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onloadedmetadata Specification HTML5 media Additional Properties Property Type Description mozChannels Read only int The number of channels. mozSampleRate Read only int The sample rate per second. mozFrameBufferLength Read only int The number of samples collected in all channels. Examples These examples add an event listener for the HTMLMediaElement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. ...
HTMLMedia​Element​.textTracks - Web APIs
" src="sampleSubtitles_oz.vtt" srclang="oz"> <track kind="metadata" src="keyStage1.vtt" srclang="en" label="Key Stage 1"> <track kind="metadata" src="keyStage2.vtt" srclang="en" label="Key Stage 2"> <track kind="metadata" src="keyStage3.vtt" srclang="en" label="Key Stage 3"> </video> The HTMLMediaElement.textTracks returns a textTracksList thru which we can iterate. Here we print all the properties of each English track to the console. var tracks = document.querySelector('video').textTracks; for (var i = 0, L = tracks.length; i < L; i++) { /* tracks.length == 10 */ if (tracks[i].language == 'en') { console.dir(tracks[i]); } } Properties & Methods properties length Returns the number of text tracks in TextTrackList object. methods getTrackById() The getTrackById(...
HTMLOrForeignElement.dataset - Web APIs
ty of the HTMLOrForeignElement interface provides read/write access to all the custom data attributes (data-*) set on the element. This access is available both in HTML and within the DOM. It is a map of DOMStrings (DOMStringMap) with one entry for each custom data attribute. Note that the dataset property itself can be read, but not directly written. Instead, all writes must be to the individual properties within the dataset, which in turn represent the data attributes. Note also that an HTML data-attribute and its corresponding DOM dataset.property do not share the same name, but they are always similar: In HTML, the name of a custom data attribute begins with data-. It must contain only letters, numbers, and the following characters: dash (-), dot (.), colon (:), underscore (_)--but NOT any AS...
HTMLOrForeignElement - Web APIs
The HTMLOrForeignElement mixin describes several features common to the HTMLElement, SVGElement and MathMLElement interfaces. Each of these interfaces can, of course, add more features in addition to the ones listed below. Note: HTMLOrForeignElement is a mixin and not an interface; you can't actually create an object of type HTMLOrForeignElement. ...
HTMLSlotElement - Web APIs
Methods HTMLSlotElement.assignedNodes() Returns a sequence of the nodes assigned to this slot, and if the flatten option is set to true, the assigned nodes of any other slots that are descendants of this slot. If no assigned nodes are found, it returns the slot's fallback content. HTMLSlotElement.assignedElements() Returns a sequence of the elements assigned to this slot (and no other nodes). ...
Dragging and Dropping Multiple Items - Web APIs
These interfaces will only work with Gecko based browsers. Mozilla supports the ability to drag multiple items using some additional non-standard methods. These are methods that mirror the types property as well as the getData(), setData() and clearData() methods, however, they take an additional argument that specifies the index of the item to retrieve, modify or remove. The drag processing described in this document use the DataTransfer interface. This processing does not use the DataTransferItem interface nor the DataTransferItemList interface. ...
Recommended Drag Types - Web APIs
Dragging Text For dragging text, use the text/plain type. The second data parameter should be the dragged string. ...
HTML Drag and Drop API - Web APIs
n about drag-and-drop interoperability. Gecko-specific interfaces Mozilla and Firefox support some features not in the standard drag-and-drop model. These are convenience functions to help with dragging multiple items or non-string data (such as files). For more information, see Dragging and Dropping Multiple Items. Additionally, see the DataTransfer reference page for all of the Gecko-specific properties and Gecko-specific methods. The basics This section is a summary of the basic steps to add drag-and-drop functionality to an application. Identify what is draggable Making an element draggable requires adding the draggable attribute and the ondragstart global event handler, as shown in the following code sample: <script> function dragstart_handler(ev) { // Add the target element's id t...
Headers - Web APIs
Web › API › Headers
include the forbidden header names and forbidden response header names. A Headers object also has an associated guard, which takes a value of immutable, request, request-no-cors, response, or none. 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. 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 ...
History - Web APIs
Web › API › History
length 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. ...
History API - Web APIs
Concepts and usage Moving backward and forward through the user's history is done using the back(), forward(), and go() methods. Moving forward and backward To move backward through history: window.history.back() This acts exactly as if the user clicked on the Back button in their browser toolbar. ...
HkdfParams - Web APIs
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. ...
HmacImportParams - Web APIs
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. ...
HmacKeyGenParams - Web APIs
This should be set to HMAC. hash A DOMString representing the name of the digest function to use. You can pass any of SHA-1, SHA-256, SHA-384, or SHA-512 here. length Optional A Number -- the length in bits of the key. If this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. ...
IDBCursor - Web APIs
Web › API › IDBCursor
creasing or decreasing in the order of record keys. The cursor enables an application to asynchronously process all the records in the cursor's range. You can have an unlimited number of cursors at the same time. You always get the same IDBCursor object representing a given cursor. Operations are performed on the underlying index or object store. Note: This feature is available in Web Workers. Properties Note: IDBCursorWithValue is an IDBCursor interface with an additional value property. IDBCursor.source Read only Returns the IDBObjectStore or IDBIndex that the 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 th...
IDBCursorWithValue - Web APIs
idth="180" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">IDBCursorWithValue</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Methods Inherits methods from its parent interface, IDBCursor. Properties Inherits properties from its parent interface, IDBCursor. IDBCursorWithValue.value Read only Returns 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. The cursor does not require us to select the data based on a key; we can just grab all of it. Also note tha...
IDBDatabase - Web APIs
IDBDatabase.version Read only A 64-bit integer that contains the version of the connected database. When a database is first created, this attribute is an empty string. IDBDatabase.objectStoreNames Read only A DOMStringList that contains a list of the names of the object stores currently in the ...
IDBEnvironment - Web APIs
his mixin is instead now WindowOrWorkerGlobalScope.indexedDB (that is, defined as a member of the WindowOrWorkerGlobalScope mixin). The IDBEnvironment helper of the IndexedDB API contains the indexedDB property, which provides access to IndexedDB functionality. It is the top level IndexedDB interface implemented by the window and Worker objects. Note: This feature is available in Web Workers. Properties IDBEnvironment.indexedDB Read only Provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains 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.
IDBFactory.cmp() - Web APIs
Web › API › IDBFactory › cmp
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. Return value An integer that indicates the result of the comparison; the table below lists the possible...
IDBKeyRange - Web APIs
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.lowerOpen Read only Returns false if the lower-bound value is included in the key range. IDBKeyRange.upperOpen Read only Returns false if the upper-bound value is included in the key range. Methods Static methods IDBKeyRange.bound() Creates a new key...
IDBLocaleAwareKeyRange - Web APIs
The IDBLocaleAwareKeyRange interface of the IndexedDB API is a Firefox-specific version of IDBKeyRange -- it functions in exactly the same fashion, and has the same properties and methods, but it is intended for use with IDBIndex objects when the original index had a locale value specified upon its creation (see createIndex()'s optionalParameters) -- that is, it has locale aware sorting enabled. Methods This interface inherits all the methods of its parent interface, IDBKeyRange. Properties This interface inherits all the properties of its parent interface, IDBKeyRange. Bear in mind however that IDBLocaleAwareKeyRange has its own implementation of IDBKeyRange.bound. This is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that's not the...
IDBMutableFile - Web APIs
future. Summary The IDBMutableFile interface provides access in read or write mode to a file, dealing with all the necessary locks. Note: This interface used to be called FileHandle , but it was changed to this (bug 1006485.) As IDBMutableFile objects are bound to a fake file system built on top of IndexedDB, such an object is created using the IDBDatabase.createMutableFile method. Properties MutableFile.name Read only The name of the handled file. MutableFile.type Read only The MIME type of the handled file. Events Handler MutableFile.onabort The abort event is triggered each time the handled file is aborted. MutableFile.onerror The error event is triggered each time something goes wrong. Methods MutableFile.open() Returns a LockedFile object to read or write th...
IDBObjectStore.createIndex() - Web APIs
objectParameters); Parameters indexName The name of the index to create. Note that it is possible to create an index with 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+), t...
IDBObjectStore - Web APIs
IDBObjectStore.keyPath Read only The key path of this object store. ...
IDBOpenDBRequest - Web APIs
Methods No methods, but inherits methods from its parents IDBRequest and EventTarget. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface. blocked Fired when an open connection to a database is blocking a versionchange transaction on the sa...
IDBTransaction - Web APIs
strophic events are rare, most consumers should not need to concern themselves further. If you must ensure durability for some reason (e.g. you're storing critical data that cannot be recomputed later) you can force 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. Properties IDBTransaction.db Read only The database connection with which this transaction is associated. IDBTransaction.error Read only Returns 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. ID...
IIRFilterNode - Web APIs
time reference; they continue to output non-silent audio with zero input. As an IIR filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. The actual time that takes depends on the filter coefficients provided. Constructor IIRFilterNode() Creates a new instance of an IIRFilterNode object. Properties This interface has no properties of its own; however, it inherits properties from its parent, AudioNode. Methods 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 ...
IdleDeadline - Web APIs
s established by calling Window.requestIdleCallback(). It offers a 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 i...
ImageBitmap - Web APIs
The ImageBitmap interface represents a bitmap image which can be drawn to a <canvas> without undue latency. It can be created from a variety of source objects using the createImageBitmap() factory method. ImageBitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in WebGL. Properties ImageBitmap.height Read only Is an unsigned long representing the height, in CSS pixels, of the ImageData. ImageBitmap.width Read only Is an unsigned long representing the width, in CSS pixels, of the ImageData. Methods ImageBitmap.close() Disposes of all graphical resources associated with an ImageBitmap. Specifications Specification Status Comment HTML Living StandardThe definition of 'ImageBitmap' in that specification. L...
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 reduction ...
ImageCapture - Web APIs
vides methods to enable the capture of images or photos from a camera or other photographic device. It provides an interface for capturing images from a photographic device referenced through a valid MediaStreamTrack. Constructor ImageCapture() Creates a new ImageCapture object which can be used to capture still frames (photos) from a given MediaStreamTrack which represents a video stream. Properties ImageCapture.track Read only Returns a reference to the MediaStreamTrack passed to the constructor. Methods The ImageCapture interface is based on EventTarget, so it includes the methods defined by that interface as well as the ones listed below. ImageCapture.takePhoto() Takes a single exposure using the video capture device sourcing a MediaStreamTrack and returns a Promise that resol...
ImageData - Web APIs
Web › API › ImageData
It can also be used to set a part of the canvas by using putImageData(). Constructors ImageData() Creates an ImageData object from a given Uint8ClampedArray 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.
Checking when a deadline is due - Web APIs
transaction and provide messages to notify the user if this was successful or failed.Then an objectStore is created into which the new item is added. The notified property of the data object indicates that the to-do list item's deadline has not yet come up and been notified - more on this later! Note: The db variable stores a reference to the IndexedDB database instance; we can then use various properties of this variable to manipulate the data. request.onsuccess = function(event) { note.innerHTML += '<li>New item added to database.</li>'; title.value = ''; hours.value = null; minutes.value = null; day.value = 01; month.value = 'January'; year.value = 2020; }; } This next section creates a log message to say the new item addition is success...
InputDeviceCapabilities - Web APIs
tDeviceCapabilities instance. In some instances, InputDeviceCapabilities represents the capabilities of logical devices rather than physical devices. This allows, for example, touchscreen keyboards and physical keyboards to be represented the same way when they produce the same input. Constructors InputDeviceCapabilities.InputDeviceCapabilities() Creates an InputDeviceCapabilities object. Properties InputDeviceCapabilities.firesTouchEventsRead only A Boolean that indicates whether the device dispatches touch events. Methods None. Specifications Specification Status Comment InputDeviceCapabilitiesThe definition of 'sourceCapabilities' in that specification. Draft Initial definition. ...
InputEvent - Web APIs
231" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="281" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">InputEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor InputEvent() Creates an InputEvent object. Properties This interface inherits properties from its parents, UIEvent and Event. InputEvent.dataRead only Returns a DOMString with the inserted characters. This may be an empty string if the change doesn't insert text (such as when deleting characters, for example). InputEvent.dataTransferRead only Returns a DataTransfer object containing information about richtext or plaintext data being added t...
InstallEvent - Web APIs
height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="366" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">InstallEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor InstallEvent.InstallEvent() Creates a new InstallEvent object. Properties Inherits properties from its ancestor, Event. InstallEvent.activeWorker Read only Returns the ServiceWorker that is currently controlling the page. Methods Inherits methods from its parent, ExtendableEvent. Examples This code snippet is from the service worker prefetch sample (see prefetch running live.) The code calls ExtendableEvent.waitUntil() in ServiceWorkerGlobalScope.oninstall a...
IntersectionObserver - Web APIs
erver object is only useful for watching for specific changes in degree of visibility; however, you can watch multiple target elements with the same observer. 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. If no root value was passed to the constructor or its value is null, the top-level document's viewport is used. IntersectionObserver.rootMargin Read only An offset rectangle applied to the root's bounding box when calculating intersections, effectively shrin...
IntersectionObserverEntry - Web APIs
The IntersectionObserverEntry interface of the Intersection Observer API describes the intersection between the target element and its root container at a specific moment of transition. Instances of IntersectionObserverEntry are delivered to an IntersectionObserver callback in its entries parameter; otherwise, these objects can only be obtained by calling IntersectionObserver.takeRecords(). Properties IntersectionObserverEntry.boundingClientRect Read only Returns the bounds rectangle of the target element as a DOMRectReadOnly. The bounds 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 ...
Intersection Observer API - Web APIs
ectangles; elements which are irregularly shaped are considered as occupying the smallest rectangle which encloses all of the element's parts. Similarly, if the visible portion of an element is not rectangular, the element's intersection rectangle is construed to be the smallest rectangle that contains all the visible portions of the element. It's useful to understand a bit about how the various properties provided by IntersectionObserverEntry describe an intersection. The intersection root and root margin Before we can track the intersection of an element with a container, we need to know what that container is. That container is the intersection root, or root element. This can be either a specific element in the document which is an ancestor of the element to be observed, or null to use the doc...
InterventionReportBody - Web APIs
of its Report.body property). 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. message A string containing a human-readable description of the intervention, including information such how the intervention could be avoided. This typically matches the message a browser will display in its DevTools console when an intervention is imposed, if one i...
Keyboard - Web APIs
Web › API › Keyboard
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
egister 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 ...
Key Values - Web APIs
01000008) KEYCODE_BREAK (121) "Play" The Play key. Resumes a previously paused application, if applicable. Note: This shouldn't be confused with the "MediaPlay" key value, which is used for media controllers, rather than to control applications and processes. VK_PLAY (0xFA) GDK_KEY_3270_Play (0xFD16) Qt::Key_Play (0x01020005) "Props" The Props (Properties) key. "Select" The Select key. VK_SELECT (0x29) GDK_KEY_Select (0xFF60) KEYCODE_BUTTON_SELECT (109) "ZoomIn" [6] The ZoomIn key. GDK_KEY_ZoomIn (0x1008FF8B) Qt::Key_ZoomIn (0x010000F6) KEYCODE_ZOOM_IN (168) "ZoomOut" [6] The ZoomOut key. GDK_KEY_ZoomOut (0x1008FF8C) Qt::Key_ZoomOut (0x010000F7) KE...
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 - 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). 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 ...
KeyframeEffectOptions - Web APIs
The KeyframeEffectOptions dictionary, part of the Web Animations API, is used by Element.animate(), KeyframeEffectReadOnly() and KeyframeEffect() to describe timing properties for animation effects. These properties are all optional, although without setting a duration the animation will not play. Simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. 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 tra...
LayoutShiftAttribution - Web APIs
LayoutShiftAttribution.previousRect Returns a DOMRect representing the position of the element before the shift. LayoutShiftAttribution.currentRect Returns a DOMRect representing the position of the element after the shift. ...
LinearAccelerationSensor - Web APIs
eter' device sensor through the Permissions API. 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. Constructor LinearAccelerationSensor.LinearAccelerationSensor() Creates a new LinearAccelerationSensor object. Properties LinearAccelerationSensor.x Read only Returns a double containing the linear acceleration of the device along the device's x axis. LinearAccelerationSensor.y Read only Returns a double containing the linear acceleration of the device along the device's y axis. LinearAccelerationSensor.z Read only Returns a double containing the linear acceleration of the device along the device's z axis...
LinkStyle - Web APIs
Web › API › LinkStyle
LinkStyle.sheet Read only Returns the CSSStyleSheet object associated with the given element, or null if there is none. Methods This interface implements no method. ...
Location - Web APIs
Web › API › Location
Location.href Is a stringifier that returns a USVString containing the entire URL. If changed, the associated document navigates to the new page. It can be set from a different origin than the associated doc...
Locks.name - Web APIs
Web › API › Lock › name
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 Specification Status Comment Web Locks APIThe definition of 'name' in that specification. Draft Initial definition. ...
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 - 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 The LockedFile interface provides tools to deal with a given file with all the necessary locks. Properties LockedFile.fileHandle Read only The FileHandle object from which the lock was opened. LockedFile.mode Read only The mode for accessing the file; can be readonly or readwrite. LockedFile.active Read only A flag indicating if the file can be accessed (true) or not (false). LockedFile.location The position of the reading/writing pointer within the file. Events Handler LockedFile.oncom...
MIDIAccess - Web APIs
MIDIAccess.outputs Read only Returns an instance of MIDIOutputMap which provides access to any available MIDI output ports. MIDIAccess.sysexEnabled Read only A boolean attribute indicating whether system exclusive support is enabled on the current MIDIAccess instance. ...
MIDIConnectionEvent - Web APIs
e MIDIAccess interface and the onstatechange event of the MIDIPorts interface. This occurs any time a new port becomes available, or when a previously available port becomes unavailable. For example, this event is fired whenever a MIDI device is either plugged in to or unplugged from a computer. Constructor MIDIConnectionEvent.MIDIConnectionEvent Creates a new MIDIConnectionEvent object. Properties MIDIConnectionEvent.port Returns a reference to a MIDIPort instance for a port that has been connected or disconnected." Examples Specifications Specification Status Comment Web MIDI API Working Draft Initial definition. ...
MIDIInput - Web APIs
Web › API › MIDIInput
Event handlers MIDIInput.onmidimessage When the current port receives a MIDIMessage it triggers a call to this event handler. ...
MIDIMessageEvent - Web APIs
b MIDI API represents the event passed to the onmidimessage event handler of the MIDIInput interface. A midimessage event is fired every time a MIDI message is sent from a device represented by a MIDIInput, for example when a MIDI keyboard key is pressed, a knob is tweaked, or a slider is moved. Constructor MIDIMessageEvent.MIDIMessageEvent Creates a new MIDIMessageEvent object instance. Properties MIDIConnectionEvent.data A Uint8Array containing the data bytes of a single MIDI message. See the MIDI specification for more information on its form. Note: Even though the Web MIDI API specifies a receivedTime property that returns a DOMHighResTimeStamp, Chrome (the only implementation at the time of writing) does not support that property since the basic Event.timeStamp property already ...
MSGestureEvent - Web APIs
ureEnd, MSGestureTap, MSGestureHold, MSGestureChange, and MSInertiaStart. MSGestureEvent derives from UIEvent, which in turn derives from Event. Though the MSGestureEvent.initGestureEvent() method is kept for backward compatibility, the creation of an MSGestureEvent object should be done using the MSGestureEvent() constructor. Constructor MSGestureEvent() Creates an MSGestureEvent object. Properties This interface also inherits 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 c...
MSGraphicsTrust - 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 msGraphicsTrust() constructor returns an object that provides properties for info on protected video playback. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax var trustObject = media.msGraphicsTrustStatus; Parameters constrictionActive A read-only property which returns true when protected media is forced to play in a lower resolution. status A read-only property which returns an enum with the driver status when playing protected content. Inheritance hierarch...
MSManipulationEvent - Web APIs
ent provides contextual information when contact is made to the screen and an element is manipulated. This proprietary method is specific to Internet Explorer. Events MSManipulationStateChanged: Event fires when the state of an element being manipulated has changed. Methods MSManipulationEvent.initMSManipulationEvent(): Used to create a manipulation event that can be called from JavaScript. Properties Property Description currentStateRead only Returns the current state of a manipulation event. inertiaDestinationXRead only Represents the predicted horizontal scroll offset after the inertia phase completes. inertiaDestinationYRead only Represents the predicted vertical scroll offset after the inertia phase completes. lastStateRead ...
Magnetometer - Web APIs
st grant permission to the 'magnetometer' device sensor through the Permissions API. If a feature policy blocks use of a feature, it's 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. Constructor Magnetometer.Magnetometer() Creates a new Magnetometer object. Properties Magnetometer.x Read only Returns a double containing the magnetic field around the device's x axis. Magnetometer.y Read only Returns a double containing the magnetic field around the device's y axis. Magnetometer.z Read only Returns a double containing the magnetic field around the device's z axis. Example The magnetometer is typically read in the Sensor.onreading event callback. In...
MediaCapabilities.decodingInfo() - Web APIs
The MediaCapabilities.decodingInfo() method, part of the Media Capabilities API, returns a promise with the tested media configuration's mediaCapabilitiesInfo; this contains the three Boolean properties supported, smooth, and powerefficient, which describe whether 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. Return value A Promise fulfilling with a MediaCapabilitiesInfo interface containing three Boolean attributes: supported smooth powerEfficient Exceptio...
MediaCapabilities.encodingInfo() - Web APIs
The MediaCapabilities.encodingInfo() method, part of the MediaCapabilities interface of the Media Capabilities API, returns a promise with the tested media configuration's MediaCapabilitiesInfo; this contains the three Boolean properties supported, smooth, and powerefficient, 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. Return value A Promise fulfilling with a MediaCapabilitiesInfo interface containing three Boolean attributes: supported smooth powerEffici...
MediaConfiguration - Web APIs
If you plan on querying encoding information, set the media type to record or transmission. ...
MediaDeviceInfo - Web APIs
It is un-guessable by other applications and unique to the origin of the calling application. ...
MediaDevices: devicechange event - Web APIs
A devicechange event is sent to a MediaDevices instance whenever a media device such as a camera, microphone, or speaker is connected to or removed from the system. It's a generic Event with no added properties. Bubbles No Cancelable No Interface Event Event handler ondevicechange Example You can use the devicechange event in an addEventListener method: navigator.mediaDevices.addEventListener('devicechange', function(event) { updateDeviceList(); }); Or use the ondevicechange event handler property: navigator.mediaDevices.ondevicechange = function(event) { updateDeviceList(); } Specifications Specification Status Media Capture and StreamsThe definition of 'devicechange' in that specification. Candidate Reco...
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> CSS...
MediaDevices.getUserMedia() - Web APIs
wsers. It is recommended to use the adapter.js polyfill instead, which does handle constraints. // Older browsers might not implement mediaDevices at all, so we set an empty object first if (navigator.mediaDevices === undefined) { navigator.mediaDevices = {}; } // Some browsers partially implement mediaDevices. We can't just assign an object // with getUserMedia as it would overwrite existing properties. // Here, we will just add the getUserMedia property if it's missing. if (navigator.mediaDevices.getUserMedia === undefined) { navigator.mediaDevices.getUserMedia = function(constraints) { // First get ahold of the legacy getUserMedia, if present var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia; // Some browsers just don't implement it - return a reject...
MediaElementAudioSourceNode() - Web APIs
e() constructor creates a new MediaElementAudioSourceNode object instance. Syntax var myAudioSource = new MediaElementAudioSourceNode(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 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(...
MediaElementAudioSourceNode - Web APIs
in the creation of the node, or is 1 if the HTMLMediaElement has no audio. Number of inputs 0 Number of outputs 1 Channel count defined by the media in the HTMLMediaElement passed to the AudioContext.createMediaElementSource method that created it. Constructor MediaElementAudioSourceNode() Creates a new MediaElementAudioSourceNode object instance. Properties Inherits properties from its parent, AudioNode. mediaElement Read only The HTMLMediaElement used when constructing this MediaStreamAudioSourceNode. Methods Inherits methods from its parent, AudioNode. Example This simple example creates a source from an <audio> element using createMediaElementSource(), then passes the audio through a GainNode before feeding it into the AudioDestination...
MediaError - Web APIs
The MediaError interface represents an error which occurred while handling media in an HTML media element based on HTMLMediaElement, such as <audio> or <video>. A MediaError object describes the error in general terms using a numeric code categorizing the kind of error, and a message, which provides specific diagnostics about what went wrong. Properties This interface doesn't inherit any properties. MediaError.code A number which represents the general type of error that occurred, as follows: Name Value Description MEDIA_ERR_ABORTED 1 The fetching of the associated resource was aborted by the user's request. MEDIA_ERR_NETWORK 2 Some kind of network error occurred which prevented the media from being successfully fetched, despite having previou...
MediaImage - Web APIs
sizes Specifies the resource in multiple sizes so that user agent does not have to scale a single image. type The MIME type hint for the user agant. ...
MediaKeyMessageEvent - Web APIs
l="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="216" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">MediaKeyMessageEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MediaKeyMessageEvent() Creates a new instance of MediaKeyMessageEvent. Properties Inherits properties from its parent, Event. MediaKeyMessageEvent.message Read only Returns an ArrayBuffer with a message from the content decryption module. Messages vary by key system. MediaKeyMessageEvent.messageType Read only Indicates the type of message. May be one of license-request, license-renewal, license-release, or individualization-request. Methods Inherits methods from it...
MediaKeySession - Web APIs
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. ...
MediaKeyStatusMap - Web APIs
Methods MediaKeyStatusMap.entries() Read only Returns a new Iterator object containing an array of [key, value] for each element in the status map, in insertion order. MediaKeyStatusMap.forEach(callback[, argument]) Read only Calls callback once for each key-value pair in the status map, in insertion order. If argument is present it will be passed to the callback. ...
MediaKeySystemAccess - Web APIs
Methods MediaKeySystemAccess.createMediaKeys() Returns a Promise that resolves to a new MediaKeys object. ...
MediaKeySystemConfiguration - Web APIs
An initialization data type is a string indicating the format of the initialization data. MediaKeySystemConfiguration.audioCapabilities Read only Returns a list of supported audio type and capability pairs. MediaKeySystemConfiguration.videoCapabilities Read only Returns a list of supported video type and capability pairs. ...
MediaKeys - Web APIs
Web › API › MediaKeys
Methods MediaKeys.createSession() Returns a new MediaKeySession object, which represents a context for message exchange with a content decryption module (CDM). MediaKeys.setServerCertificate() Returns a Promise to a server certificate to be used to encrypt messages to the license server. ...
MediaList - Web APIs
Web › API › MediaList
Properties MediaList.mediaText A stringifier that returns a DOMString representing the MediaList as text, and also allows you to set a new MediaList. MediaList.length Read only Returns the number of media queries in the MediaList. Methods MediaList.appendMedium() Adds a media query to the MediaList. ...
MediaMetadata - Web APIs
MediaMetadata.artist Returns or sets the name of the artist, group, creator, etc. of the media to be played. MediaMetadata.album Returns or sets the name of the album or collection containing the media to be played. ...
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. 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...
MediaQueryList - Web APIs
otifications 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. Methods The MediaQueryList interface inherits methods from its parent interface, EventTarget. addListener() Ad...
MediaQueryListEvent.MediaQueryListEvent() - Web APIs
matches: A Boolean representing the media query status -- true if it matches, false if not. ...
MediaQueryListEvent - Web APIs
The MediaQueryListEvent object stores information on the changes that have happened to a MediaQueryList object -- instances are available as the event object on a function referenced by a MediaQueryList.onchange property or MediaQueryList.addListener() call. Constructor MediaQueryListEvent() Creates a new MediaQueryListEvent instance. Properties The MediaQueryListEvent interface inherits properties from its parent interface, Event. MediaQueryListEvent.matchesRead only A Boolean that returns true if the document currently matches the media query list, or false if not. MediaQueryListEvent.mediaRead only A DOMString representing a serialized media query. Methods The MediaQueryListEvent interface inherits methods from its parent interface, Event. Examples var mql = window.mat...
MediaRecorder.onpause - Web APIs
Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorder.onpause' in that specification. Working Draft Initial definition ...
MediaRecorder.onresume - Web APIs
Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorder.onresume' in that specification. Working Draft Initial definition ...
MediaRecorder.onstart - Web APIs
t, the data starts being gathered into a Blob. Syntax MediaRecorder.onstart = function(event) { ... } MediaRecorder.addEventListener('start', function(event) { ... }) Example ... record.onclick = function() { mediaRecorder.start(); console.log("recorder started"); } mediaRecorder.onstart = function() { // do something in response to // recording being started } ... Properties None. Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorder.onstart' in that specification. Working Draft Initial definition ...
MediaRecorder.onwarning - Web APIs
...
MediaRecorder - Web APIs
cording API provides functionality to easily record media. It is created using the MediaRecorder() constructor. Constructor MediaRecorder() Creates a new MediaRecorder object, given a MediaStream to record. Options are available to do things like set the container's MIME type (such as "video/webm" or "video/mp4") and the bit rates of the audio and video tracks or a single overall bit rate. Properties MediaRecorder.mimeType Read only Returns the MIME type that was selected as the recording container for the MediaRecorder object when it was created. MediaRecorder.state Read only Returns the current state of the MediaRecorder object (inactive, recording, or paused.) MediaRecorder.stream Read only Returns the stream that was passed into the constructor when the MediaRecorder was create...
MediaRecorderErrorEvent() - Web APIs
rderErrorEvent(errorInfo) Parameters errorInfo An object describing the error object to be created. It must contain the error property at a minimum. error A DOMException that describes the error that occurred. This object's name property should indicate the name of the error that occurred. The other fields may or may not be present. Some user agents add to the error object other properties that provide information such as stack dumps, the name of the JavaScript file and the line number where the error occurred, and other debugging aids, but you should not rely on this information in a production environment. Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorderErrorEvent()' in that specification. Working Draf...
MediaRecorderErrorEvent - Web APIs
error Read only A DOMException containing information about the error that occurred. Read only. Constructor MediaStreamRecorderEvent() Creates and returns a new MediaRecorderErrorEvent event object with the given parameters. Methods Inherits methods from its parent interface, Event. ...
MediaSession - Web APIs
ata that can be sent by the user agent to the device or operating system for presentation in standardized user interface elements. For example, a smartphone might have a standard panel in its lock screen 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...
MediaSessionActionDetails - Web APIs
See Media action types below for possible values. ...
MediaSettingsRange - Web APIs
MediaSettingsRange.min Returns the minimum value of this setting. MediaSettingsRange.step Returns the minimum difference between consecutive values of this setting. ...
MediaSource - Web APIs
e="#D4DDE4" stroke-width="2px" /><text x="206" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">MediaSource</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MediaSource() Constructs and returns a new MediaSource object with no associated source buffers. Properties MediaSource.sourceBuffers Read only Returns a SourceBufferList object containing the list of SourceBuffer objects associated with this MediaSource. MediaSource.activeSourceBuffers Read only Returns a SourceBufferList object containing a subset of the SourceBuffer objects contained within MediaSource.sourceBuffers -- the list of objects providing the selected video track, enabled audio tr...
MediaStream - Web APIs
(). Some user agents subclass this interface to provide more precise information or functionality, like in CanvasCaptureMediaStream. 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...
MediaStreamAudioDestinationNode.MediaStreamAudioDestinationNode() - Web APIs
Web Audio API creates a new MediaStreamAudioDestinationNode object instance. 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 Draf...
MediaStreamAudioDestinationNode - Web APIs
sing the AudioContext.createMediaStreamDestination method. Number of inputs 1 Number of outputs 0 Channel count 2 Channel count mode "explicit" Channel count interpretation "speakers" Constructor MediaStreamAudioDestinationNode.MediaStreamAudioDestinationNode() Creates a new MediaStreamAudioDestinationNode object instance. Properties Inherits properties from its parent, AudioNode. MediaStreamAudioDestinationNode.stream Is a MediaStream containing a single AudioMediaStreamTrack with the same number of channels as the node itself. You can use this property to get a stream out of the audio graph and feed it into another construct, such as a Media Recorder. Methods Inherits methods from its parent, AudioNode. Example ...
MediaStreamAudioSourceNode() - Web APIs
ediaStreamAudioSourceNode is to call theAudioContext.createMediaStreamSource() method, specifying the stream from which you want to obtain audio. Syntax audioSourceNode = new MediaStreamAudioSourceNode(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. Ex...
MediaStreamAudioSourceNode - Web APIs
of tracks found in the selected audio track. Number of inputs 0 Number of outputs 1 Channel count defined by the first audio MediaStreamTrack passed to the AudioContext.createMediaStreamSource() method that created it. Constructor new MediaStreamAudioSourceNode() Creates a new MediaStreamAudioSourceNode object instance with the specified options. Properties In addition to the following properties, MediaStreamAudioSourceNode inherits the properties of its parent, AudioNode. mediaStream Read only The MediaStream used when constructing this MediaStreamAudioSourceNode. Methods Inherits methods from its parent, AudioNode. Exceptions InvalidStateError The stream specified by the mediaStream parameter does not contain any audio tracks. Usag...
MediaStreamAudioSourceOptions - Web APIs
The MediaStreamAudioSourceOptions dictionary provides configuration options used when creating a MediaStreamAudioSourceNode using its constructor. It is not needed when using the AudioContext.createMediaStreamSource() method. Properties mediaStream A required property which specifies the MediaStream from which to obtain audio for the node. Specifications Specification Status Comment Web Audio APIThe definition of 'MediaStreamAudioSourceOptions' in that specification. Working Draft ...
MediaStreamConstraints.audio - Web APIs
rack should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getUserMedia() will fail. If false, no audio track is included. MediaTrackConstraints A constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. If you specify constraints, an audio track meeting the constraints is required. Examples For browsers with Feature Policy enabled, the samples below need the microphone feature enabled. See Security in MediaDevices.getUserMedia() for details and examples on how to configure this. Using a Boolean value In this example, we provide a simple value of true for the audio property. This tells getU...
MediaStreamConstraints.video - Web APIs
track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getUserMedia() will fail. If false, no video track is included. MediaTrackConstraints A constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. If you specify constraints, a video track meeting these constraints is required. Examples Using a Boolean value In this example, we provide a simple value of true for the video property. This tells getUserMedia() that we require a video track, but we don't care about any specifics beyond that. HTML content <p>Click the start button below to begin the demonstration.</p> <div id="startButto...
MediaStreamConstraints - Web APIs
The MediaStreamConstraints dictionary is used when calling getUserMedia() to specify what kinds of tracks should be included in the returned MediaStream, and, optionally, to establish constraints for those tracks' settings. 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. Track constraints audio Either a Boolean (which indicates whether or not an audio track is requested) or a MediaTrackConstraints object providing the constraints which must be met by the audio track included in the returned MediaStream. If constraints are specified, an audio track is inherently requested. video Either a Boolean (which indicates whether or not a video track is r...
MediaStreamTrack.getCapabilities() - Web APIs
kCapabilities 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 Capture and StreamsThe definition of 'getCapabilities()' in that specification. Candidat...
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(). Specifica...
MediaStreamTrackAudioSourceNode() - Web APIs
e is to call theAudioContext.createMediaStreamTrackSource() method, specifying the MediaStreamTrack from which you want to obtain audio. Syntax audioTrackNode = new MediaStreamTrackAudioSourceNode(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 ...
MediaStreamTrackAudioSourceNode - Web APIs
first audio track on a stream. Number of inputs 0 Number of outputs 1 Channel count defined by the first audio MediaStreamTrack passed to the AudioContext.createMediaStreamTrackSource() method that created it. Constructor new MediaStreamTrackAudioSourceNode() Creates a new MediaStreamTrackAudioSourceNode object instance with the specified options. Properties The MediaStreamTrackAudioSourceNode interface has no properties of its own; however, it inherits the properties of its parent, AudioNode. Methods Inherits methods from its parent, AudioNode. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaSt...
MediaStreamTrackAudioSourceOptions - Web APIs
The MediaStreamTrackAudioSourceOptions dictionary is used when specifying options to the MediaStreamTrackAudioSourceNode() constructor. It isn't needed when using the AudioContext.createMediaStreamTrackSource() method. Properties mediaStreamTrack The MediaStreamTrack from which to take audio data for this node's output. Specifications Specification Status Comment Web Audio APIThe definition of 'MediaStreamTrackAudioSourceOptions' in that specification. Working Draft ...
MediaStream Image Capture API - Web APIs
diaStream object. navigator.mediaDevices.getUserMedia({ video: true }) .then(mediaStream => { // Do something with the stream. }) Next, isolate the visual part of the media stream. Do this by calling MediaStream.getVideoTracks(). This returns an array of MediaStreamTrack objects. The code below assumes that the first item in the MediaStreamTrack array is the one to use. You can use the properties of the MediaStreamTrack objects to select the one you need. const track = mediaStream.getVideoTracks()[0]; At this point, 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 wh...
MediaStream Recording API - Web APIs
If you need or want to check to see if a specific MIME type is supported, that's possible as well. Just call MediaRecorder.isTypeSupported(). Examining potential input sources If your goal is to record camera and/or microphone inpu...
Media Capture and Streams API (Media Stream) - Web APIs
started unmuted Guides and tutorials The articles below 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
ave to create these events yourself; instead, just handle the merchantvalidation event. Syntax merchantValidationEvent = new MerchantValidationEvent(type, options); Parameters type A DOMString which must be merchantvalidation, the only type of event which uses the MerchantValidationEvent interface. options Optional An optional dictionary 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 t...
MerchantValidationEvent - Web APIs
rchant to verify themselves as allowed to use a particular payment handler. To learn more about merchant validation, see Merchant validation in Payment processing concepts. Constructor MerchantValidationEvent() Secure context Creates a new MerchantValidationEvent object describing a merchantvalidation event that will be sent to the payment handler to request that it validate the merchant. Properties MerchantValidationEvent.methodName Secure context A DOMString providing a unique payment method identifier for the payment handler that's requiring validation. This may be either one of the standard payment method identifier strings or a URL that both identifies and handles requests for the payment handler, such as https://apple.com/apple-pay. MerchantValidationEvent.validationURL Secure con...
MessageChannel - Web APIs
Note: This feature is available in Web Workers. Properties MessageChannel.port1 Read only Returns port1 of the channel. MessageChannel.port2 Read only Returns port2 of the channel. Constructor MessageChannel() Returns a new MessageChannel object with two new MessagePort objects. Example In the following example, you can see a new channel being created using the MessageChannel.MessageChannel constructor. ...
MessageEvent.MessageEvent() - Web APIs
This can be of any data type, and will default to null if not specified. ...
MessageEvent - Web APIs
6" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="176" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">MessageEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MessageEvent() Creates a new MessageEvent. Properties This interface also inherits properties from its parent, Event. MessageEvent.data Read only The data sent by the message emitter. MessageEvent.origin Read only A USVString representing the origin of the message emitter. MessageEvent.lastEventId Read only A DOMString representing a unique ID for the event. MessageEvent.source Read only A MessageEventSource (which can be a WindowProx...
Metadata - Web APIs
Web › API › Metadata
The Metadata interface is used by the File and Directory Entries API to contain information about a file system entry. This metadata includes the file's size and modification date and time. This interface isn't available through the global scope; instead, you obtain a Metadata object describing a FileSystemEntry using the method FileSystemEntry.getMetadata(). Properties modificationTime Read only A Date object indicating the date and time the entry was modified. size Read only A 64-bit unsigned integer indicating the size of the entry in bytes. 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 compatibil...
MimeType - Web APIs
Web › API › MimeType
MimeType.description Returns a description of the associated plugin or an empty string if there is none. MimeType.suffixes A string containing valid file extensions for the data displayed by the plugin, or an empty string if an extension is not valid for the particular module. ...
MimeTypeArray - Web APIs
Methods MimeTypeArray.item() Returns the MimeType object with the specified index. MimeTypeArray.namedItem() Returns the MimeType object with the specified name. Example The following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. ...
MouseWheelEvent - Web APIs
The MouseWheelEvent interface represents events that occur due to the user turning a mouse wheel. Do not use this interface for wheel events. 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. ...
MutationEvent - Web APIs
Note: Mutation Events (W3C DOM Level 3 Events) have been deprecated in favor of Mutation Observers (W3C DOM4). Preface The mutation events have been marked as deprecated in the DOM Events specification, as the API's design is flawed (see details in the "DOM Mutation Events Replacement: The Story So Far / Existing Points of Consensus" post to public-webapps). Mutation Observers are the proposed replacement for mutation events in DOM4. They are expected to be included in Firefox 14 and Chrome 18. The practical reasons to avoid the mutation events are performance issues and cross-browser support. ...
MutationRecord - Web APIs
MutationRecord.target Node Returns the node the mutation affected, depending on the MutationRecord.type. For attributes, it is the element whose attribute changed. For characterData, it is the CharacterData node. ...
NDEFReader - Web APIs
The NDEFReader interface of the Web NFC API is an abstract interface used to read data from compatible NFC devices, e.g. NFC tags supporting NDEF, when these devices are within the reader's magnetic induction field. Constructor NDEFReader.NDEFReader() Returns an NDEFReader with configuration specified in the parameters or default ones if no parameters are specified. Properties In addition to the properties listed below, NDEFReader inherits properties from its parent interface, EventTarget. NDEFReader.onreading An event handler for reading event, that notifies about availability of a new reading. NDEFReader.onerror An event handler for error event which is called to notify that an error occured during reading. Methods The NDEFReader interface inherits the methods of EventT...
NameList - Web APIs
Web › API › NameList
id 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 Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'NameList' in that specification. O...
NamedNodeMap - Web APIs
ar order, unlike NodeList, although they may be accessed by an index as in an array. A NamedNodeMap object is live and will thus be auto-updated if changes are made to its contents internally or elsewhere. Although called NamedNodeMap, this interface doesn't deal with Node objects but with Attr objects, which were originally a specialized class of Node, and still are in some implementations. Properties This interface doesn't inherit any property. NamedNodeMap.length Read only Returns the amount of objects in the map. Methods This interface doesn't inherit any method. NamedNodeMap.getNamedItem() Returns a Attr, corresponding to the given name. NamedNodeMap.setNamedItem() Replaces, or adds, the Attr identified in the map by the given name. NamedNodeMap.removeNamedItem() Removes t...
NavigationPreloadManager - Web APIs
) 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 => { event.waitUntil(async function() { if (self.registration.navigationPreload) { // Enable navigation preloads! await self.registration.navigationPreload.enable(); } }()); })...
Using Navigation Timing - Web APIs
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 particular, you need to know: Was this a load or a reload? Was this a navigation or a move forward or backward through history? How many (if any) redirects were required in order to complete the...
Navigation Timing API - Web APIs
ata that was previously difficult to obtain, such as the amount of time needed to unload the previous page, how long domain lookups take, the total time spent executing the window's load handler, and so forth. Interfaces Performance The window.performance property returns a Performance object. While this interface is defined by the High Resolution 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 infor...
NavigatorConcurrentHardware - Web APIs
ving to share CPUs. Modern computers have multiple physical cores in their CPU (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. So a four-core CPU may return 8. The browser may, however, choose to reduce the number in order to represent more accurately the number of Workers that can run at once Properties NavigatorConcurrentHardware.hardwareConcurrency Read only Returns the number of logical processors which may be available to the user agent. This value is always at least 1, and will be 1 if the actual number of logical processors can't be determined. Methods The NavigatorConcurrentHardware mixin has no methods. Specifications Specification Status Comment HTM...
NavigatorID.appVersion - Web APIs
navigator.appVersion); Notes The window.navigator.userAgent property may also contain the version number (for example "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. The window.navigator.appVersion, window.navigator.appName and window.navigator.userAgent 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. Specific...
NavigatorID.userAgent - Web APIs
ings 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 browsers comply with the following general structure: userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU; Localization; rv: revision-version-number) product/productSub Application-Name Application-Name-version Example alert(window.navigator.userAgent) // alerts "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/200107...
NavigatorID - Web APIs
NavigatorID.appCodeName Read only 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. ...
NavigatorLanguage - Web APIs
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. ...
Online and offline events - Web APIs
at window. Both events are non-cancellable (you can't prevent the user from coming online, or going offline). Firefox 41 fires these events when the OS reports a change in network connectivity on Windows, Linux, and OS X. 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.body to a JavaScript Function object. (Note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the HTML markup. Example There's a simple test case that you can run to verify that the events are working (does not work in Chrome due to attaching the event lis...
NavigatorOnLine - Web APIs
There is no object of type NavigatorOnLine, but other interfaces, like Navigator or WorkerNavigator, implement it. Properties The NavigatorOnLine interface doesn't inherit any property. NavigatorOnLine.onLine Read only Returns a Boolean indicating whether the browser is working online. Methods The NavigatorOnLine interface neither implements, nor inherit any method. ...
NavigatorPlugins.mimeTypes - Web APIs
Syntax var mimeTypes[] = navigator.mimeTypes; mimeTypes is a MimeTypeArray object which has a length property as well as item(index) and namedItem(name) methods. ...
NavigatorPlugins - Web APIs
Properties NavigatorPlugins.mimeTypes Read only Returns an MimeTypeArray listing the MIME types supported by the browser. NavigatorPlugins.plugins Read only Returns a PluginArray listing the plugins installed in the browser. Methods The NavigatorPlugins interface doesn't inherit any methods. NavigatorPlugins.javaEnabled() Read only Returns a Boolean flag indicating whether the host browser is Java-enabled or not. ...
NavigatorStorage - Web APIs
ys for Web content to store data on a user's computer, including cookies, the Web Storage API (Window.localStorage and Window.sessionStorage), and IndexedDB. The Storage Standard is designed to serve as a common basis for the implementation of all of those APIs and storage technologies, so that their constraints and configurations can be understood and controlled using a common set of methods and properties. Properties storage Read only Secure context Returns the StorageManager singleton object which is used to access the Storage Manager. Through the returned object, you can control persistence of data stores as well as get estimates of how much space is left for your site or appliation to store data. Methods The NavigatorStorage mixin has no methods. Specifications Specification ...
NetworkInformation.downlink - Web APIs
formation 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 Specification Status Comment Ne...
NetworkInformation.rtt - Web APIs
nformation.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 - Web APIs
The NetworkInformation interface provides information about the connection a device is using to communicate with the network and provides a means for scripts to be notified if the connection type changes. The NetworkInformation interfaces cannot be instantiated. It is instead accessed through the connection property of the Navigator interface. Note: This feature is available in Web Workers. Properties This interface also inherits properties of its parent, EventTarget. NetworkInformation.downlink Read only Returns the effective 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. ...
Node.childNodes - Web APIs
Web › API › Node › childNodes
will change the list's `length` } } Remove all children from a node // This is one way to remove all children from a node // box is an object reference to an element while (box.firstChild) { //The list is LIVE so it will re-index each call box.removeChild(box.firstChild); } Notes The items in the collection of nodes are objects, not strings. To get data from node objects, use their properties. (For example, to get the name of the first childNode: elementNodeReference.childNodes[1].nodeName.) The document object itself has 2 children: the Doctype declaration and the root element, typically referred to as documentElement. (In (X)HTML documents this is the HTML element.) childNodes includes all child nodes--including non-element nodes like text and comment nodes. To get a collection of...
Node.cloneNode() - Web APIs
Web › API › Node › cloneNode
.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 in the same document, then you should modify the clone's ID to be unique. Name attributes may need to be modified also, depending on whether dupli...
Node.textContent - Web APIs
Web › API › Node › textContent
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. ...
NodeFilter - Web APIs
a NodeIterator or TreeWalker. A NodeFilter knows nothing about the document or traversing nodes; it only knows how to evaluate a single node against the provided filter. Note: The browser doesn't provide any object implementing this interface. It is the user who is expected to write one, tailoring the acceptNode() method to its needs, and using it with some TreeWalker or NodeIterator objects. 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: ...
Notation - Web APIs
Web › API › Notation
Its nodeName is the notation name. Has no parent. Properties Notation.publicId Read only Is a DOMString. Notation.systemId Read only Is a DOMString. Specifications Specification Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Notation' in that specification. ...
NotificationAction - Web APIs
Note: This feature is available in Web Workers. The NotificationAction interface of the Notifications API is used to represent action buttons the user can click to interact with notifications. These buttons' appearance and specific functionality vary across platforms but generally they provide a way to asynchronously show actions to the user in a notification. Properties Instance properties These properties are available only on instances of the Notification object. NotificationAction.action Read only The name of the action, which can be used to identify the clicked action similar to input names. NotificationAction.title Read only The string describing the action that is displayed to the user. NotificationAction.icon Read only The URL of the image used to represent the notification ...
NotificationEvent.notification - Web APIs
Returns A Notification object. ...
NotificationEvent - Web APIs
The parameter passed into the onnotificationclick handler, the NotificationEvent interface represents a notification click event that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. This interface inherits from the ExtendableEvent 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...
NotifyAudioAvailableEvent - Web APIs
his 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 non-standard, obsolete, 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 5...
OfflineAudioCompletionEvent - Web APIs
plements this interface. Note: This interface is marked as deprecated; it is still supported for legacy reasons, but it will soon be superseded when the promise version of OfflineAudioContext.startRendering is supported in browsers, which will no longer need it. Constructor OfflineAudioCompletionEvent.OfflineAudioCompletionEvent Creates a new OfflineAudioCompletionEvent object instance. Properties Also inherits properties from its parent, Event. OfflineAudioCompletionEvent.renderedBuffer Read only An AudioBuffer containing the result of processing an OfflineAudioContext. Methods Inherits methods from its parent, Event. Specifications Specification Status Comment Web Audio APIThe definition of 'OfflineAudioCompletionEvent' in that specification. Working...
OfflineAudioContext - Web APIs
roke="#D4DDE4" stroke-width="2px" /><text x="406" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">OfflineAudioContext</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor OfflineAudioContext.OfflineAudioContext() Creates a new OfflineAudioContext instance. Properties Also inherits properties from its parent interface, BaseAudioContext. OfflineAudioContext.length Read only An integer representing the size of the buffer in sample-frames. Event handlers OfflineAudioContext.oncomplete Is an EventHandler called when processing is terminated, that is when the complete event (of type OfflineAudioCompletionEvent) is raised, after the event-based version o...
OffscreenCanvas - Web APIs
OffscreenCanvas.width The width of the offscreen canvas. Methods OffscreenCanvas.getContext() Returns a rendering context for the offscreen canvas. ...
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 wave pro...
OscillatorNode.onended - Web APIs
Specifications Specification Status Comment Web Audio APIThe definition of 'onended' in that specification. Working Draft ...
OverconstrainedError - Web APIs
a Capture and Streams API indicates that the set of desired capabilities for the current MediaStreamTrack cannot currently be met. When this event is thrown on a MediaStreamTrack, it is muted until either the current constraints can be established or until satisfiable constraints are applied. Constructor OverconstrainedError.OverconstrainedError() Creates a new OverconstrainedError object. Properties OverconstrainedError.constraint Read only Returns the constraint that was supplied in the constructor, meaning the constraint that was not satisfied. OverconstrainedError.message Read only Returns the text supplied in the constructor. OverconstrainedError.name Read only Will always return OverconstrainedError. Methods None. Specifications Specification Status Commen...
PaintWorklet.registerPaint - Web APIs
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 parent class of PaintWorklet, at Worklet.addModule(). ...
PannerNode.distanceModel - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PannerNode.maxDistance - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PannerNode.panningModel - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PannerNode.setOrientation() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PannerNode.setPosition() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
PannerNode.setVelocity() - Web APIs
D "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 other variables var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.panningModel = 'HRTF';...
ParentNode.childElementCount - Web APIs
In this case, childElementCount moved to ParentNode. ...
ParentNode.firstElementChild - Web APIs
In this case, firstElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. ...
ParentNode.lastElementChild - Web APIs
In this case, lastElementChild moved to ParentNode. ...
PasswordCredential - Web APIs
the Credential Management API provides information about a username/password pair. In supporting browsers an instance of this class may be passed in the credential member of the init object for global fetch. Note: This interface is restricted to top-level contexts and cannot be used from an <iframe>. Constructor PasswordCredential()Secure context Creates a new PasswordCredential object. Properties Inherits properties from its ancestor, Credential. PasswordCredential.additionalData Secure context 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. PasswordCredential.iconURL Read only Secure context A USVString containing a URL pointing to an image for an icon.
PayerErrors - Web APIs
The PayerErrors dictionary is used by the Payment Request API to indicate the presence of--and to explain how to correct--validation errors in the payer details. For each field in the payment information that fails validation, the PayerErrors object contains a string explaining the error. The payer details include the payer's name, phone number, and email address. Properties email Optional If present, this DOMString is a string describing the validation error from which the payer's email address--as given by PaymentResponse.payerEmail--currently suffers. If this property is absent from the PayerErrors object, the email address passed validation. name Optional If this DOMString is present in the object, the PaymentResponse.payerName property failed validation, and this string explains what n...
PaymentAddress.toJSON() - Web APIs
Syntax var json = PaymentAddress.toJSON() Parameters None. Return value A JSON object. 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. ...
PaymentDetailsBase - Web APIs
These represent the line items on a receipt or invoice. modifiersOptional An array of PaymentDetailsModifier objects, each describing a modifier for particular payment method identifiers. ...
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
entDetailsUpdate dictionary's shippingAddressErrors property, if present, contains an AddressErrors object whose contents provide error messages for one or more of the values in the PaymentAddress specified as PaymentRequest.shippingAddress. Syntax var addressErrors = PaymentDetailsUpdate.shippingAddressErrors; Value An AddressErrors object, which contains DOMStrings describing errors in the properties of a PaymentAddress. 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. In that case, the property in shippingAddressErrors is a string describing the validation error, ideally including suggestions about fixing the error. Specifications Specification Status Comment ...
PaymentDetailsUpdate - Web APIs
ide updated information to the payment user interface after it has been instantiated. This can be done either by calling the PaymentRequestUpdateEvent.updateWith() method or by using the PaymentRequest.show() method's detailsPromise parameter to provide a Promise that returns a PaymentDetailsUpdate that updates the payment information before the user interface is even enabled for the first time. Properties The PaymentDetailsUpdate dictionary is based on the PaymentDetailsBase dictionary, and inherits its properties, which are included in the list below. displayItems Optional An array of PaymentItem objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice. error Optional A DOMString specifying an error message to present to the us...
PaymentItem - Web APIs
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. ...
PaymentMethodChangeEvent - Web APIs
paymentmethodchange event. Syntax paymentMethodChangeEvent = new PaymentMethodChangeEvent(type, options); Parameters type A DOMString which must contain the string paymentmethodchange, the name of the only type of event which uses the PaymentMethodChangeEvent interface. options Optional An optional PaymentMethodChangeEventInit dictionary 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. 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 new...
PaymentMethodChangeEvent - Web APIs
cribes 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 Read only Secure context A DOMString containing the payment method identi...
PaymentRequest - Web APIs
The Payment Request API's PaymentRequest interface the primary access point into the API, and lets web content and apps accept payments from the end user on behalf of the operator of the site or the publisher of the app. Constructor PaymentRequest() Secure context Creates a new PaymentRequest object. Properties PaymentRequest.id Read only Secure context An unique identifier for a particular PaymentRequest, which can be set via details.id. When none is set, it defaults to a UUID. PaymentRequest.shippingAddress Read only Secure context If requested via payment options, returns the shipping address chosen by the user for the purposes of calculating shipping. This property is only populated if the constructor is called with the requestShipping flag set to true. Additionally, in ...
PaymentRequestEvent - Web APIs
The PaymentRequestEvent interface of the the Payment Request API is the object passed to a payment handler when a PaymentRequest is made. Constructor PaymentRequestEvent() Creates a new PaymentRequestEvent object. Properties instrumentKeyRead only Returns a PaymentInstrument object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. methodDataRead only Returns an array of PaymentMethodData objects containing payment method identifers for the payment methods that the web site accepts and any associated payment method specific data. modifiersRead only Returns an array of objects containing changes to payment details. paymentRequestIdRead only Returns the ID of the PaymentRequest object. p...
PaymentRequestUpdateEvent - Web APIs
enever the user changes their shipping address. Also available using the onshippingaddresschange event handler property. shippingoptionchange Secure context Dispatched whenever the user changes a shipping option. Also available using the onshippingoptionchange event handler property. Constructor PaymentRequestUpdateEvent() Secure context Creates a new PaymentRequestUpdateEvent object. Properties Provides only the properties inherited from its parent interface, Event. Methods In addition to methods inherited from the parent interface, Event, PaymentRequestUpdateEvent offers the following methods: PaymentRequestUpdateEvent.updateWith() Secure context If the event handler determines that information included in the payment request needs to be changed, or that new information needs to...
PaymentResponse - Web APIs
The contents of the object depend on the payment method being used; for example, if the Basic Card payment method is used, this object must conform to the structure defined in the BasicCardResponse dictionary. ...
PaymentValidationErrors - Web APIs
cts providing information about any and all errors that occurred while processing a payment request. When validation of the PaymentResponse returned by the PaymentRequest.show() or PaymentResponse.retry() methods fails, your code creates a PaymentValidationErrors object to pass into retry() so that the user agent knows what needs to be fixed and what if any error messages 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 ...
Pbkdf2Params - Web APIs
This should be set to PBKDF2. hash A DOMString representing the digest algorithm to use. 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. ...
performance.toJSON() - Web APIs
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. ...
Performance - Web APIs
the Resource Timing API. An object of this type can be obtained by calling the window.performance read-only attribute. Note: This interface and its members are available in Web Workers, except where indicated below. Also, note that performance markers and measures are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa. Properties The Performance interface doesn't inherit any properties. Performance.navigation Read only A legacy PerformanceNavigation object that provides useful context about the operations included in the times listed in timing, including whether the page was a load or a refresh, how many redirections occurred, and so forth. Not available in workers. Performance.timing Read only A legacy Perfo...
PerformanceEntry.name - Web APIs
ed"); return; } // Create some performance entries via the mark() method performance.mark("Begin"); do_work(50000); performance.mark("End"); // Use getEntries() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not supported"); } for (var i=0; i < methods.length; i++) { // check...
PerformanceEntry.startTime - Web APIs
ed"); return; } // Create some performance entries via the mark() method performance.mark("Begin"); do_work(50000); performance.mark("End"); // Use getEntries() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not supported"); } for (var i=0; i < methods.length; i++) { // check...
PerformanceEntry.toJSON() - Web APIs
ed"); return; } // Create some performance entries via the mark() method performance.mark("Begin"); do_work(50000); performance.mark("End"); // Use getEntries() to iterate through the each entry var p = performance.getEntries(); for (var i=0; i < p.length; i++) { log("Entry[" + i + "]"); check_PerformanceEntry(p[i]); } } function check_PerformanceEntry(obj) { var properties = ["name", "entryType", "startTime", "duration"]; var methods = ["toJSON"]; for (var i=0; i < properties.length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = Not supported"); } for (var i=0; i < methods.length; i++) { // check...
PerformanceEventTiming - Web APIs
PerformanceEventTiming.processingEnd Returns the time at which the event dispatch ended. PerformanceEventTiming.cancelable Returns the associated event's cancelable attribute. PerformanceEventTiming.target Returns the associated event's last target, if it is not removed. Methods PerformanceEven...
PerformanceLongTaskTiming - Web APIs
Specifications Specification Status Comment Long Tasks API 1The definition of 'PerformanceLongTaskTiming' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured...
PerformanceNavigation - Web APIs
This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. The legacy PerformanceNavigation interface 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 butt...
PerformanceResourceTiming.decodedBodySize - Web APIs
n 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) console.log("decodedBodySize = " + perfEntry.decodedBodySize); else console.log("decodedBodySize = NOT supported"); if ("encodedBodySize" in perfEntry) console.log("encodedBodySize ...
PerformanceResourceTiming.encodedBodySize - Web APIs
trieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content-codings. Syntax resource.encodedBodySize; Return value A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings. Example The following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for support of the PerformanceEntry.*size properties and print their values // if supported. if ("decodedBodySize" in perfEntry) console.log("decodedBodySize = " + perfEntry.decodedBodySize); else console.log("decodedBodySize = NOT supported"); if ("encodedBodySize" in perfEntry) console.log(...
PerformanceResourceTiming.transferSize - Web APIs
ure is available in Web Workers. If the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero. Syntax resource.transferSize; Return value A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (RFC7230). Example The following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfEntry){ // Check for support of the PerformanceEntry.*size properties and print their values // if supported. if ("decodedBodySize" in perfEntry) console.log("decodedBodySize = " + perfEntry.decodedBodySize); else console.log("decodedBodySize = NOT supported"); if ("encodedBodySize" in perfEntry) console.log(...
PerformanceServerTiming - Web APIs
Web Workers. The PerformanceServerTiming interface surfaces server metrics 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() Retu...
Using the Performance API - Web APIs
definition of time. The DOMHighResTimeStamp type (a double) is used by all performance interfaces to hold such time values. 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. 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 ti...
Performance Timeline - Web APIs
d performance entries based on the specified name and optionally the performance type. getEntriesByType() Returns the recorded performance entries based on the specified performance type. PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry -- that is, a single data point or metric in the performance timeline. This interface has the following four properties, and these 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...
PeriodicWave.PeriodicWave() - Web APIs
The PeriodicWave() constructor of the Web Audio API creates a new PeriodicWave object instance. Syntax var myWave = new PeriodicWave(context, options); Parameters Inherits parameters from the AudioNodeOptions dictionary. context A BaseAudioContext representing the audio context you want the node to be associated with. options Optional A PeriodicWaveOptions dictionary object defining the properties you want the PeriodicWave to have (It also inherits 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...
PeriodicWave - Web APIs
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 containing a simple ...
PermissionStatus - Web APIs
PermissionStatus.statusRead only Returns the state of a requested permission; one of 'granted', 'denied', or 'prompt'. Later versions of the specification replace this with PermissionStatus.state. Event Handler PermissionStatus.onchange An event called whenever PermissionStatus.status changes. ...
PhotoCapabilities - Web APIs
The "controllable" value means the device's read-eye reduction is controllable by the user. ...
Plugin - Web APIs
Web › API › Plugin
Properties Plugin.description Read only A human readable description of the plugin. Plugin.filename Read only The filename of the plugin file. Plugin.name Read only The name of the plugin. Plugin.version Read only The plugin's version number string. Methods Plugin.item Returns the MIME type of a supported content type, given the index number into a list of supported types. Plugin.namedItem Returns the MIME type of a supported item. ...
PluginArray - Web APIs
The PluginArray interface is used to store a list of Plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. The PluginArray is not a JavaScript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods. Note: Own properties of PluginArray objects are no longer enumerable in the latest browser versions. Properties PluginArray.lengthRead only The number of plugins in the array. Methods PluginArray.item Returns the Plugin at the specified index into the array. PluginArray.namedItem Returns the Plugin with the specified name. PluginArray.refresh Refreshes all plugins on the current page, optionally reloading documents. Ex...
Point - Web APIs
Web › API › Point
Point is an interface, 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...
PointerEvent.tiltX - Web APIs
the specification. Syntax var tiltX = pointerEvent.tiltX; Return value tiltX The angle in degrees between the Y-Z plane of the pointer (stylus) and the screen. The range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. For devices that do not support this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Status Comment Pointer Events - Level 2The definition of 'tiltX' in that specification. Recommendation Non-stable version. Pointer EventsThe definition of 'tiltX' in that specification. Obsolete Initial de...
PointerEvent.tiltY - Web APIs
specification. Syntax var tiltY = pointerEvent.tiltY; Return value tiltY The angle in degrees between the X-Z plane of the pointer (stylus) and the screen. The range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. For devices that do not support this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Status Comment Pointer Events - Level 2The definition of 'tiltY' in that specification. Recommendation Non-stable version. Pointer EventsThe definition of 'tiltY' in that specification. Obsolete Initial def...
PointerEvent.width - Web APIs
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 Specification Status Comment Pointer Events - Level 2The definition of 'width' in that specification. Recommendation Non-stable version. Pointer EventsThe definition of 'width...
PositionOptions - Web APIs
Properties PositionOptions.enableHighAccuracy Secure context 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 device can take the liberty to save resources by responding more quickly and/or using less power. Default: false. ...
ProgressEvent - Web APIs
" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">ProgressEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor ProgressEvent() Creates a ProgressEvent event with the given parameters. Properties Also inherits properties from its parent Event. ProgressEvent.lengthComputable Read only Is a Boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. In other words, it tells if the progress is measurable or not. ProgressEvent.loaded Read only Is an unsigned long long representing the amount of work already perfo...
PromiseRejectionEvent - Web APIs
size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PromiseRejectionEvent</text></a></svg></div> a:hover text { 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 ...
Proximity Events - Web APIs
e. When the browser gets such a notification, it fires a DeviceProximityEvent for any change, and a UserProximityEvent event in the case of a more rough change. This event can be captured at the window object level 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 approxi...
PublicKeyCredential - Web APIs
and data-breach resistant asymmetric key pair instead of a password. It inherits from Credential, and was created by the Web Authentication API extension to the Credential Management API. Other interfaces that inherit from Credential are PasswordCredential and FederatedCredential. Note: This API is restricted to top-level contexts. Use from within an <iframe> element will not have any effect. Properties PublicKeyCredential.type Read only Secure context Inherited from Credential. Always set to public-key for PublicKeyCredential instances. PublicKeyCredential.id Read only Secure context Inherited from Credential and overridden to be the base64url encoding of PublicKeyCredential.rawId. PublicKeyCredential.rawId Read only Secure context An ArrayBuffer that holds the globally unique identifie...
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 devic...
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
dentialCreationOptions 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. transports Optional An Array of strings describing the possible trans...
PublicKeyCredentialCreationOptions.extensions - Web APIs
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 false rejection rate (FRR) below the inputs. The client outputs true if this was taken into account. Note: Extensions are optional and different browsers may recognize different extensions. All extensions are optional for the client to process them: if...
PublicKeyCredentialCreationOptions.pubKeyCredParams - Web APIs
g 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 curve algorithm ECDSA with SHA-256). Though those elements are sor...
PublicKeyCredentialCreationOptions.rp - Web APIs
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"). ...
PublicKeyCredentialCreationOptions.user - Web APIs
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). ...
PublicKeyCredentialRequestOptions.allowCredentials - Web APIs
alCreationOptions.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. transports Optional An Array of strings describing the possible trans...
PublicKeyCredentialRequestOptions.extensions - Web APIs
with legacy FIDO JS APIs to identify the current relying party. txAuthSimple USVString Simple transaction authorization. This text is displayed on a prompt of the authenticator before verifying the user or testing their presence. The client outputs a USVString which is the text as it was displayed (line breaks may have been added). txAuthGeneric An object with two properties: contentType (USVString) content (ArrayBuffer) Generic transaction authorization. This is used to display an image or some non-textual content on the authenticator before 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 whi...
PublicKeyCredentialRequestOptions - Web APIs
This value will be signed by the authenticator and the signature will be sent back as part of AuthenticatorAssertionResponse.signature. ...
PushEvent - Web APIs
Web › API › PushEvent
The PushEvent interface of the Push API represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. Constructor PushEvent.PushEvent() Creates a new PushEvent object. Properties Inherits properties from its parent, ExtendableEvent. Additional properties: PushEvent.data Read only Returns a reference to a PushMessageData object containing data sent to the PushSubscription. Methods Inherits methods from its parent, ExtendableEvent. Examples The following example takes data from a PushEvent and displays it on all of the service worker's clients. self.addEventListener('push', function(event) { if (!(self.Notification && self.Notification.permission ===...
PushManager.permissionState() - Web APIs
'prompt', 'denied', or 'granted'. 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. 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...
PushManager.registrations() - Web APIs
ethod is used to ask the system about existing push endpoint registrations. Syntax var request = navigator.push.registrations(); Return A DOMRequest object to handle the success or failure of the method call. If the method call is successful, the request's result will be an array of PushRegistration objects. PushRegistration Those objects are anonymous JavaScript objects with the following properties: pushEndpoint A string representing the URL of the endpoint. version The current version that the push endpoint is at. Example var req = navigator.push.registrations(); req.onsuccess = function(e) { if (req.result.length > 0) { for (var i = 0, l = req.result.length; i < l; i++) { console.log("Existing registration", req.result[i].pushEndpoint, req.result[i].version); } ...
PushManager.subscribe() - Web APIs
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 does not have an existing subscription. Syntax PushManager.subscribe(options).then(function(pushSubscription) { ... } ); 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 Base64-encoded DOMString or ArrayBuffer containing an ECDSA P-256 public key that the push server will use to authenticate your application server. If specified, all messages from your application server must use the VAPI...
PushManager - Web APIs
The PushManager interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. This interface is accessed via the ServiceWorkerRegistration.pushManager property. Note: This interface replaces functionality previously offered by the obsolete PushRegistrationManager interface. Properties PushManager.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...
PushMessageData - Web APIs
ve the push data sent by a server in various formats. Unlike the similar methods in the Fetch API, which only allow the method to be invoked once, these methods can be called multiple times. Messages received through the Push API are sent encrypted by push services and then automatically decrypted by browsers before they are made accessible through the methods of the PushMessageData interface. Properties None. Methods PushMessageData.arrayBuffer() Extracts the data as an ArrayBuffer object. PushMessageData.blob() Extracts the data as a Blob object. PushMessageData.json() Extracts the data as a JSON object. PushMessageData.text() Extracts the data as a plain text string. Examples self.addEventListener('push', function(event) { var obj = event.data.json(); if(obj.action === 'sub...
PushSubscription.toJSON() - Web APIs
Syntax mySubscription = subscription.toJSON() Parameters None. Returns A JSON object. It currently only contains the subscription endpoint, as an endpoint member. ...
RTCCertificate - Web APIs
The interface of the the WebRTC API provides an object represents a certificate that an RTCPeerConnection uses to authenticate. Properties RTCCertificate.expires Read only Returns the expiration date of the certificate. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between Browsers Candidate Recommendation Initial definition. ...
RTCConfiguration - Web APIs
ovide configuration options for an RTCPeerConnection. It may be passed into the constructor when instantiating a connection, or used with the RTCPeerConnection.getConfiguration() and 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. I...
RTCDTMFSender - Web APIs
See toneBuffer for details on the format of the tone buffer. Methods RTCDTMFSender.insertDTMF() Given a string describing a set of DTMF codes and, optionally, the duration of and inter-...
RTCDataChannel - Web APIs
ave up to a theoretical maximum of 65,534 data channels (the actual limit may vary from browser to browser). To create a data channel and ask a remote peer to join you, call the RTCPeerConnection's createDataChannel() method. The peer being invited to exchange 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 obje...
RTCDataChannelEvent - Web APIs
stead, the WebRTC layer will generate and deliver them to you at the appropriate time. Just listen for the datachannel event to be received by the RTCPeerConnection and when you receive it, use the RTCDataChannelEvent.channel property to gain access to the data channel which has been opened. ConstructorRTCDataChannelEvent() The RTCDataChannelEvent() constructor creates a new RTCDataChannelEvent.PropertiesAlso inherits properties from: Eventchannel Read only The read-only property RTCDataChannelEvent.channel returns the RTCDataChannel associated with the event.MethodsThis interface has no methods, but inherits methods from: Event Examples In this example, the datachannel event handler is set up to save the data channel reference and set up handlers for the events which need to be monitored. The...
RTCDtlsTransport.state - Web APIs
ert, or calling RTCPeerConnection.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 = se...
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 if the...
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 only I...
RTCErrorEvent - Web APIs
The WebRTC API's RTCErrorEvent interface represents an error sent to a WebRTC object. It's based on the standard Event interface, but adds RTC-specific information describing the error, as shown below. Constructor RTCErrorEvent() Creates and returns a new RTCErrorEvent object. Properties In addition to the standard properties available on the Event interface, RTCErrorEvent also includes the following: error Read only An RTCError object specifying the error which occurred; this object includes the type of error that occurred, information about where the error occurred (such as which line number in the SDP or what SCTP cause code was at issue). Methods No additional methods are provided beyond any found on the parent interface, Event. Description There are other data types used for ...
RTCIceCandidate.port - Web APIs
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(). ...
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. 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 ca...
RTCIceCandidate - Web APIs
ate 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 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; ...
RTCIceCandidateInit.candidate - Web APIs
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. ...
RTCIceCandidateInit - Web APIs
ceCandidateInit dictionary, which contains the information needed to fundamentally describe an RTCIceCandidate. RTCIceCandidateInit is used when using new RTCIceCandidate() to create a new ICE candidate object. It's also used as the return value from the RTCIceCandidate.toJSON() method, and can be passed directly into RTCPeerConnection.addIceCandidate() to add a candidate to the peer connection. Properties candidate Optional The ICE candidate-attribute. If the candidate is an indicator that there are no further candidates (rather than representing a new candidate), this is the empty string (""). The default is the empty string. sdpMid Optional The identification tag of the media stream with which the candidate is associated, or null if there is no associated media stream. The default is null.
RTCIceCandidatePair - Web APIs
The RTCIceCandidatePair dictionary describes a pair of ICE candidates which together comprise a description of a viable connection between two WebRTC endpoints. It is used as the return value from RTCIceTransport.getSelectedCandidatePair() to identify the currently-selected candidate pair identified by the ICE agent. 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. Example In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. var iceTransport = pc.getSenders()[0].transport.iceTransport; var localProto = document.getElementById...
RTCIceCandidatePairStats.transportId - Web APIs
ated statistics contained in the RTCIceCandidatePairStats object. Syntax transportId = rtcIceCandidatePairStats.transportId; Value A DOMString which uniquely identifies the RTCIceTransport object from which the transport-related data was obtained for the statistics contained in this RTCIceCandidatePairStats object. The transport-related statistics come from the RTCTransportStats dictionary's properties. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidatePairStats.transportId' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateStats - Web APIs
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. ...
RTCIceParameters - Web APIs
The RTCIceParameters dictionary 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...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
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 state by calling the transport's getSelectedCandidatePair() method, which returns a RTCIceCandidatePair whose RTCIceCandidatePair.local and RTCIceCandidatePair.global properties specify RTCIceCandidate objects describing the local and remote candidates that are currently being used. Example In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. var iceTransport = pc.getSenders()[0].transport.iceTransport; var localProto = document.getElementById("loc...
RTCIdentityAssertion - Web APIs
The RTCIdentityAssertion interface of the the WebRTC API represents the identity of the a remote peer of the current connection. If no peer has yet been set and verified this interface returns null. Once set it can't be changed. Properties RTCIdentityAssertion.idp Indicates the provider of the identity assertion. RTCIdentityAssertion.name Indicates the name of the identity assertion provider. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between Browsers Candidate Recommendation Initial definition. ...
RTCIdentityEvent - Web APIs
ts an identity assertion generated by an identity provider (idP). This is usually for an RTCPeerConnection. The only event sent with this type is identityresult.. Firefox implements this interface under the following name: RTCPeerConnectionIdentityEvent. It is likely that it will correct this name when it will unprefix RTCPeerConnection, once spec and implementation will have been stabilized. Properties A RTCIdentityEvent being an Event, this event also implements these properties. RTCIdentityEvent.assertion Read only Returns the DOMString containing a blob being the assertion generated. Methods A RTCIdentityEvent being an Event, this event also implements these properties. There is no specific RTCIdentityEvent method. Examples pc.onidentityresult = function( ev ) { ...
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. ...
RTCOfferAnswerOptions - Web APIs
configure and control the process of creating WebRTC offers or answers. It's used as the base type for the options parameter when calling createOffer() or createAnswer() on an RTCPeerConnection. Each of createOffer() and createAnswer() use RTCOfferAnswerOptions 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 BrowsersTh...
RTCPeerConnection.createDataChannel() - Web APIs
), they can be negotiated out of-band, where both sides call createDataChannel with an agreed-upon id. Default: false. id Optional An 16-bit numeric ID for the channel; permitted values are 0-65534. If you don't include this option, the user agent will select an ID for you. The options which can be configured using the RTCDataChannelInit dictionary represent the script-settable subset of the properties on the RTCDataChannel interface. Return value A new RTCDataChannel object with the specified label, configured using the options specified by options if that parameter is included; otherwise, the defaults listed above are established. Exceptions InvalidStateError The RTCPeerConnection is closed. TypeError This can happen in a couple of situations: The label and/or protocol string is...
RTCPeerConnection.getSenders() - Web APIs
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. ...
RTCPeerConnection.getStreamById() - Web APIs
If you have code that uses stream, you will need to update, since browsers have begun to remove support for stream. ...
RTCPeerConnection.onicecandidateerror - Web APIs
ateerror 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 list of codes. TURN adds a few more error codes; see // RFC 5766, section 15 for details. } else if (event.errorCode >= 700 && event.errorC...
RTCPeerConnection.onnegotiationneeded - Web APIs
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 negotiationneeded events to handle creating an offer, configuring the local end of the connection, and sending the offer to the remote peer. pc.onnegotiationneeded = function() { pc.createOffer().then(function(offer) { return pc.setLocalDescription(offer); ...
RTCPeerConnection.setLocalDescription() - Web APIs
The method takes a single parameter--the session description--and it returns a Promise which is fulfilled once the description has been changed, asynchronously. If setLocalDescription() is called while a connection is already in place, it means renegotiation is underway (possibly to adapt to changing network conditions). ...
RTCPeerConnection.setRemoteDescription() - Web APIs
The method takes a single parameter--the session description--and it returns a Promise which is fulfilled once the description has been changed, asynchronously. This is typically called after receiving an offer or answer from another peer over the signaling server. ...
RTCRtcpParameters - Web APIs
This is used, for example, in SDES (SDP security descriptions) messages, described in RFC 4568. This property cannot be changed once initialized. reducedSize A Boolean value indicating whether or not reduced size RTCP is configured. If this value is true, reduced size RTCP (described in RFC 5506) is in effect. If false, compund RTCP is in use, as found in RFC 3550. ...
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. ...
RTCRtpCodecParameters - Web APIs
lling RTCRtpTransceiver.setCodecPreferences() to configure a transceiver's codecs before beginning the offer/answer process to establish a WebRTC peer connection. Most of the fields in this property take values which are defined and maintained by the Internet Assigned Numbers Authority (IANA). References to relevant IANA documents are provided in the see also section at the end of this article. Properties payloadType Optional The RTP payload type used to identify this codec. mimeType Optional The codec's MIME media type and subtype specified as a DOMString of the form "type/subtype". IANA maintains a registry of valid MIME types. clockRate Optional An 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 a...
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. 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 contributi...
RTCRtpEncodingParameters - Web APIs
An instance of the WebRTC API's RTCRtpEncodingParameters dictionary describes a single configuration of a codec for an RTCRtpSender. It's used in the RTCRtpSendParameters describing 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 RTCRtpParamet...
RTCRtpParameters - Web APIs
The RTCRtpParameters dictionary is the basic object describing the parameters of an RTP transport. It is extended separately for senders and receivers in the form of the RTCRtpSendParameters and RTCRtpReceiveParameters dictionaries. To obtain the parameters of a sender or receiver, call its getParameters() method: getParameters() getParameters() Properties codecs An array of RTCRtpCodecParameters objects describing the set of codecs from which the sender or receiver will choose. This parameter cannot be changed once initially set. headerExtensions An array of zero or more RTP header extensions, each identifying an extension supported by the sender or receiver. Header extensions are described in RFC 3550: 5.3.1. This parameter cannot be changed once initially set. rtcp An RTCRtcpParam...
RTCRtpReceiver.getSynchronizationSources() - Web APIs
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 indicates if the last RTP packet received contained voice activity. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'getSynchronizationSources()' in that spe...
RTCRtpSendParameters.encodings - Web APIs
e 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 value is ...
RTCRtpSendParameters - Web APIs
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. ...
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 - Web APIs
The RTCRtpSynchronizationSource dictionary of the the WebRTC API is used by getSynchronizationSources() to describe a particular synchronization source (SSRC). A synchronization source is a single source that shares timing and sequence number space. Since RTCRtpSynchronizationSource implements RTCRtpContributingSource, its properties are also available. The information provided is based on the last ten seconds of media received. While the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts. 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 indicat...
RTCRtpTransceiver - Web APIs
pairing, along with other important state from the media section. Each non-disabled SRTP media section is always represented by exactly one transceiver. A transceiver is uniquely identified using its mid property, which is the same as the media ID (mid) of its corresponding m-line. An RTCRtpTransceiver is associated with an m-line if its mid is non-null; otherwise it's considered disassociated. Properties currentDirection Read only A string from the enum RTCRtpTransceiverDirection which indicates the transceiver's current directionality, or null if the transceiver is stopped or has never participated in an exchange of offers and answers. direction A string from the enum RTCRtpTransceiverDirection which is used to set the transceiver's desired direction. mid Read only The media ID of the ...
RTCRtpTransceiverDirection - Web APIs
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. ...
RTCRtpTransceiverInit - Web APIs
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. ...
RTCSctpTransport - Web APIs
nels are sent and received. You don't create RTCSctpTransport objects yourself; instead, you get access to the 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 DOMSt...
RTCSessionDescription() - Web APIs
The RTCSessionDescription() constructor creates a new RTCSessionDescription with its properties initialized as described 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. 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...
RTCSessionDescription.toJSON() - Web APIs
Syntax var jsonValue = sd.toJSON(); The result value is a JSON object containing the following values: "type", containing the value of the RTCSessionDescription.type property and can be one of the following values: "offer", "answer", "pranswer" or null. "sdp", containing a DOMString, or null, with the SDP message corresponding to RTCSessionDescription.sdp property. Example // sd is a RTCSessionDescriptor alert(JSON.stringify(sd)); // This call the toJSON() method behind the scene. ...
RTCSessionDescriptionCallback - Web APIs
unction type is part of the legacy WebRTC API, you should avoid 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 Communica...
RTCStats - Web APIs
Web › API › RTCStats
Specific classes of statistic are defined as dictionaries based on RTCStats. For example, statistics about a received RTP stream are represented by RTCReceivedRtpStreamStats. Properties id A DOMString which uniquely identifies the object which was inspected to produce this object based on RTCStats. timestamp A DOMHighResTimeStamp object indicating the time at which the sample was taken for this statistics object. ...
RTCStatsReport - Web APIs
() on an RTCPeerConnection lets you specify whether you wish to obtain statistics for outbound, inbound, or all streams on the connection. The RTCRtpReceiver and RTCRtpSender versions of getStats() specifically only return statistics available to the incoming or outgoing stream on which you call them. The statistics objects For each category of statistic information, there is a dictionary whose properties provide the relevant information. Properties common to all statistic categories All WebRTC statistics objects are fundamentally based on the RTCStats dictionary, which provides the most fundamental information: the timestamp, the statistic type string, and an ID uniquely identifying the source of the data: id A DOMString which uniquely identifies the object which was inspected to produce th...
RTCTrackEvent() - Web APIs
d to use this constructor, as RTCTrackEvent objects are created by WebRTC and delivered to your RTCPeerConnector's ontrack event handler as appropriate. Syntax trackEvent = new RTCTrackEvent(eventInfo); Parameters eventInfo An object based on the RTCTrackEventInit dictionary, providing information about the track which has been added to the RTCPeerConnection. 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...
RTCTrackEvent.receiver - Web APIs
The read-only receiver property of the RTCTrackEvent interface indicates the RTCRtpReceiver which is used to receive data containing media for the track to which the event refers. Syntax var rtpReceiver = trackEvent.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 'RTCTrackEvent.receiver' 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. Candida...
RTCTrackEvent - Web APIs
eamTrack is added to an RTCRtpReceiver which is part of the RTCPeerConnection. The target is the RTCPeerConnection object to which the track is being added. This event is sent by the WebRTC layer to the web site or application, so you will not typically need to instantiate an RTCTrackEvent yourself. Constructor RTCTrackEvent() Creates and returns a new RTCTrackEvent object, initialized with properties taken from the specified RTCTrackEventInit dictionary. You will probably not need to create new track events yourself, since they're typically created by the WebRTC infrastructure and sent to the connection's ontrack event handler. Properties Since RTCTrackEvent is based on Event, its properties are also available. receiver Read only The RTCRtpReceiver used by the track that's been added ...
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 specification. ...
RTCTrackEventInit.transceiver - Web APIs
ted 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 WebRTC 1.0: Real-time Communication Between BrowsersThe definition of...
Range - Web APIs
Web › API › Range
The Range interface represents a fragment of a document that can contain nodes and parts of text nodes. A range can be created by using the Document.createRange() method. Range objects can also be retrieved by using the getRangeAt() method of the Selection object or the caretRangeFromPoint() method of the Document object. There also is the Range() constructor available. Properties There are no inherited properties. Range.collapsed Read only Returns a Boolean indicating whether the range's start and end points are at the same position. Range.commonAncestorContainer Read only Returns the deepest Node that contains the startContainer and endContainer nodes. Range.endContainer Read only Returns the Node within which the Range ends. Range.endOffset Read only Returns a number representi...
ReadableByteStreamController - Web APIs
The ReadableByteStreamController interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Byte stream controllers are for byte streams. Constructor None. ReadableByteStreamController instances are created automatically during ReadableStream construction. Properties ReadableByteStreamController.byobRequest Read only Returns the current BYOB pull request. ReadableByteStreamController.desiredSize Read only Returns the desired size required to fill the stream's internal queue. Methods ReadableByteStreamController.close() Closes the associated stream. ReadableByteStreamController.enqueue() Enqueues a given chunk in the associated stream. ReadableByteStreamController.error() Causes any future interactions with the asso...
ReadableStream.ReadableStream() - Web APIs
underlyingSource can contain the following: start(controller) This is a method, called immediately when the object is constructed. ...
ReadableStream.getReader() - Web APIs
has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = value; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); ...
ReadableStream.tee() - Web APIs
// 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 ' ...
ReadableStream - Web APIs
The ReadableStream interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. Constructor ReadableStream() Creates and returns a readable stream object from the given handlers. Properties ReadableStream.locked Read only The locked getter returns whether or not the readable stream is locked to a reader. Methods ReadableStream.cancel() Cancels the stream, signaling a loss of interest in the stream by a consumer. The supplied reason argument will be given to the underlying source, which may or may not use it. ReadableStream.getIterator() Creates a ReadableStream async iterator instance and locks the stream to it. While the stream is locked, no other reader ca...
ReadableStreamBYOBReader - Web APIs
The ReadableStreamBYOBReader interface of the Streams API represents a BYOB ("bring your own buffer") reader that can be used to read stream data supplied by the developer (e.g. a custom ReadableStream() constructor). Constructor ReadableStreamBYOBReader() Creates and returns a ReadableStreamBYOBReader object instance. Properties ReadableStreamBYOBReader.closed Read only Allows you to write code that responds to an end to the streaming process. Returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. Methods ReadableStreamBYOBReader.cancel() Cancels the stream, signaling a loss of interest in the stream by a consumer. The supplied reason argument will be given to the underlying source, which may or may not us...
ReadableStreamBYOBRequest - Web APIs
erface of the Streams API represents a pull request into a ReadableByteStreamController view. A view, as mentioned below, refers to a typed array representing the destination region to which the associated ReadableByteStreamController controller can write generated data. Constructor None. ReadableStreamBYOBRequest instance is created automatically by ReadableByteStreamController as needed. Properties ReadableStreamBYOBRequest.view Read only Returns the current view. Methods ReadableStreamBYOBRequest.respond() xxx ReadableStreamBYOBRequest.respondWithNewView() xxx Examples TBD. Specifications Specification Status Comment StreamsThe definition of 'ReadableStreamBYOBRequest' in that specification. Living Standard Initial definition ...
ReadableStreamDefaultController - Web APIs
The ReadableStreamDefaultController interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams. Constructor None. ReadableStreamDefaultController instances are created automatically during ReadableStream construction. Properties ReadableStreamDefaultController.desiredSize Read only Returns the desired size required to fill the stream's internal queue. Methods ReadableStreamDefaultController.close() Closes the associated stream. ReadableStreamDefaultController.enqueue() Enqueues a given chunk in the associated stream. ReadableStreamDefaultController.error() Causes any future interactions with the associated stream to error. Examples In the following simple...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); ...
ReadableStreamDefaultReader.cancel() - Web APIs
I. 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; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.
ReadableStreamDefaultReader.read() - Web APIs
has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); ...
ReadableStreamDefaultReader - Web APIs
The ReadableStreamDefaultReader interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (e.g. a fetch request). Constructor ReadableStreamDefaultReader() Creates and returns a ReadableStreamDefaultReader object instance. Properties ReadableStreamDefaultReader.closed Read only Allows you to write code that responds to an end to the streaming process. Returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. Methods ReadableStreamDefaultReader.cancel() Cancels the stream, signaling a loss of interest in the stream by a consumer. The supplied reason argument will be given to the underlying source, which may or may not use it. ReadableStreamDefaultReade...
RelativeOrientationSensor - Web APIs
' device sensors through the Permissions API. 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. Constructor RelativeOrientationSensor.RelativeOrientationSensor() Creates a new RelativeOrientationSensor object. Properties No specific properties; inherits methods from its ancestors OrientationSensor and Sensor. Event handlers No specific event handlers; inherits methods from its ancestor, Sensor. Methods No specific methods; inherits methods from its ancestors OrientationSensor and Sensor. Examples Basic Example The following example, which is loosely based on Intel's Orientation Phone demo, instantiates a...
RenderingContext - Web APIs
RenderingContext is a WebIDL typedef which can refer to any one of the interfaces that represent a graphics rendering context within a <canvas> element: CanvasRenderingContext2D, WebGLRenderingContext, or WebGL2RenderingContext. By using the shorthand RenderingContext, methods and properties which can make use of any of these interfaces can be specified and written more easily; since <canvas> supports several rendering systems, it's helpful from a specification and browser implementation perspective to have a shorthand that means "one of these interfaces." As such, RenderingContext is an implementation detail, and isn't something web developers directly use. There is no RenderingContext interface, and there are no objects which implement type RenderingContext. The primary use of this type is the...
Report - Web APIs
Web › API › Report
ethod -- this returns all reports in an observer's report queue, and then empties the queue. Via the reports parameter of the callback function passed into the ReportingObserver() constructor upon creation of a new observer instance. This contains the list of reports currently contained in the observer's report queue. By sending requests to the endpoints defined via the Report-To HTTP header. Properties Report.body Read only The body of the report, which is a ReportBody object containing the detailed report information. Report.type Read only The type of report generated, e.g. deprecation or intervention. Report.url Read only The URL of the document that generated the report. Methods This interface has no methods defined on it. Events This interface has no events that fire on it. ...
ReportingObserverOptions - Web APIs
Available types include deprecation, intervention, and crash. buffered A boolean that defines whether the reports that were generated before the observer was able to be created should be observable (true) or not (false). ...
ResizeObserver - Web APIs
server avoids infinite callback loops and cyclic dependencies that are often created when resizing via a callback function. It does this by only processing elements deeper in the DOM in subsequent frames. Implementations should, if they follow the specification, invoke resize events before paint and after layout. Constructor ResizeObserver() Creates and returns a new ResizeObserver object. Properties None. Methods ResizeObserver.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 para...
ResizeObserverEntry.borderBoxSize - Web APIs
n array containing the new border box size of the observed element when the callback is run. Syntax var myBorderBoxSize = ResizeObserverEntry.borderBoxSize; Value An array containing objects with the new border box size of the observed element. The array is necessary to support elements that have multiple fragments, which occur in multi-column scenarios. Each object in the array contains two properties: blockSize The length of the observed element's border box in the block dimension. For boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlineSize The length of the observed element's border box in the inline dimension. For boxes with a horizontal writing-mode, this is the horizontal...
ResizeObserverEntry.contentBoxSize - Web APIs
The contentBoxSize read-only property of the ResizeObserverEntry interface returns an array containing the new content box size of the observed element when the callback is run. Syntax var myContentBoxSize = ResizeObserverEntry.contentBoxSize; Value An object containing the new content box size of the observed element. This object contains two properties: blockSize The length of the observed element's content box in the block dimension. For boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlineSize The length of the observed element's content box in the inline dimension. For boxes with a horizontal writing-mode, this is the horizontal dimension, or width; if the writing...
RsaHashedImportParams - Web APIs
This should be set to RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP, depending on the algorithm you want to use. ...
RsaHashedKeyGenParams - Web APIs
This should be set to RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP, depending on the algorithm you want to use. modulusLength A Number. The length in bits of the RSA modulus. ...
RsaOaepParams - Web APIs
This should be set to RSA-OAEP. label Optional A BufferSource -- an array of bytes that does not itself need to be encrypted but which should be bound to the ciphertext. A digest of the label is part of the input to the encryption operation. ...
RsaPssParams - Web APIs
This should be set to RSA-PSS. saltLength A long integer representing the length of the random salt to use, in bytes. RFC 3447 says that "Typical salt lengths" are either 0 or the length of the output of the digest algorithm that was selected when this key was generated. For example, if you use SHA-256 as the digest algorithm, this could be 32. ...
SVGAElement - Web APIs
SVGAElement.download See HTMLAnchorElement.download. SVGAElement.href See HTMLAnchorElement.href. SVGAElement.hreflang Is a DOMString that reflects the hreflang attribute, indicating the language of the linked resource. SVGAElement.ping Is a DOMString that reflects the ping attribute, containing 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). ...
SVGAltGlyphDefElement - Web APIs
"210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="106" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGAltGlyphDefElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Warning: This interface was removed in the SVG 2 specification. Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. 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) 1.1 (Second Edition)The definition of 'SVGAltGlyphD...
SVGAltGlyphElement - Web APIs
interface represents an <altglyph> element. This interface makes it possible to implement more sophisticated and particular glyph characters. For some textal representations as: ligatures (e.g. ae, ss, etc ), special-purpose fonts (e.g. musical symbols) or even alternate glyphs such as Asian text strings it is required that a different set of glyphs be used than the normal given character data. Properties This interface also inherits properties from its parent interface, SVGGraphicsElement. SVGAltGlyphElement.glyphRef It corresponds to the attribute glyphRef on the given element. It's data type is 'String'. It defines the glyph identifier, whose format is dependent on the 'format' of the given font. SVGAltGlyphElement.format It corresponds to the attribute format on the given element. It's...
SVGAltGlyphItemElement - Web APIs
220" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGAltGlyphItemElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Warning: This interface was removed in the SVG 2 specification. Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. 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) 1.1 (Second Edition)The definition of 'SVGAltGlyphI...
SVGAngle - Web APIs
Web › API › SVGAngle
le), Be detached, which is the case for SVGAngle objects created with SVGSVGElement.createSVGAngle(). Constants SVG_ANGLETYPE_UNKNOWN Some unknown type of value. SVG_ANGLETYPE_UNSPECIFIED A unitless <number> interpreted as a value in degrees. SVG_ANGLETYPE_DEG An <angle> with a deg unit. SVG_ANGLETYPE_RAD An <angle> with a rad unit. SVG_ANGLETYPE_GRAD An <angle> with a grad unit. Properties unitType The type of the value as specified by one of the SVG_ANGLETYPE_* constants defined on this interface. value The value as a floating point value, in user units. Setting this attribute will 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 th...
SVGAnimatedAngle - Web APIs
SVG animated angle interface The SVGAnimatedAngle interface 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...
SVGAnimatedBoolean - Web APIs
SVG animated boolean interface The SVGAnimatedBoolean interface 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 SVGAnimatedBoolea...
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 animate...
SVGAnimatedInteger - Web APIs
SVG animated integer interface The SVGAnimatedInteger 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 in...
SVGAnimatedLength - Web APIs
SVG animated length interface The SVGAnimatedLength interface is used 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 SVGA...
SVGAnimatedLengthList - Web APIs
SVG animated length list interface The SVGAnimatedLengthList interface is used for attributes 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 refe...
SVGAnimatedNumber - Web APIs
SVG animated number interface The SVGAnimatedNumber 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 d...
SVGAnimatedNumberList - Web APIs
SVG animated number list interface The SVGAnimatedNumber interface is used for attributes which take a list of numbers and which can be animated. Interface overview Also implement None Methods None Properties readonly 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 bas...
SVGAnimatedPoints - Web APIs
nts attribute which holds a list of coordinate values and which support the ability to animate that attribute. 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. Interface overview Also implement None Methods None Properties readonly SVGPointList points readonly SVGPointList animatedPoints Normative document 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 animat...
SVGAnimatedPreserveAspectRatio - Web APIs
SVG animated preserveAspectRatio interface The SVGAnimatedPreserveAspectRatio interface is used for attributes of 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 SVGPreserveAspectRat...
SVGAnimatedString - Web APIs
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. ...
SVGAnimatedTransformList - Web APIs
SVG animated transform list interface The SVGAnimatedTransformList interface is used for attributes which take a list of numbers and which can be animated. Interface overview Also implement None Methods None Properties readonly 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 c...
SVGColorProfileElement - Web APIs
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. ...
SVGComponentTransferFunctionElement - Web APIs
NTITY 1 Corresponds to the value identity. SVG_FECOMPONENTTRANSFER_TYPE_TABLE 2 Corresponds to the value table. SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE 3 Corresponds to the value discrete. SVG_FECOMPONENTTRANSFER_TYPE_LINEAR 4 Corresponds to the value linear. SVG_FECOMPONENTTRANSFER_TYPE_GAMMA 5 Corresponds to the value gamma. Properties This interface also inherits properties from its parent interface, SVGElement. SVGComponentTransferFunctionElement.type Read only An SVGAnimatedEnumeration corresponding to the type attribute of the given element. It takes one of the SVG_FECOMPONENTTRANSFER_TYPE_* constants defined on this interface. SVGComponentTransferFunctionElement.tableValues Read only An SVGAnimatedNumberList corre...
SVGEvent - Web APIs
Web › API › SVGEvent
type Read only DOMString The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. ...
SVGExternalResourcesRequired - Web APIs
eight="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="141" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGExternalResourcesRequired</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Warning: This interface was removed in the SVG 2 specification. Properties SVGExternalResourcesRequired.externalResourcesRequired Corresponds to the externalResourcesRequired attribute of the given element. Note: The SVG DOM defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the SVG language definition says that the attribute is not animated. Because the SVG language definition states that externalResourcesRequired canno...
SVGFEBlendElement - Web APIs
ue 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_LIGHTEN 5 Corresponds to the value lighten. 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. SVGFEBlendElement.in2 Read only An SVGAnimatedString corresponding to the in2 attribute of the given element. SVGFEBlendElement.mode R...
SVGFEColorMatrixElement - Web APIs
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 luminanceToAlpha value. 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. SVGFEColorMatrixElement.type Read only An SVGAnimatedEnumeration corresponding to the type attribute of the given element. ...
SVGFECompositeElement - Web APIs
he 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_OPERATOR_XOR 5 Corresponds to xor value. SVG_FECOMPOSITE_OPERATOR_ARITHMETIC 6 Corresponds to arithmetic value. 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. SVGFECompositeElement.type Read only An SVGAnimatedEnumeration corresponding to the type attribute of the given element. It ta...
SVGFEConvolveMatrixElement - Web APIs
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 properties of SVGFilterPrimitiveStandardAttributes. SVGFEConvolveMatrixElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEConvolveMatrixElement.orderX Read only An SVGAnimatedInteger corresponding to the order attribute of the given eleme...
SVGFEDisplacementMapElement - Web APIs
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, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. SVGFEDisplacementMapElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEDisplacementMapElement.in2 Read only An SVGAnimatedString corresponding to the in2 attribute of the given element. ...
SVGFEGaussianBlurElement - Web APIs
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 properties of SVGFilterPrimitiveStandardAttributes. SVGFEGaussianBlurElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEGaussianBlurElement.stdDeviationX Read only An SVGAnimatedNumber corresponding to the (possibly automatically computed...
SVGFEMorphologyElement - Web APIs
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. SVGFEMorphologyElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. SVGFEMorphologyElement.operator Read only An SVGAnimatedEnumeration corresponding to the operator attribute of the given elem...
SVGFETurbulenceElement - Web APIs
itch 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. SVGFETurbulenceElement.baseFrequencyX Read only An SVGAnimatedNumber corresponding to the X component of the baseFrequency attribute of the given element. SVGFETurbulenceElement.baseFrequencyY Read only An SVGAnimatedNumber corresponding t...
SVGFilterPrimitiveStandardAttributes - Web APIs
SVGFilterPrimitiveStandardAttributes.y Read only An SVGAnimatedLength corresponding to the y attribute of the given element. SVGFilterPrimitiveStandardAttributes.width Read only An SVGAnimatedLength corresponding to the width attribute of the given element. SVGF...
SVGGeometryElement - Web APIs
mily="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGGeometryElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Note: The pathLength property and the getTotalLength() and getPointAtLength() methods were originally part of the SVGPathElement interface. In SVG 2 they were moved to this interface. Properties This 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...
SVGGlyphElement - Web APIs
width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="76" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGGlyphElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Warning: This interface was removed in the SVG 2 specification. Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. 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) 1.1 (Second Edition)The definition of 'SVGGlyphElem...
SVGGradientElement - Web APIs
_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 SVGURIReference. SVGGradientElement.gradientUnits Read only Returns an SVGAnimatedEnumeration corresponding to the gradientUnits attribute on the given element. Takes one of the constants defined in SVGUnitTypes. SVGGradientElement.gradientTransform Read only Returns an SVGAnimatedTransformList c...
SVGGraphicsElement - Web APIs
ke-width="2px" /><text x="391" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGGraphicsElement</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 represent...
SVGMatrix - Web APIs
Web › API › SVGMatrix
f the form: [a c e] [b d f] which, when expanded into a 3x3 matrix for the purposes of matrix arithmetic, become: [a c e] [b d f] [0 0 1] An SVGMatrix object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. Warning: SVG 2 replaced the SVGMatrix interface by the more general DOMMatrix and DOMMatrixReadOnly interfaces. Properties SVGMatrix.a A float representing the a component of the matrix. SVGMatrix.b A float representing the b component of the matrix. SVGMatrix.c A float representing the c component of the matrix. SVGMatrix.d A float representing the d component of the matrix. SVGMatrix.e A float representing the e component of the matrix. SVGMatrix.f A float representing the f component of the matrix. ...
SVGNumber - Web APIs
Web › API › SVGNumber
Note: If the SVGNumber is read-only, a DOMException with the code NO_MODIFICATION_ALLOWED_ERR is raised on an attempt to change the value. Methods This interface doesn't provide any specific methods. ...
SVGPathElement - Web APIs
s,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGPathElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Note: In SVG 2 the getPathSegAtLength() and createSVGPathSeg* methods were removed and the pathLength property and the getTotalLength() and getPointAtLength() methods were moved to SVGGeometryElement. Properties This interface also inherits properties from its parent, SVGGeometryElement. SVGPathElement.pathLength An 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, SVGGeometry...
SVGPathSegList - Web APIs
ewItem) SVGPathSeg getItem(in unsigned long index) SVGPathSeg insertItemBefore(in SVGPathSeg newItem, in unsigned long index) SVGPathSeg replaceItem(in SVGPathSeg newItem, in unsigned long index) SVGPathSeg removeItem(in unsigned long index) SVGPathSeg appendItem(in SVGPathSeg newItem) Properties readonly unsigned long numberOfItems Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItemsRead only unsigned long ...
SVGPointList - Web APIs
VGPoint initialize(in SVGPoint newItem) SVGPoint getItem(in unsigned long index) SVGPoint insertItemBefore(in SVGPoint newItem, in unsigned long index) SVGPoint replaceItem(in SVGPoint newItem, in unsigned long index) SVGPoint removeItem(in unsigned long index) SVGPoint appendItem(in SVGPoint newItem) Properties readonly unsigned long numberOfItems Normative document SVG 1.1 (2nd Edition) Properties Name Type Description numberOfItems unsigned long The number of items in the lis...
SVGRenderingIntent - Web APIs
s to the value auto. RENDERING_INTENT_PERCEPTUAL 2 Corresponds to the value perceptual. RENDERING_INTENT_RELATIVE_COLORIMETRIC 3 Corresponds to the value relative-colorimetric. RENDERING_INTENT_SATURATION 4 Corresponds to the value saturation. RENDERING_INTENT_ABSOLUTE_COLORIMETRIC 5 Corresponds to the value absolute-colorimetric. Properties This interface doesn't implement any specific properties. Methods This interface doesn't implement any specific methods. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGRenderingIntent' in that specification. Recommendation Initial definition ...
SVGScriptElement - Web APIs
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 doe...
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 D...
SVGTests - Web APIs
Web › API › SVGTests
SVGTests.requiredExtensions Read only An SVGStringList corresponding to the requiredExtensions attribute of the given element. SVGTests.systemLanguage Read only An SVGStringList corresponding to the systemLanguage attribute of the given element. ...
SVGTextPathElement - Web APIs
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. SVGTextPathElement.startOffset Read only An SVGAnimatedLength corresponding to the X component of the startOffset attribute of the given element. SVGTextPathElement.method Read only An SVGAnimatedEnumeration corresponding to the method attribute of ...
SVGTransformable - Web APIs
Interface overview Also implement None Methods None Properties readonly SVGAnimatedTransformList transform Normative document SVG 1.1 (2nd Edition) Properties Name Type Description transform SVGAnimatedTransformList Corresponds to attribute transform on the given element. Methods The SVGTransformable interface do not provide any specific methods. Browser compatibility The compatibility table on this page is generated from structured data. ...
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 depre...
SVGUnitTypes - Web APIs
e 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. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGUnitTypes' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition o...
SVGViewElement - Web APIs
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. ...
SVGZoomAndPan - Web APIs
onstants 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. ...
ScreenOrientation - Web APIs
ScreenOrientation.angleRead only Returns the document's current orientation angle. Event handlers ScreenOrientation.onchange The EventHandler called whenever the screen changes orientation. Methods ScreenOrientation.lock() Locks the orientation of the containing document to its default orientation and returns a Promise. ...
Screen Capture API - Web APIs
evices interface. MediaDevices interface MediaDevices.getDisplayMedia() The getDisplayMedia() method is added to the MediaDevices interface. Similar to getUserMedia(), this method creates a promise that resolves with a MediaStream containing the display area selected by the user, in a format that matches the specified options. Additions to existing dictionaries The Screen Capture API adds properties to the following dictionaries defined by other specifications. 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 indi...
ScriptProcessorNode - Web APIs
mber may be necessary to avoid audio breakup and glitches. If the buffer size is not defined, which is recommended, the browser will pick one that its heuristic deems appropriate. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Properties Inherits properties from its parent, AudioNode. ScriptProcessorNode.bufferSize Read only Returns an integer representing both the input and output buffer size. Its value can be a 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 th...
ScrollToOptions.behavior - Web APIs
ary, which is implemented by ScrollToOptions. Syntax behavior: ScrollBehavior Value An enum, the value of which can be one of the following: smooth: The scrolling animates smoothly. auto: The scrolling happens in a single jump. Examples In our scrolltooptions example (see it live) we include a form that allows the user to enter three values -- two numbers representing the left and top properties (i.e. the positions to scroll to along the X and Y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. When the form is submitted, an event handler is run that puts the entered values into a ScrollToOptions dictionary, and then invokes the Window.ScrollTo() method, passing the dictionary as a parameter: form.addEventListener('submit', (e) => { e.preventDefault(...
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. 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:...
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. 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: t...
SecurityPolicyViolationEvent - Web APIs
The SecurityPolicyViolationEvent interface inherits from Event, and represents the event object of an event sent on a document or worker when its content security policy is violated. Constructor SecurityPolicyViolationEvent() Creates a new SecurityPolicyViolationEvent object instance. Properties SecurityPolicyViolationEvent.blockedURIRead only A USVString representing the URI of the resource that was blocked because it violates a policy. SecurityPolicyViolationEvent.columnNumberRead only The column number in the document or worker at which the violation occurred. SecurityPolicyViolationEvent.dispositionRead only Indicates how the violated policy is configured to be treated by the user agent. This will be "enforce" or "report". SecurityPolicyViolationEvent.documentURIRead only ...
Selection.removeAllRanges() - Web APIs
Syntax sel.removeAllRanges(); Parameters None. Specifications Specification Status Comment Selection APIThe definition of 'Selection.removeAllRanges()' 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 a pull request. ...
Selection - Web APIs
Web › API › Selection
here the user ends the selection. If you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button, and the focus is placed where you released the mouse button. Anchor and focus should not be confused with the start and end positions of a selection. The anchor can be placed before the focus or vice-versa, depending on the direction you made your selection. Properties Selection.anchorNodeRead only Returns the Node in which the selection begins. Can return null if selection never existed in the document (e.g., an iframe that was never clicked on). Selection.anchorOffsetRead only Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of characters within anchorNode preced...
SensorErrorEvent - Web APIs
The SensorErrorEvent interface of the Sensor APIs provides information about errors thrown by a Sensor or related interface. Constructor SensorErrorEvent.SensorErrorEvent() Creates a new SensorErrorEvent object. Properties SensorErrorEvent.error Read only Returns the DOMException object passed in the event's contructor. Specifications Specification Status Comment Generic Sensor APIThe definition of 'SensorErrorEvent' in that specification. Candidate Recommendation Initial definition. ...
ServiceWorker - Web APIs
this is a service worker that has been activated and is controlling the page (the service worker has been successfully registered, and the controlled page has been reloaded.) The ServiceWorker interface is dispatched a set of lifecycle events -- install and activate -- and functional events including fetch. A ServiceWorker object has an associated ServiceWorker.state, related to its lifecycle. Properties 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 v...
ServiceWorkerContainer - Web APIs
in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. Most importantly, it exposes the ServiceWorkerContainer.register() method used to register service workers, and the ServiceWorkerContainer.controller property used to determine whether or not the current page is actively controlled. Properties ServiceWorkerContainer.controller Read only Returns a ServiceWorker object if its state is activated (the same object returned by ServiceWorkerRegistration.active). This property returns null during a force-refresh request (Shift + refresh) or if there is no active worker. ServiceWorkerContainer.ready Read only Provides a way of delaying code execution until a service worker is active.
ServiceWorkerMessageEvent - Web APIs
ault message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. This interface inherits from the Event interface. Constructor ServiceWorkerMessageEvent.ServiceWorkerMessageEvent() Creates a new ServiceWorkerMessageEvent object instance. Properties Inherits properties from its parent, Event. ServiceWorkerMessageEvent.data Read only Returns the event's data. It can be any data type. ServiceWorkerMessageEvent.origin Read only Returns the origin of the service worker's environment settings object. ServiceWorkerMessageEvent.lastEventId Read only Represents, in server-sent events, the last event ID of the event source. Service...
ServiceWorkerRegistration.showNotification() - Web APIs
n() method of the ServiceWorkerRegistration interface creates a notification on an active service worker. Note: This feature is available in Web Workers. Syntax 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. ...
Service Worker API - Web APIs
ace represents a sync action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. SyncManager Provides an interface for registering and listing sync registrations. WindowClient Represents the scope of a service worker client that is a document in a browser context, controlled by an active worker. This is a special type of Client object, with some additional methods and properties available. Specifications Specification Status Comment Service Workers Working Draft Initial definition. ...
SharedWorker() - Web APIs
ar myWorker = new SharedWorker(aURL, options); Parameters aURL A DOMString representing the URL of the script the worker will execute. It must obey the same-origin 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 cla...
SharedWorker - Web APIs
s. They implement an interface different than dedicated workers and have a different global scope, SharedWorkerGlobalScope. Note: If SharedWorker can be accessed from several browsing contexts, all those browsing contexts must share the exact same origin (same protocol, host and port). Constructors SharedWorker() Creates a shared web worker that executes the script at the specified URL. Properties Inherits properties from its parent, EventTarget, and implements properties from AbstractWorker. AbstractWorker.onerror Is an EventListener that is called whenever an ErrorEvent of type error bubbles through the worker. SharedWorker.port Read only Returns a MessagePort object used to communicate with and control the shared worker. Methods Inherits methods from its parent, EventTarge...
Slottable - Web APIs
Web › API › Slottable
Methods None. Specifications Specification Status Comment DOMThe definition of 'Slottable' in that specification. Living Standard Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
SourceBuffer - Web APIs
SourceBuffer.appendWindowStart Controls the timestamp for the start of the append window. This is a timestamp range that can be used to filter what media data is appended to the SourceBuffer. Coded media frames with timestamps within this range will be appended, whereas those outside the range will be filt...
SourceBufferList - Web APIs
Event handlers SourceBufferList.onaddsourcebuffer The event handler for the addsourcebuffer event. SourceBufferList.onremovesourcebuffer The event handler for the removesourcebuffer event. Methods Inherits methods from its parent interface, EventTarget. SourceBufferList: indexed property g...
SpeechGrammar - Web APIs
The SpeechGrammar interface of the Web Speech API represents a set of words or patterns of words that we want the recognition service to recognize. Grammar is defined using JSpeech Grammar Format (JSGF.) Other formats may also be supported in the future. Constructor SpeechGrammar.SpeechGrammar() Creates a new SpeechGrammar object. Properties SpeechGrammar.src Sets and returns a string containing the grammar from within in the SpeechGrammar object instance. SpeechGrammar.weight Optional Sets and returns the weight of the SpeechGrammar object. 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 |...
SpeechGrammarList - Web APIs
The SpeechGrammarList interface of the Web Speech API represents a list of SpeechGrammar objects containing words or patterns of words that we want the recognition service to recognize. Grammar is defined using JSpeech Grammar Format (JSGF.) Other formats may also be supported in the future. Constructor SpeechGrammarList.SpeechGrammarList() Creates a new SpeechGrammarList object. Properties SpeechGrammarList.length Read only Returns the number of SpeechGrammar objects contained in the SpeechGrammarList. Methods SpeechGrammarList.item() Standard getter -- allows individual SpeechGrammar objects to be retrieved from the SpeechGrammarList using array syntax. SpeechGrammarList.addFromURI() Takes a grammar present at a specific URI and adds it to the SpeechGrammarList as a new Spe...
SpeechRecognition - Web APIs
service; this also handles the SpeechRecognitionEvent sent from the recognition service. Note: On some browsers, like Chrome, using Speech Recognition on a web page involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline. Constructor SpeechRecognition.SpeechRecognition() Creates a new SpeechRecognition object. Properties SpeechRecognition 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 attri...
SpeechRecognitionAlternative - Web APIs
SpeechRecognitionAlternative.confidence Read only Returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognitionErrorEvent - Web APIs
SpeechRecognitionErrorEvent.error Read only Returns the type of error raised. SpeechRecognitionErrorEvent.message Read only Returns a message describing the error in more detail. ...
SpeechRecognitionResult - Web APIs
The SpeechRecognitionResult interface of the Web Speech API represents a single recognition match, which may contain multiple SpeechRecognitionAlternative objects. Properties SpeechRecognitionResult.isFinal Read only A Boolean that states whether this result is final (true) or not (false) -- if so, then this is the final time this result will be returned; if not, then this result is an interim result, and may be updated later on. SpeechRecognitionResult.length Read only Returns the length of the "array" -- the number of SpeechRecognitionAlternative objects contained in the result (also referred to as "n-best alternatives".) Methods SpeechRecognitionResult.item A standard getter that allows SpeechRecognitionAlternative objects within the result to be accessed via array syntax. Exa...
SpeechRecognitionResultList - Web APIs
Methods SpeechRecognitionResultList.item A standard getter that allows SpeechRecognitionResult objects in the list to be accessed via array syntax. Examples This code is excerpted from our Speech color changer example. ...
SpeechSynthesisUtterance - Web APIs
The SpeechSynthesisUtterance interface of the Web Speech API represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) Constructor SpeechSynthesisUtterance.SpeechSynthesisUtterance() Returns a new SpeechSynthesisUtterance object instance. Properties SpeechSynthesisUtterance also inherits properties from its parent interface, EventTarget. SpeechSynthesisUtterance.lang Gets and sets the language of the utterance. SpeechSynthesisUtterance.pitch Gets and sets the pitch at which the utterance will be spoken at. SpeechSynthesisUtterance.rate Gets and sets the speed at which the utterance will be spoken at. SpeechSynthesisUtterance.text Gets and sets the text that will be synthesised when ...
SpeechSynthesisVoice - Web APIs
The SpeechSynthesisVoice interface of the Web Speech API represents a voice that the system supports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. Properties SpeechSynthesisVoice.default Read only A Boolean indicating whether the voice is the default voice for the current app language (true), or not (false.) SpeechSynthesisVoice.lang Read only Returns a BCP 47 language tag indicating the language of the voice. SpeechSynthesisVoice.localService Read only A Boolean indicating whether the voice is supplied by a local speech synthesizer service (true), or a remote speech synthesizer service (false.) SpeechSynthesisVoice.name Read only Returns a human-readable name that represents the voice. SpeechSynthesisVoice.voic...
StereoPannerNode - Web APIs
interface was introduced as a much simpler way to apply a simple panning effect than having to use a full PannerNode. Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 2 Channel interpretation "speakers" Constructor StereoPannerNode() Creates a new instance of a StereoPannerNode object. Properties Inherits properties from its parent, AudioNode. StereoPannerNode.pan Read only Is an a-rate AudioParam representing the 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 ...
Storage - Web APIs
Web › API › Storage
The Storage interface of the Web Storage API provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. To manipulate, for instance, the session storage for a domain, a call to Window.sessionStorage is made; whereas for local storage the call is made to Window.localStorage. Properties Storage.length Read only Returns an integer representing the number of data items stored in the Storage object. Methods Storage.key() When passed a number n, this method will return the name of the nth key in the storage. Storage.getItem() When passed a key name, will return that key's value. Storage.setItem() When passed a key name and value, will add that key to the storage, or update that key's value if...
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"> </output>% of your a...
StorageEstimate - Web APIs
imates 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. usage Secure context A numeric value in bytes approximating the amount of storage space curr...
StorageQuota - Web APIs
Methods StorageQuota.queryInfo Returns a StorageInfo object containting the current data usage and available quota information for the application. ...
Storage Access API - Web APIs
eshold number of sites. See Document.requestStorageAccess() for more details. Safari implementation differences Although the API surface is the same, websites using the Storage Access API should expect differences in the level and extent of storage access they receive between Firefox and Safari. This is caused by differences in the storage access policies implemented in the two browsers. Design properties unique to Firefox are summarized here: If the embedded origin tracker.example has already obtained first-party storage access on the top-level origin foo.example, and the user visits a page from foo.example embedding a page from tracker.example again in less than 30 days, the embedded origin will have storage access immediately when loading. If a page from top-level origin foo.example embeds ...
Using readable streams - Web APIs
is true and then ending the process if so, and reading the next chunk and processing it if not, before running the read() method again. function readStream() { const reader = stream.getReader(); let charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Read ' + charsReceive...
StylePropertyMapReadOnly.entries() - Web APIs
Syntax StylePropertyMapReadOnly.entries() Parameters None. ...
StyleSheet - Web APIs
StyleSheet.href Read only Returns a DOMString representing the location of the stylesheet. StyleSheet.media Read only Returns a MediaList representing the intended destination medium for style information. StyleSheet.ownerNode Read only Returns a Node associating this style sheet with the current document. ...
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 form th...
SubmitEvent - Web APIs
The SubmitEvent interface defines the object used to represent an HTML form's submit event. This event is fired at the <form> when the form's submit action is invoked. Constructor SubmitEvent() Creates and returns a new SubmitEvent object whose type and other options are configured as specified. Note that currently, the only valid type for a SubmitEvent is submit. Properties In addition to the properties listed below, this interface inherits the properties of its parent interface, Event. submitter Read only An HTMLElement object which identifies the button or other element which was invoked to trigger the form being submitted. Methods While SubmitEvent offers no methods of its own, it inherits any specified by its parent interface, Event. Examples In this example, a shopping cart ...
SubtleCrypto.deriveKey() - Web APIs
It returns a Promise which will be fulfilled with a CryptoKey object representing the new key. It's worth noting that the three key derivation algorithms you can use have quite different characteristics and are appropriate in quite different situations. See Supported algorithms for some more detail on this. ...
SubtleCrypto - Web APIs
e basic cryptographic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts. Errors in security system design and implementation can make the security of the system completely ineffective. If you're not sure you know what you are doing, you probably shouldn't be using this API. Properties This interface doesn't inherit any properties, as it has no parent interface. Methods This interface doesn't inherit any methods, as it has no parent interface. SubtleCrypto.encrypt() Returns a Promise that fufills with the encrypted data corresponding to the clear text, algorithm, and key given as parameters. SubtleCrypto.decrypt() Returns a Promise that fulfills with the clear data cor...
SyncManager - Web APIs
Methods SyncManager.register Create a new sync registration and return a Promise. SyncManager.getTags Return a list of developer-defined identifiers for SyncManager registration. ...
TaskAttributionTiming - Web APIs
TaskAttributionTiming.containerSrc Read only Returns the container's src attribute. TaskAttributionTiming.containerId Read only Returns the container's id attribute. TaskAttributionTiming.containerName Read only Returns the container's name attribute. Specifications ...
TextDecoder - Web APIs
is appropriate for Cyrillic script. let win1251decoder = new TextDecoder('windows-1251'); let bytes = new Uint8Array([207, 240, 232, 226, 229, 242, 44, 32, 236, 232, 240, 33]); console.log(win1251decoder.decode(bytes)); // ??????, ???! Constructor TextDecoder() Returns a newly constructed TextDecoder that will generate a code point stream with the decoding method specified in parameters. Properties The TextDecoder interface doesn't inherit any properties. TextDecoder.prototype.encodingRead only Is a DOMString containing the name of the decoder, that is a string describing the method the TextDecoder will use. TextDecoder.prototype.fatalRead only Is a Boolean indicating whether the error mode is fatal. TextDecoder.prototype.ignoreBOMRead only Is a Boolean indicating whether the by...
TextEncoder - Web APIs
oints as input and emits a stream of UTF-8 bytes. Note: There is a polyfill implementation to support non-UTF-8 text encodings on GitHub. Example const encoder = new TextEncoder() const view = encoder.encode('EUR') console.log(view); // Uint8Array(3) [226, 130, 172] Constructor TextEncoder() Returns a newly constructed TextEncoder that will generate a byte stream with UTF-8 encoding. Properties The TextEncoder interface doesn't inherit any property. TextEncoder.prototype.encodingRead only Always returns "utf-8". Methods The TextEncoder interface doesn't inherit any method. TextEncoder.prototype.encode() Takes a USVString as input, and returns a Uint8Array containing UTF-8 encoded text. TextEncoder.prototype.encodeInto() Takes a USVString to encode and a destination Uint8A...
TextMetrics - Web APIs
It takes into account the current font of the context. TextMetrics.actualBoundingBoxLeft Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. ...
TextRange - Web APIs
Web › API › TextRange
specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical TextRange. It is implemented in IE, then a TextRange object can be created by Element.createTextRange() or Document.selection.createRange(). Note that this interface is not supported in non IE browsers. Alternative Selection and Range interfaces can be used. Properties TextRange.boundingHeightRead only Returns the height of the rectangle bound to the TextRange object. TextRange.boundingLeftRead only Returns the distance between the left edge of the rectangle that binds the TextRange object and the left edge that completely contains the TextRange object. TextRange.boundingTopRead only Returns the distance between the top edge of the rectangle that...
TextTrack - Web APIs
Web › API › TextTrack
TextTrack.activeCues Read only A TextTrackCueList object listing the currently active set of text track cues. Track cues are active 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. ...
TextTrackCue - Web APIs
the various derived cue types, such as VTTCue; you will instead work with those derived types. These cues represent a string of text that is presented for some duration of time during the performance of a TextTrack. The cue includes the start time (the time at which the text will be displayed) and the end time (the time at which it will be removed from the display), as well as other information. Properties This interface also inherits properties from EventTarget. TextTrackCue.track Read only The TextTrack that this cue belongs to, or null if it doesn't belong to any. TextTrackCue.id A DOMString that identifies the cue. TextTrackCue.startTime A double that represents the video time that the cue will start being displayed, in seconds. TextTrackCue.endTime A double that represents the vide...
TextTrackList - Web APIs
The TextTrackList interface is used to represent a list of the text tracks defined by the <track> element, with each track represented by a separate textTrack object in the list. Retrieve an instance of this object with HTMLMediaElement.textTracks. The individual tracks can be accessed using array syntax or functions such as forEach() for example. Properties This interface also inherits properties from its parent interface, EventTarget. length Read only The number of tracks in the list. Event handlers onaddtrack An event handler to be called when the addtrack event is fired, indicating that a new text track has been added to the media element. onchange An event handler to be called when the change event occurs. onremovetrack An event handler to call when the removetrack event is s...
TimeEvent - Web APIs
Web › API › TimeEvent
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...
TimeRanges - Web APIs
ore ranges of time, each specified by a starting and ending time offset. You reference each time range by using the start() and end() methods, passing the index number of the time range you want to retrieve. The term "normalized TimeRanges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). Properties TimeRanges.length Read only Returns an unsigned long representing the number of time ranges represented by the time range object. Methods TimeRanges.start() Returns the time for the start of the range with the specified index. TimeRanges.end() Returns the time for the end of the specified range. Specifications Specification Status Comment HTML Living St...
Touch.clientX - Web APIs
Web › API › Touch › clientX
The Touch.clientX read-only property returns the X coordinate of the touch point relative to the viewport, not including any scroll offset. Syntax touchItem.clientX; Return value A long representing the X coordinate of the touch point relative to the viewport, not including any scroll offset. 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. The Touch.clientY property is the vertical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . In this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the el...
Touch.clientY - Web APIs
Web › API › Touch › clientY
uch.clientY read-only property returns the Y coordinate of the touch point relative to the browser's viewport, not including any scroll offset. Syntax touchItem.clientY; Return value A long value representing the Y coordinate of the touch point relative to the viewport, not including any scroll offset. 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. The Touch.clientY property is the vertical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . In this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out ...
Touch.pageX - Web APIs
Web › API › Touch › pageX
The Touch.pageX read-only property returns the X coordinate of the touch point relative to the viewport, including any scroll offset. Syntax touchItem.pageX; Return value A long representing the X coordinate of the touch point relative to the viewport, including any scroll offset. 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. The Touch.pageY property is the vertical coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the touch poi...
Touch.pageY - Web APIs
Web › API › Touch › pageY
The Touch.pageY read-only property returns the Y coordinate of the touch point relative to the viewport, including any scroll offset. Syntax touchItem.pageY; Return value A long value that representes the Y coordinate of the touch point relative to the viewport, including any scroll offset. 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. The Touch.pageY property is the vertical coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the...
Touch.radiusX - Web APIs
Web › API › Touch › radiusX
evel 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 by the touch point's Touch.rotationAngle. Likewise, the Touch.radiusY property is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by Touch.rotatio...
Touch.screenX - Web APIs
Web › API › Touch › screenX
Summary Returns the X coordinate of the touch point relative to the screen, not including any scroll offset. Syntax var x = touchItem.screenX; Return value x The X coordinate of the touch point relative to the screen, not including any scroll offset. 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. In following simple code snippet, we assume the user initiates multiple touch contacts on an element with an id of source and then releases contacts with the surface. When the touchstart event handler is invoked...
TouchEvent.altKey - Web APIs
Web › API › TouchEvent › altKey
e) key is enabled when the touch event is created. If the alt key is enabled, the attribute's value is true. Otherwise, it is false. This property is Read only . Syntax var altEnabled = touchEvent.altKey; Return value altEnabled true if the alt key is enabled for this event; and false if the alt is not enabled. 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. someElement.addEventListener('touchstart', function(e) { // Log the state of this event's modifier keys console.log("altKey = " + e.altKey); console.log("ctrlKey = " + e.ctrlKey); console.log("metaKey...
TouchEvent - Web APIs
"231" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="281" y="30" font-size="12px" 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.c...
TouchList - Web APIs
Web › API › TouchList
Methods TouchList.identifiedTouch() Returns the first Touch item in the list whose identifier matches a specified value. ...
Using Touch Events - Web APIs
el - fired when a touch point has been disrupted in an implementation-specific manner (for example, too many touch points are created). The Touch interface represents a single contact point on a touch-sensitive device. The contact point is typically referred to as a touch point or just a touch. A touch is usually generated by a finger or stylus on a touchscreen, pen or trackpad. A touch point's properties include a unique identifier, the touch point's target element as well as the X and Y coordinates of the touch point's position relative to the viewport, page, and screen. The TouchList interface represents a list of contact points with a touch surface, one touch point per contact. Thus, if the user activated the touch surface with one finger, the list would contain one item, and if the user touc...
TrackDefault - Web APIs
The TrackDefault interface 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. A TrackDefault object is provided to a SourceBuffer object by setting its SourceBuffer.trackDefaults property. Constructor TrackDefault() Constructs and returns a new TrackDefault object. Properties TrackDefault.type Read only Returns the type of track that this SourceBuffer's media segment data relates to (i.e. audio, video, or text track.) TrackDefault.byteStreamTrackID Read only Returns the ID of the specific track that the SourceBuffer should apply to. TrackDefault.language Read only Returns the default language to use when an initialization segment does not contain language information...
TrackDefaultList - Web APIs
The TrackDefaultList interface represents a simple container list for multiple TrackDefault objects. The TrackDefaultList associated with a particular SourceBuffer can be retrieved using the SourceBuffer.trackDefaults property. Constructor TrackDefaultList() Constructs and returns a new TrackDefaultList object. Properties Inherits properties from its parent interface, EventTarget. TrackDefaultList.length Read only Returns the number of TrackDefault objects in the list. Methods Inherits properties from its parent interface, EventTarget. TrackDefaultList.TrackDefault() This getter allows the TrackDefault objects in the list to be accessed with an array operator (i.e. [].) Examples TBD. ...
TrackEvent - Web APIs
und in HTMLMediaElement.videoTracks Events involving audio tracks are always sent to the AudioTrackList specified in HTMLMediaElement.audioTracks Events affecting text tracks are sent to the TextTrackList object indicated by HTMLMediaElement.textTracks. Constructor TrackEvent() Creates and initializes a new TrackEvent object with the event type specified, as well as optional additional properties. Properties TrackEvent is based on Event, so properties of Event are also available on TrackEvent objects. track Read only The DOM track object the event is in reference to. If not null, this is always an object of one of the media track types: AudioTrack, VideoTrack, or TextTrack). Methods TrackEvent has no methods of its own; however, it is based on Event, so it provides the methods ...
Transferable - Web APIs
o a Worker using the Worker.postMessage() method. Note: The Transferable interface technically no longer exists. The functionality of Transferable objects still exists, however, but is implemented at a more fundamental level (technically speaking, using the [Transferable] WebIDL extended attribute). The ArrayBuffer, MessagePort, ImageBitmap and OffscreenCanvas types implement this interface. Properties The Transferable interface does not implement or inherit specific properties. Methods The Transferable interface does not implement or inherit specific properties. Specifications Specification Status Comment HTML Living StandardThe definition of 'Transferable' in that specification. Living Standard Replaced Transferable interface with [Transferable] Web IDL ...
TransformStream - Web APIs
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. ...
TreeWalker - Web APIs
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. ...
TypeInfo - Web APIs
Web › API › TypeInfo
TypeInfo.typeNamespace Read only Returns a DOMString indicating the type's namespace within the schema. Methods TypeInfo.isDerivedFrom() Returns a Boolean. ...
UIEvent - Web APIs
Web › API › UIEvent
rect x="116" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">UIEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructors UIEvent() Creates a UIEvent object. Properties This interface also inherits properties of its parent, Event. UIEvent.cancelBubble Is a Boolean indicating whether the bubbling of the event has been canceled or not. UIEvent.detailRead only Returns a long with details about the event, depending on the event type. UIEvent.isChar Read only Returns a Boolean indicating whether the event produced a key character or not. UIEvent.
ULongRange - Web APIs
The ULongRange dictionary is used to define a range of permitted integer values for a property, with either or both a maximum and minimum value specified. The ConstrainULongRange dictionary is based on this, augmenting it to support exact and ideal values as well. Properties max A numeric value in the range of signed 32-bit integers, specifying the largest permissible value of the property it describes. min A numeric value in the range of signed 32-bit integers, specifying the smallest permissible value of the property it describes. The specified min and/or and max values are required. If no match can be found that is within the given range, an error will occur. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'ULongRange' in ...
USB.requestDevice() - Web APIs
Web › API › USB › requestDevice
The requestDevice() method of the USB interface returns a Promise that resolves with an instance of USBDevice if the specified device is found. Calling this function triggers the user agent's pairing flow. Syntax USB.requestDevice([filters]) Parameters filters An array of filter objects for possible devices you would like to pair. 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...
USB - Web APIs
Web › API › USB
Event handlers USB.onconnect An event handler called whenever a previously paired device is connected. USB.ondisconnect An event handler called whenever a paired device is disconnected. Methods USB.getDevices() Returns a Promise that resolves with an array of USBDevice objects for paired attached devices. USB.requestDevice() Returns a Promise that resolves with an instance of USBDevice if the specified device is found. Calling this function triggers the user agent's pairing flow. ...
USBAlternateInterface - Web APIs
y the USB device. An interface includes one or more alternate settings which can configure a set of endpoints based on the operating mode of the device. Constructor USBAlternateInterface.USBAlternateInterface Creates a new USBAlternateInterface object which will be populated with information about the alternate interface of the provided USBInterface with the given alternate setting number. Properties USBAlternateInterface.alternateSettingRead only Returns the alternate setting number of this interface. This is equal to the bAlternateSetting field of the interface descriptor defining this interface. USBAlternateInterface.interfaceClassRead only Returns the class of this interface. This is equal to the bInterfaceClass field of the interface descriptor defining this interface. Standardiz...
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. 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 ...
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. ...
USBEndpoint - Web APIs
interface of the WebUSB API provides information about an endpoint provided by the USB device. An endpoint represents a unidirectional data stream into or out of a device. Constructor USBEndpoint.USBEndpoint Creates a new USBEndpoint object which will be populated with information about the endpoint on the provided USBAltenateInterface with the given endpoint number and transfer direction. Properties USBEndpoint.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 ...
USBInTransferResult - Web APIs
SBInTransferResult interface of the WebUSB API provides the result from a call to the transferIn() and controlTransferIn() methods of the USBDevice interface. It represents the result from requesting a transfer of data from the USB device to the USB host. Constructor USBInTransferResult.USBInTransferResult() Creates a new USBInTransferResult object with the provided status and data fields. Properties USBInTransferResult.dataRead only Returns a DataView object containing the data received from the USB device, if any. USBInTransferResult.statusRead only Returns the status of the transfer request, one of: "ok" - The transfer was successful. "stall" - The device indicated an error by generating a stall condition on the endpoint. A stall on the control endpoint does not need to be cl...
USBInterface - Web APIs
about an interface provided by the USB device. An interface represents a feature of the device which implements a particular protocol and may contain endpoints for bidirectional communication. Constructor USBInterface.USBInterface Creates a new USBInterface object which will be populated with information about the interface on the provided USBConfiguration with the given interface number. Properties USBInterface.interfaceNumberRead only Returns the interface number of 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 ca...
USBIsochronousInTransferPacket - Web APIs
om a call to the isochronousTransferIn() method of the USBDevice interface. It represents the status of an individual packet from a request to transfer data from the USB device to the USB host over an isochronous endpoint. Constructor USBIsochronousInTransferPacket.USBIsochronousInTransferPacket() Creates a new USBIsochronousInTransferPacket object with the provided status and data fields. Properties USBIsochronousInTransferPacket.dataRead only Read only Returns a DataView object containing the data received from the USB device in this packet, if any. USBIsochronousInTransferPacket.statusRead only Read only Returns the status of the transfer request, one of: "ok" - The transfer was successful. "stall" - The device indicated an error by generating a stall condition on the endpoin...
USBIsochronousInTransferResult - Web APIs
nterface of the WebUSB API provides the result from a call to the isochronousTransferIn() method of the USBDevice interface. It represents the result from requesting a transfer of data from the USB device to the USB host. Constructor USBIsochronousInTransferResult.USBIsochronousInTransferResult() Creates a new USBIsochronousInTransferResult object with the provided packets and data fields. Properties USBIsochronousInTransferResult.dataRead only Returns a DataView object containing the data received from the device. This is the combined data from all packets. See the individual DataView objects in the packets array for the portion of this buffer containing data from each packet. USBIsochronousInTransferResult.packetsRead only Returns an array of USBIsochronousInTransferPacket objects c...
USBIsochronousOutTransferPacket - Web APIs
the isochronousTransferOut() method of the USBDevice interface. It represents the status of an individual packet from a request to transfer data from the USB host to the USB device over an isochronous endpoint. Constructor USBIsochronousOutTransferPacket.USBIsochronousOutTransferPacket() Creates a new USBIsochronousOutTransferPacket object with the provided status and bytesWritten fields. Properties USBIsochronousOutTransferPacket.bytesWrittenRead only Returns the number of bytes from the packet that were sent to the device. USBIsochronousOutTransferPacket.statusRead only Returns the status of the transfer request, one of: "ok" - The transfer was successful. "stall" - The device indicated an error by generating a stall condition on the endpoint. A stall on an isochronous endpoi...
USBIsochronousOutTransferResult - Web APIs
esult interface of the WebUSB API provides the result from a call to the isochronousTransferOut() method of the USBDevice interface. It represents the result from requesting a transfer of data from the USB host to the USB device. Constructor USBIsochronousOutTransferResult.USBIsochronousOutTransferResult() Creates a new USBIsochronousOutTransferResult object with the provided packet field. Properties USBIsochronousOutTransferResult.packetsRead only Returns an array of USBIsochronousOutTransferPacket objects containing the result of each request to send a packet to the device. Specifications Specification Status Comment WebUSBThe definition of 'USBIsochronousOutTransferResult' in that specification. Draft Initial definition. ...
USBOutTransferResult - Web APIs
esult interface of the WebUSB API provides the result from a call to the transferOut() and controlTransferOut() methods of the USBDevice interface. It represents the result from requesting a transfer of data from the USB host to the USB device. Constructor USBOutTransferResult.USBOutTransferResult() Creates a new USBOutTransferResult object with the provided status and bytesWritten fields. Properties USBOutTransferResult.bytesWrittenRead only Returns the number of bytes from the transfer request that were sent to the device. USBOutTransferResult.statusRead only Returns the status of the transfer request, one of: "ok" - The transfer was successful. "stall" - The device indicated an error by generating a stall condition on the endpoint. A stall on a bulk or interrupt endpoint must...
UserDataHandler - Web APIs
n associating user data with a key on a node, Node.setUserData() can also accept, 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 delet...
UserProximityEvent - Web APIs
...
VRStageParameters - Web APIs
VRStageParameters.sizeX Read only Returns the width of the play-area bounds in meters. ...
VTTCue - Web APIs
Web › API › VTTCue
ime range and has the given text. Param startTime The time, in seconds and fractions of a second, that describes the beginning of the range of the media data to which the cue applies. endTime The time, in seconds and fractions of a second, that describes the end of the range of the media data to which the cue applies. text The raw text of the cue, and rules for its interpretation. Properties This interface also inherits properties from TextTrackCue. VTTCue.region A VTTRegion object describing the video's sub-region that the cue will be drawn onto, or null if none is assigned. VTTCue.vertical Returns an enum representing the cue writing direction. VTTCue.snapToLines Returns true if the VTTCue.line attribute is an integer number of lines or a percentage of the video size. VTT...
VTTRegion - Web APIs
Web › API › VTTRegion
VTTRegion.width A double representing the width of the region, as a percentage of the video. VTTRegion.lines A double representing the height of the region, in number of lines. ...
VideoConfiguration - Web APIs
The VideoConfiguration dictionary of the Media Capabilities API is used to define the video file being tested when calling the MediaCapabilities methods encodingInfo() and decodingInfo() to determine whether or not the described video configuration is supported, and how smoothly and how smoooth and power-efficient it can be handled. Properties The VideoConfiguration dictionary is made up of five video properties, including: contentType: A valid video MIME type. See our web video codec guide for types which may be supported. width: The width of the video. height: The height of the video. bitrate: The number of bits used to encode one second of the video file. framerate: The number of frames making up one second of video playback. Examples // Create media configuration to be tested const ...
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. ...
VideoTrackList - Web APIs
The VideoTrackList interface is used to represent a list of the video tracks contained within a <video> element, with each track represented by a separate VideoTrack object in the list. Retrieve an instance of this object with HTMLMediaElement.videoTracks. The individual tracks can be accessed using array syntax or functions such as forEach() for example. Properties This interface also inherits properties from its parent interface, EventTarget. length Read only The number of tracks in the list. selectedIndex Read only The index of the currently selected track, if any, or -1 otherwise. Event handlers onaddtrack An event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. onchange An event handler to be calle...
WakeLockSentinel - Web APIs
od. An acquired WakeLockSentinel can be released manually via the release() method, or automatically via the platform wake lock. This can happen if the document becomes inactive 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 re...
WaveShaperNode.curve - Web APIs
(); 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 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. Their S-shape, for instance, helps create a smoother sounding result. We found the below distortion curve code on Stack Overflow. var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var distortion = audioCtx.createWaveShaper(); ... function makeDistortionCurve(amount) { var k = typeof amount === 'number' ? amount : 50, n_samples = 44100, curve = new Float32Ar...
WaveShaperNode.oversample - Web APIs
edValue; Values distortion is a WaveShaperNode. enumeratedValue is one of 'none', '2x', or '4x'. 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. Their S-shape, for instance, helps create a smoother sounding result. We found the below distortion curve code on Stack Overflow. var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var distortion = audioCtx.createWaveShaper(); ... function makeDistortionCurve(amount) { var k = typeof amount === 'number' ? amount : 50, n_samples = 44100, curve = new Float32Ar...
WebGLActiveInfo - Web APIs
WebGLActiveInfo.size The read-only size of the requested variable. WebGLActiveInfo.type The read-only type of the requested variable. ...
WebGLBuffer - Web APIs
The WebGLBuffer interface is part of the WebGL API and represents an opaque buffer object storing data such as vertices or colors. Description The WebGLBuffer object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLBuffer objects, the following methods of the WebGLRenderingContext are useful: WebGLRenderingContext.bindBuffer() WebGLRenderingContext.createBuffer() WebGLRenderingContext.deleteBuffer() WebGLRenderingContext.isBuffer() 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 'WebGLBuffer' in that specification. Recommen...
WebGLFramebuffer - Web APIs
The WebGLFramebuffer interface is part of the WebGL API and represents a collection of buffers that serve as a rendering destination. Description The WebGLFramebuffer object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLFramebuffer objects, the following methods of the WebGLRenderingContext are useful: WebGLRenderingContext.bindFramebuffer() WebGLRenderingContext.createFramebuffer() WebGLRenderingContext.deleteFramebuffer() WebGLRenderingContext.isFramebuffer() Examples Creating a frame buffer var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var buffer = gl.createFramebuffer(); Specifications Specification Status Comment WebGL 1.0The definition of 'Web...
WebGLRenderbuffer - Web APIs
The WebGLRenderbuffer interface is part of the WebGL API and represents a buffer that can contain an image, or can be source or target of an rendering operation. Description The WebGLRenderbuffer object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLRenderbuffer objects, the following methods of the WebGLRenderingContext are useful: WebGLRenderingContext.bindRenderbuffer() WebGLRenderingContext.createRenderbuffer() WebGLRenderingContext.deleteRenderbuffer() WebGLRenderingContext.isRenderbuffer() Examples Creating a render buffer var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var buffer = gl.createRenderbuffer(); Specifications Specification Status Comment ...
WebGLRenderingContext.getExtension() - Web APIs
getExtension() method enables a WebGL extension. Syntax gl.getExtension(name); Parameters name A String for the name of the WebGL extension to enable. Return value A WebGL extension object, or null if name does not match (case-insensitive) to one of the strings in WebGLRenderingContext.getSupportedExtensions. Examples Once a WebGL extension is enabled, you are able to use the methods, properties or constants that this extension object provides. var canvas = document.getElementById('canvas'); gl = canvas.getContext('webgl'); gl.getExtension('WEBGL_lose_context').loseContext(); WebGL extensions Extensions for the WebGL API are registered in the WebGL Extension Registry. The current extensions are: ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_h...
WebGLShaderPrecisionFormat - Web APIs
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. ...
WebGLTexture - Web APIs
The WebGLTexture interface is part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations. Description The WebGLTexture object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLTexture objects, the following methods of the WebGLRenderingContext are useful: WebGLRenderingContext.bindTexture() WebGLRenderingContext.createTexture() WebGLRenderingContext.deleteTexture() WebGLRenderingContext.isTexture() Examples Creating a texture var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var texture = gl.createTexture(); Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLTexture' in that s...
WebGLUniformLocation - Web APIs
The WebGLUniformLocation interface is part of the WebGL API and represents the location of a uniform variable in a shader program. Description The WebGLUniformLocation object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLUniformLocation objects, the following methods of the WebGLRenderingContext are useful: WebGLRenderingContext.getUniformLocation() WebGLRenderingContext.uniform() Examples Getting an uniform location var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var location = gl.getUniformLocation(WebGLProgram, 'uniformName'); Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLUniformLocation' in that specification. Recom...
Canvas size and WebGL - Web APIs
not setting) the canvas size to 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 squa...
Detect WebGL - Web APIs
rom a canvas element. The WebGL rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the WebGL, and execute draw commands. Saving the state of the graphics machine within a single context interface is not unique to WebGL. This is also done in other graphics {{Glossary("API")}}, such as the canvas 2D rendering context. However, the properties and variables you can tweak are different for each API. <p>[ Here would go the result of WebGL feature detection ]</p> <button>Press here to detect WebGLRenderingContext</button> body { text-align : center; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } // Run everything inside window load event handler, to make sure // DOM is fully loaded and ...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
tied to be received by this peer connection. To do this, we implement the the RTCPeerConnection's ontrack event handler. pc.ontrack = ({track, streams}) => { track.onunmute = () => { if (remoteVideo.srcObject) { return; } remoteVideo.srcObject = streams[0]; }; }; When the track event occurs, this handler executes. Using destructuring, the RTCTrackEvent's track and streams properties are extracted. The former is either the video track or the audio track being received. The latter is an array of MediaStream objects, each representing a stream containing this track (a track may in rare cases belong to multiple streams at once). In our case, this will always contain one stream, at index 0, because we passed one stream into addTrack() earlier. We add an unmute event handler to t...
Signaling and video calling - Web APIs
tation: function handleICECandidateEvent(event) { if (event.candidate) { sendToServer({ type: "new-ice-candidate", target: targetUsername, candidate: event.candidate }); } } This builds an object containing the candidate, then sends it to the other peer using the sendToServer() function previously described in Sending messages to the signaling server. The message's properties are: type The message type: "new-ice-candidate". target The username the ICE candidate needs to be delivered to. This lets the signaling server route the message. candidate The SDP representing the candidate the ICE layer wants to transmit to the other peer. The format of this message (as is the case with everything you do when handling signaling) is entirely up to you, depending on you...
Using WebRTC data channels - Web APIs
tListener("open", (event) => { beginTransmission(dataChannel); }); requestRemoteChannel(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 ...
WebSocket - Web APIs
Web › API › WebSocket
tion 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.onerror An event listener to be called when an error occurs. WebSocket.onmessage An ev...
Writing a WebSocket server in C# - Web APIs
teLine("Server has started on 127.0.0.1:80.{0}Waiting for a connection...", Environment.NewLine); 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 th...
WebXR Device API - Web APIs
presenting an XR session, the state of all tracked objects which make up the session are represented by an XRFrame. To get an XRFrame, call the session's requestAnimationFrame() method, providing a callback which will be called with the XRFrame once available. Events which communicate tracking states will also use XRFrame to contain that information. XRRenderState Provides a set of configurable properties which change how the imagery output by an XRSession is composited. XRSession Provides the interface for interacting with XR hardware. Once an XRSession is obtained from navigator.xr.requestSession(), the session can be used to check the position and orientation of the viewer, query the device for environment information, and present the virtual or augmented world to the user. XRSpace XRSpace ...
Advanced techniques: Creating and sequencing audio - Web APIs
uadFilterNode and IIRFilterNode. For the most part a biquad filter will be good enough -- it comes with different types such as lowpass, highpass, and bandpass. If you're looking to do something more bespoke, however, the IIR filter might be a good option -- see Using IIR filters for more information. Wiring this up is the same as we've seen before. We create the BiquadFilterNode, configure the properties we want for it and connect it through our graph. Different types of biquad filters have different properties -- for instance setting the frequency on a bandpass type adjusts the middle frequency, however on a lowpass it would set the top frequency. let bandpass = audioCtx.createBiquadFilter(); bandpass.type = 'bandpass'; bandpass.frequency.value = 1000; // connect our graph noise.connect(bandpa...
Controlling multiple parameters with ConstantSourceNode - Web APIs
tSourceNode.offset property. The ConstantSourceNode can have as many outputs as necessary; in this case, we've connected it to three nodes: two GainNodes and a StereoPannerNode. So N becomes the value of the specified parameter (gain for the GainNodes and pan for the StereoPannerNode. As a result, every time you change N (the value of the input AudioParam, the values of the two GainNodes' gain properties and the value of the StereoPannerNode's pan propertry are all set to N as well. Example Let's take a look at this technique in action. In this simple example, we create three OscillatorNodes. Two of them have adjustable gain, controlled using a shared input control. The other oscillator has a fixed volume. HTML The HTML content for this example is primarily a button to toggle the oscillator t...
Example and tutorial: Simple synth keyboard - Web APIs
959.955381693075191; noteFreq[7]["G"] = 3135.963487853994352; noteFreq[7]["G#"] = 3322.437580639561108; noteFreq[7]["A"] = 3520.000000000000000; noteFreq[7]["A#"] = 3729.310092144719331; noteFreq[7]["B"] = 3951.066410048992894; noteFreq[8]["C"] = 4186.009044809578154; return noteFreq; } The result is an array, noteFreq, with an object for each octave. Each octave object has named properties in it where the property name is the name of the note (such as "C#" to represent C-sharp) and the property's value is the note's frequency in Hertz. In part, the resulting object looks like this: Octave Notes 0 "A" => 27.5 "A#" => 29.14 "B" => 30.87 1 "C" => 32.70 "C#" => 34.65 "D" => 36.71 "D#...
Web Audio API - Web APIs
n writing creative code. As long as you consider security, performance, and accessibility, you can adapt to your own style. In this article, we'll share a number of best practices -- guidelines, tips, and tricks for working with the Web Audio API.Web audio spatialization basicsHopefully, this article has given you an insight into how Web Audio spatialization works, and what each of the PannerNode properties do (there are quite a few of them). The values can be hard to manipulate sometimes and depending on your use case it can take some time to get them right. Examples You can find a number of examples at our webaudio-example repo on GitHub. Specifications Specification Status Comment Web Audio API Working Draft ...
Web Authentication API - Web APIs
an PublicKeyCredential, which has a PublicKeyCredential.rawId that is the globally unique credential id along with a response that is the AuthenticatorAttestationResponse containing the AuthenticatorResponse.clientDataJSON and AuthenticatorAttestationResponse.attestationObject. The PublicKeyCredential is sent back to the server using any desired formatting and protocol (note that the ArrayBuffer properties need to be be base64 encoded or similar). Server Validates and Finalizes Registration - Finally, the server is required to perform a series of checks to ensure that the registration was complete and not tampered with. These include: Verifying that the challenge is the same as the challenge that was sent Ensuring that the origin was the origin expected Validating that the signature ov...
Web Bluetooth API - Web APIs
The Web Bluetooth API provides the ability to connect and interact with Bluetooth Low Energy peripherals. Interfaces Bluetooth Returns a Promise to a BluetoothDevice object with the specified options. BluetoothAdvertisingData Provides advertising data about a particular Bluetooth device. BluetoothCharacteristicProperties Provides properties of a particular BluetoothRemoteGATTCharacteristic. 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. Bluetoot...
Web Crypto API - Web APIs
list security experts. Errors in security system design and implementation can make the security of the system completely ineffective. If you're not sure you know what you are doing, you probably shouldn't be using this API. Interfaces Some browsers implemented an interface called Crypto without having it well defined or being cryptographically sound. In order to avoid confusion, methods and properties of this interface have been removed from browsers implementing the Web Crypto API, and all Web Crypto API methods are available on a new interface: SubtleCrypto. The Crypto.subtle property gives access to an object implementing it. Specifications Specification Status Comment Web Cryptography API Recommendation Initial definition ...
The structured clone algorithm - Web APIs
PIs. It clones by recursing through the input object while maintaining a map of previously visited references, to avoid infinitely traversing cycles. Things that don't work with structured clone Function objects cannot be duplicated by the structured clone algorithm; attempting to throws a DATA_CLONE_ERR exception. Cloning DOM nodes likewise throws a DATA_CLONE_ERR exception. Certain object properties are not preserved: The lastIndex property of RegExp objects is not preserved. Property descriptors, setters, getters, and similar metadata-like features are not duplicated. For example, if an object is marked readonly with a property descriptor, it will be read/write in the duplicate, since that's the default. The prototype chain is not walked or duplicated. Note: Native Error...
WheelEvent() - Web APIs
wheelEventInit Optional Is a WheelEventInit dictionary, having the following fields: "deltaX", optional and defaulting to 0.0, is a double representing 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. ...
Window.getDefaultComputedStyle() - Web APIs
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. ...
Window.matchMedia() - Web APIs
Web › API › Window › matchMedia
d 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 media query, look at the value of the matches property, which will be true if the ...
Window.navigator - Web APIs
Web › API › Window › navigator
Syntax navigatorObject = window.navigator Examples Example #1: Browser detect and return a string var sBrowser, sUsrAg = navigator.userAgent; // The order matters here, and this may report false positives for unlisted browsers. ...
Window: popstate event - Web APIs
oing a browser action such as a click on the back or forward button (or calling history.back() or history.forward() in JavaScript). Browsers tend to handle the popstate event differently on page load. Chrome (prior to v34) and Safari always emit a popstate event on page load, but Firefox doesn't. Note: When writing functions that process popstate event it is important to take into account that properties like window.location will already reflect the state change (if it affected the current URL), but document might still not. If the goal is to catch the moment when the new document state is already fully in place, a zero-delay setTimeout() method call should be used to effectively put its inner callback function that does the processing at the end of the browser event loop: window.onpopstate = () ...
Window.resizeTo() - Web APIs
Web › API › Window › resizeTo
izeTo(width, height) Parameters width An integer representing the new outerWidth in pixels (including scroll bars, title bars, etc). height An integer value representing the new outerHeight in pixels (including scroll bars, title bars, etc). 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. function quarter() { window.resizeTo( window.screen.availWidth / 2, window.screen.availHeight / 2 ); } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.resizeTo()' in that specification. Working Draft ...
Window.screen - Web APIs
Web › API › Window › screen
The Window property screen returns a reference to the screen object associated with the window. The screen object, implementing the Screen interface, is a special object for inspecting properties of the screen on which the current window is being rendered. Syntax let screenObj = window.screen; Example if (screen.pixelDepth < 8) { // use low-color version of page } else { // use regular, colorful page } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.screen' in that specification. Working Draft Initial definition. ...
Window.scrollX - Web APIs
Web › API › Window › scrollX
indow.scrollX > 400) { window.scroll(0,0); } Notes The pageXOffset property is an alias for the scrollX property: window.pageXOffset == window.scrollX; // always true For cross-browser compatibility, use window.pageXOffset instead of window.scrollX. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatible example: var x = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft; var y = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; Specification Specification Status Comment ...
Window.scrollY - Web APIs
Web › API › Window › scrollY
as scrollBy(), scrollByLines(), or scrollByPages(). The pageYOffset property is an alias for the scrollY property: window.pageYOffset === window.scrollY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatible example: var supportPageOffset = window.pageXOffset !== undefined; var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"); var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft; var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.
Window.window - Web APIs
Web › API › Window › window
The window property of a Window object points to the window object itself. Thus, the following expressions all return the same window object: window.window window.window.window window.window.window.window // ... In web pages, the window object is also a global object. This means: global variables of your script are in fact properties of window: var global = {data: 0}; alert(global === window.global); // displays "true" you can access built-in properties of the window object without having to type window. prefix: setTimeout("alert('Hi!')", 50); // equivalent to using window.setTimeout. alert(window === window.window); // displays "true" The point of having the window property refer to the object itself, was likely to make it easy to refer to the global object. Otherwise, you'd ha...
WindowClient - Web APIs
ent in a browsing context, controlled by an active worker. The service worker client independently selects and uses a service worker for its own loading and sub-resources. Methods WindowClient inherits methods from its parent interface, Client. WindowClient.focus() Gives 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) { conso...
WindowEventHandlers.onhashchange - Web APIs
ion 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. 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; wind...
WindowOrWorkerGlobalScope.atob() - Web APIs
. Living Standard Method moved to the WindowOrWorkerGlobalScope mixin in the latest spec. HTML 5.1The definition of 'WindowBase64.atob()' in that specification. Recommendation Snapshot of HTML Living Standard. No change. HTML5The definition of 'WindowBase64.atob()' in that specification. Recommendation Snapshot of HTML Living Standard. Creation of WindowBase64 (properties where on the target before it). ...
WindowOrWorkerGlobalScope.btoa() - Web APIs
. Living Standard Method moved to the WindowOrWorkerGlobalScope mixin in the latest spec. HTML 5.1The definition of 'WindowBase64.btoa()' in that specification. Recommendation Snapshot of HTML Living Standard. No change. HTML5The definition of 'WindowBase64.btoa()' in that specification. Recommendation Snapshot of HTML Living Standard. Creation of WindowBase64 (properties where on the target before it). ...
WindowOrWorkerGlobalScope.fetch() - Web APIs
balScope, which means that the fetch() method is available in pretty much any context in which you might want to fetch resources. A fetch() promise only rejects when a network error is encountered (which is usually when there's a permissions issue or similar). A fetch() promise does not reject on HTTP errors (404, etc.). Instead, a then() handler must check the Response.ok and/or Response.status properties. The fetch() method is controlled by the connect-src directive of Content Security Policy rather than the directive of the resources it's retrieving. Note: The fetch() method's parameters are identical to those of the Request() constructor. Syntax const fetchResponsePromise = fetch(resource [, init]) Parameters resource This defines the resource that you wish to fetch. This can either...
WindowOrWorkerGlobalScope - Web APIs
The WindowOrWorkerGlobalScope mixin describes several features common to the Window and WorkerGlobalScope interfaces. Each of these interfaces can, of course, add more features in addition to the ones listed below. Note: WindowOrWorkerGlobalScope is a mixin and not an interface; you can't actually create an object of type WindowOrWorkerGlobalScope. Properties These properties are defined on 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...
Worker() - Web APIs
Web › API › Worker › Worker
I is of the same origin or not. Though Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) and later accept data URIs, that's not the case in all other browsers. 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 ...
Worker - Web APIs
Web › API › Worker
pRequest for network communication, but its responseXML and channel attributes are always null. (fetch is also available, with no such restrictions.) In Firefox extensions, if you want to use workers with access to js-ctypes, use ChromeWorker object instead. Constructors Worker() Creates a dedicated web worker that executes the script at the specified URL. This also works for Blob URLs. Properties Inherits properties from its parent, EventTarget, and implements properties from AbstractWorker. Event handlers AbstractWorker.onerror An EventListener called whenever an ErrorEvent of type error bubbles through to the worker. This is inherited from AbstractWorker. Worker.onmessage An EventListener called whenever a MessageEvent of type message bubbles through the worker -- i.e. when a me...
WorkerGlobalScope.performance - Web APIs
This property is Read only . Syntax var perfObj = self.performance; Return Value A Performance object. ...
WorkerLocation - Web APIs
The WorkerLocation interface defines the absolute location of the script executed by the Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.location property obtained by calling self.location. This interface is only visible from inside a JavaScript script executed in the context of a Web worker. Properties The WorkerLocation interface doesn't inherit any property, but implements properties defined in the URLUtilsReadOnly interface. URLUtilsReadOnly.href Read only Is a stringifier that returns a DOMString containing the whole URL of the script executed in the Worker. URLUtilsReadOnly.protocol Read only Is a DOMString containing the protocol scheme of the URL of the script executed in the Worker, including the final ':'. URLUtilsReadOnly.host ...
WritableStream.WritableStream() - Web APIs
underlyingSink can contain the following: start(controller) Optional This is a method, called immediately when the object is constructed. The contents of this method are defined by the developer, and should aim to get access to the underlying sink. ...
WritableStream - Web APIs
The WritableStream interface of the the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. Constructor WritableStream() Creates a new WritableStream object. Properties WritableStream.locked Read only A boolean indicating whether the WritableStream is locked to a writer. Methods WritableStream.abort() 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. WritableStream.close() Closes the stream. WritableStream.getWriter() Returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked...
WritableStreamDefaultController - Web APIs
WritableStreamDefaultController interface of the the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. Constructor None. WritableStreamDefaultController instances are created automatically during WritableStream construction. Properties None. Methods WritableStreamDefaultController.error() Causes any future interactions with the associated stream to error. Examples const writableStream = new WritableStream({ start(controller) { // do stuff with controller // error stream if necessary controller.error('My stream is broken'); }, write(chunk, controller) { ... }, close(controller) { ... ...
WritableStreamDefaultWriter - Web APIs
The WritableStreamDefaultWriter interface of the the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink. Constructor WritableStreamDefaultWriter() Creates a new WritableStreamDefaultWriter object instance. Properties WritableStreamDefaultWriter.closedRead only Allows you to write code that responds to an end to the streaming process. Returns a promise that fulfills if the stream becomes closed or the writer's lock is released, or rejects if the stream errors. WritableStreamDefaultWriter.desiredSizeRead only Returns the desired size required to fill the stream's internal queue. WritableStreamDefaultWriter.readyRead only Returns a Prom...
XDomainRequest - Web APIs
Internet Explorer 10 in favor of using XMLHttpRequest with proper CORS; if you are targeting Internet Explorer 10 or later, or wish to support any other browser, you need to use standard HTTP access control. This interface can send both GET and POST requests. Syntax var xdr = new XDomainRequest(); Returns a new XDomainRequest object, which can then be used to make and manage these requests. Properties XDomainRequest.timeout Gets or sets the amount of time until a request times out. XDomainRequest.responseText Gets the response body as a string. Methods XDomainRequest.open() Opens the request, specifing the method (GET/POST) and URL. XDomainRequest.send() Sends the request. POST data is specified in this method. XDomainRequest.abort() Aborts the request. Event handlers XDom...
XMLHttpRequestEventTarget - Web APIs
XMLHttpRequestEventTarget.onerror Contains the function to call when a request encounters an error and the error event is received by this object. XMLHttpRequestEventTarget.onload Contains the function to call when an HTTP request returns after successf...
XPathException - Web APIs
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. ...
XPathResult - Web APIs
XPathResult.invalidIteratorStateRead only Signifies that the iterator has become invalid. ...
XRBoundedReferenceSpace - Web APIs
d size of the room the user is located in, in order to let the WebXR site or application prevent the user from colliding with the walls or other obstacles in the real world. At a minimum, the boundaries indicate the area in which the XR device is capable of tracking the user's movement. See the article Using bounded reference spaces for details on how bounded spaces work and why they're useful. Properties In addition to the properties of XRReferenceSpace, XRBoundedReferenceSpace includes the following: boundsGeometry Read only An array of DOMPointReadOnly objects, each of which defines a vertex in the polygon defining the boundaries within which the user will be required to remain. These vertices must be sorted such that they move clockwise around the viewer's position. Methods XRBoundedR...
XRFrame - Web APIs
Web › API › XRFrame
s also provide an XRFrame reference as part of their structure. In addition to providing a reference to the XRSession for which this frame is to be rendered, the getViewerPose() method is provided to obtain the XRViewerPose describing the viewer's position and orientation in space, and getPose() can be used to create an XRPose describing the relative position of one XRSpace relative to another. Properties session Read only The XRSession that for which this XRFrame describes the tracking details for all objects. The information about a specific object can be obtained by calling one of the methods on the object. Methods getPose() Returns an XRPose object representing the spatial relationship between the two specified XRSpace objects. getViewerPose() Returns an XRViewerPose describing th...
XRInputSource - Web APIs
The WebXR Device API's XRInputSource interface describes a single source of control input which is part of the user's WebXR-compatible virtual or augmented reality system. The device is specific 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. gri...
XRInputSourceArray - Web APIs
as the return value of the XRSession property inputSources. Each entry is an XRInputSource representing one input device connected to the WebXR system. In addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the forEach() method is also available. Properties The following properties are available on XRInputSourceArray objects. length Read only The number of XRInputSource objects in the list. Methods The following methods are available on XRInputSourceArray objects. You may also use the features of the Symbol type. entries() Returns an iterator you can use to walk the list of key/value pairs in the list. Each item returned is an array who...
XRInputSourceEvent() - Web APIs
presented 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 primary action. selectend Sent to an XRSession when an ongoing primary action ends, or when an input source with an ongoing primary action has been disconnected from the system. se...
XRInputSourceEvent - Web APIs
ent which has occurred on a WebXR user input device such as a hand controller, gaze tracking system, or motion tracking system. More specifically, they represent a change in the state of an XRInputSource. To learn more about handling inputs in a WebXR project, see the article Inputs and input sources. Constructor XRInputSourceEvent() Creates and returns a new XRInputSourceEvent object whose properties match those provided in the eventInitDict dictionary provided. Properties frame Read only An XRFrame object providing the needed information about the event frame during which the event occurred. This frame may have been rendered in the past rather than being a current frame. Because this is an event frame, not an animation frame, you cannot call the XRFrame method getViewerPose() on it; i...
XRInputSourcesChangeEvent - Web APIs
to represent the inputsourceschange event sent to an XRSession when the set of available WebXR input controllers changes. Constructor XRInputSourcesChangeEvent() Creates and returns a new XRInputSourcesChangeEvent object configured as indicated by the given XRInputSourcesChangeEventInit object. The specified type must be inputsourceschange, which is the only event that uses this interface. Properties added Read only An array of zero or more XRInputSource objects, each representing an input device which has been newly connected or enabled for use. removed Read only An array of zero or more XRInputSource objects representing the input devices newly connected or enabled for use. session Read only The XRSession to which this input source change event is being directed. Methods While...
XRInputSourcesChangeEventInit - Web APIs
removed Read only An array of zero or more XRInputSource objects representing the input devices which are no longer available. session Read only The XRSession to which the event applies. ...
XRPermissionDescriptor - Web APIs
sions in the WebXR Device API are managed using the Permissions API. To that end, the XRPermissionDescriptor dictionary is used to describe the WebXR features the app needs to use, as well 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 requ...
XRPermissionStatus - Web APIs
The XRPermissionStatus interface defines the object returned by calling navigator.permissions.query() for the xr permission name; it indicates whether or not the app or site has permission to use WebXR, an may be monitored over time for changes to that permissions tate. Properties In addition to the properties listed below, XRPermissionStatus includes the properties defined by its parent interface, PermissionStatus. granted An array of strings listing the names of the features for which permission has been granted as of the time at which navigator.permissions.query() was called. Any feature which was specified in either the optionalFeatures or requiredFeatures when calling navigator.permissions.query() are listed in granted if and only if permission to use them is granted. Methods No me...
XRPose - Web APIs
Web › API › XRPose
reference space which has been updated using the base frame of reference for the frame and any adjustments needed to position the viewer based on movement or rotation which is being supplied from 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 th...
XRReferenceSpace - Web APIs
round, such as those that track movement with a real-world camera, this boundary establishes the edges of the area the user is able to move around in, whether due to physical obstacles or due to limitations of the XR hardware. See the article Using bounded reference spaces to protect the viewer for more on using boundaries to keep the user from colliding with obstacles both physical and virtual. Properties In addition to the properties inherited from XRSpace (of which there are none at this time), XRReferenceSpace also inherits the properties of EventTarget. XRReferenceSpace defines no additional properties. Methods In addition to the methods inherited from its parent interface, XRSpace (there are none at this time), XRReferenceSpace inherits methods from EventTarget. XRReferenceSpace also prov...
XRReferenceSpaceEvent() - Web APIs
nceSpace. Currently, only the reset event is defined using this type. Syntax let refSpaceEvent = new XRReferenceSpaceEvent(type, eventInitDict); Parameters type A DOMString indicating the event type which has occurred. Currently, this is always reset. eventInitDict 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 ...
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 coordin...
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 even...
XRRenderState - Web APIs
The XRRenderState interface of the WebXR Device API contains configurable values which affect how the imagery generated by an XRSession gets composited. These properties include the range of distances from the viewer within which content should be rendered, the vertical field of view (for inline presentations), and a reference to the XRWebGLLayer being used as the target for rendering the scene prior to it being presented on the XR device's display or displays. When you apply changes using the XRSession method updateRenderState(), the specified changes take effect after the current animation frame has completed, but before the next one begins. Properties The followiing properties are available on XRRenderState objects. baseLayer Read only The XRWebGLLayer from which the browser...
XRRigidTransform.matrix - Web APIs
ransform 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 array [a0, a1, a2, ..., a13, a14, a15], the matrix looks like this: [a[0]a[4...
XRSession: inputsourceschange event - Web APIs
ces changes. The received event, of type XRInputSourcesChangeEvent, contains a list of any newly added and/or removed input devices. Bubbles Yes Cancelable No Interface XRInputSourcesChangeEvent Event handler property oninputsourceschange The event object contains lists of the newly-added and/or removed input devices in its added and removed properties. Examples Specifications Specification Status Comment WebXR Device APIThe definition of 'inputsourceschange event' in that specification. Working Draft Initial definition. ...
XRSession.updateRenderState() - Web APIs
The specified object may have any combination of the following fields. ...
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. Properties 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...
XRSessionEventInit - Web APIs
The XRSessionEventInit dictionary is used when calling the XRSessionEvent() constructor to provide the new event's initial values. 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. Examples <tbd> Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSessionEventInit' in that specification. Working Draft Initial definition. ...
XRSessionInit - Web APIs
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. ...
XRSpace - Web APIs
Web › API › XRSpace
XRReferenceSpace Represents a reference space which is typically expected to remain static for the duration of the XRSession. While objects may move within the space, the space itself remains fixed in place. There are exceptions to this static nature; most commonly, an XRReferenceSpace may move in order to adjust based on reconfiguration of the user's headset or other motion-sensitive device. Properties The XRSpace interface defines no properties of its own; however, it does inherit the properties of its parent interface, EventTarget. Methods The XRSpace interface provides no methods of its own. However, it inherits the methods of EventTarget, its parent interface. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSpace' in that specifi...
XRSystem: devicechange event - Web APIs
Note: Not to be confused with the MediaDevices devicechange event. ...
XRSystem - Web APIs
Web › API › XRSystem
The WebXR Device API interface XRSystem provides methods which let you get access to an XRSession object representing a WebXR session. With that XRSession in hand, you can use it to interact with the Augmented Reality (AR) or Virtual Reality (VR) device. Properties While XRSystem directly offers no properties, it does inherit properties from its parent interface, EventTarget. Methods In addition to inheriting methods from its parent interface, EventTarget, the XRSystem interface includes the following methods: isSessionSupported() Returns a promise which resolves to true if the browser supports the given XRSessionMode. Resolves to false if the specified mode isn't supported. requestSession() Returns a promise that resolves to a new XRSession with the specified XRSessionMode. Event...
XRView - Web APIs
Web › API › XRView
tation and position information for the viewpoint. You can think of it as a description of a specific eye or camera and how it 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 somethi...
XRViewerPose - Web APIs
t of view on the scene. Each XRViewerPose can have multiple views to represent, for example, the slight separation between the left and right eye. This view can represent anything from the point-of-view of a user's XR headset to the viewpoint represented by a player's movement of an avatar using mouse and keyboard, presented on the screen, to a virtual camera capturing the scene for a spectator. Properties In addition to the properties inherited from XRPose, XRViewerPose includes the following: views Read only An array of XRView objects, one for each viewpoint on the scene which is needed to represent the scene to the user. A typical headset provides a viewer pose with two views whose eye property is either left or right, indicating which eye that view represents. Taken together, these views ...
XRViewport.width - Web APIs
Web › API › XRViewport › width
Syntax width = xrViewport.width; Value The viewport's width in pixels. ...
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 Co...
XRViewport - Web APIs
Properties height Read only The height, in pixels, of the viewport. width Read only The width, in pixels, of the viewport. x Read only The offset from the origin of the destination graphics surface (typically a XRWebGLLayer) to the left edge of the viewport, in pixels. y Read only The offset from the origin 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. ...
XRWebGLLayer.framebuffer - Web APIs
ed without specifying a stencil will not have a stencil buffer. Opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating the layer. The XR compositor assumes that opaque framebuffers use colors with premultiplied allpha, regardless of whether or not the WebGL context's premultipliedAlpha 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 ...
XRWebGLLayer - Web APIs
nly type of framebuffer layer supported by WebGL, 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. framebufferHeigh...
XRWebGLLayerInit - Web APIs
Otherwise, the color buffer will not have an alpha channel. The default value is true. ...
XSL Transformations in Mozilla FAQ - Web APIs
e crashes (bug 202765). In most cases, there is no need to actually use it, though. If you need platform dependent code or stylesheets, just do <xsl:if test="system-property('xsl:vendor')='Transformiix'"> <!-- Mozilla specific markup --> </xsl:if> <xsl:if test="system-property('xsl:vendor')='Microsoft'"> <!-- IE specific markup --> </xsl:if> Check system-properties.xml for the properties of your favorite system. MSXML has an additional property. <xsl:if xmlns:msxsl="urn:schemas-microsoft-com:xslt" test="system-property('msxsl:version')=3"> <!-- MSXML3 specific markup --> </xsl:if> What about media="print"? When printing a document, Mozilla tries to render the page on paper as closely to what you see as possible. This in...
XSLTProcessor - Web APIs
he default value for the parameter as specified in the stylesheet. A null value for namespaceURI is treated the same as an empty string. void XSLTProcessor.clearParameters() Removes all set parameters from the XSLTProcessor. The XSLTProcessor will then use the defaults specified in the XSLT stylesheet. void XSLTProcessor.reset() Removes all parameters and stylesheets from the XSLTProcessor. Properties Non-Web-exposed properties The following properties are [ChromeOnly] and not exposed to Web content: [ChromeOnly] attribute unsigned long XSLTProcessor.flags Flags that tweak the behavior of the processor. Not reset by calling XSLTProcessor.reset(). Default value: 0 Possible values are: Name Value Effect (None) 0 None DISABLE_A...
Web APIs
Web › API
oWorkletGlobalScope AudioWorkletNode AudioWorkletNodeOptions AudioWorkletProcessor AuthenticatorAssertionResponse AuthenticatorAttestationResponse AuthenticatorResponse B BaseAudioContext BasicCardRequest BasicCardResponse BatteryManager BeforeInstallPromptEvent BeforeUnloadEvent BiquadFilterNode Blob BlobBuilder BlobEvent Bluetooth BluetoothAdvertisingData BluetoothCharacteristicProperties BluetoothDevice BluetoothRemoteGATTCharacteristic BluetoothRemoteGATTDescriptor BluetoothRemoteGATTServer BluetoothRemoteGATTService Body BroadcastChannel BudgetService BudgetState BufferSource ByteLengthQueuingStrategy ByteString C CDATASection CSS CSSConditionRule CSSCounterStyleRule CSSGroupingRule CSSImageValue CSSKeyframeRule CSSKeyframesRule CSSKeywordValue CSSMat...
ARIA live regions - Accessibility
e set year is: changedvalue" Advanced use case: Roster A chat site would like to display a list of users currently logged in. Display a list of users where a user's log-in and log-out status will be reflected dynamically (without a page reload). <ul id="roster" aria-live="polite" aria-relevant="additions removals"> <!-- use JavaScript to add remove users here--> </ul> Breakdown of ARIA live properties: aria-live="polite" indicates that the screen reader should wait until the user is idle before presenting updates to the user. This is the most commonly used value, as interrupting the user with "assertive" might interrupt their flow. aria-atomic is not set (false by default) so that only the added or removed users should be spoken and not the entire roster each time. aria-relevant="addition...
Using the aria-valuemax attribute - Accessibility
The value of aria-valuemax MUST be greater than or equal to the value of aria-valuemin. aria-valuemax is a required attribute of role slider, scrollbar and spinbutton. ...
Using the aria-valuemin attribute - Accessibility
aria-valuemin is a required attribute of role slider, scrollbar and spinbutton. ...
ARIA Test Cases - Accessibility
autocomplete Dojo autocomplete Expected AT Behavior: Screen reader should announce the fact that this is a control supporting autocomplete. When suggestions appear, if the AT supports it elsewhere in the operating system (e. g. the Run dialog), suggestions should be supported inside the web app as well. Screen magni...
ARIA: tabpanel role - Accessibility
cal screen reader users, like Google or mobile speech recognition. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'tabpanel' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'tabpanel' in that specification. Working Draft Precedence order What are the related properties, and in what order will this attribute or property be read (which property will take precendence over this one, and which property will be overwritten. Screen reader support TBD ...
ARIA: timer role - Accessibility
logies 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 element that contains additional instructions for navigating or operating this element. aria-roledescription Used to give the timer a more descriptive role text for screen readers to speak. This should be loca...
ARIA: application role - Accessibility
de or focus mode, lets all keyboard input go through to the browser again. Escape is the most common way of switching back to browse mode. The application role is designed to provide a means for widgets that are not part of the standard set to be accessible for direct interaction in ATs that use both browse and focus modes for interacting with web content. Associated WAI-ARIA roles, states, and properties document, article Used to indicate parts of the application that should be treated as normal web content aria-activedescendant Used to manage focus inside the application. aria-label Used to provide the name of the application or purpose of the widget that is being exposed. aria-describedby Used to indicate the idref of an element that contains additional instructions for navigating or ...
ARIA: article role - Accessibility
rmation just like the article role. Using the <article> element also helps search engines better discover the structure of a page. Examples of appropriate uses of the role="article", or preferably <article>, include blog posts, forum posts, a comment to a forum or blog post, a comment to a comment to a forum or blog post, any an item in a social media feed. Associated WAI-ARIA roles, states, and properties aria-posinset In the context of a feed, indicates the position 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 no...
ARIA: banner role - Accessibility
on subsection. Each page may have a banner landmark, but each page should be limited to only one header with the role of banner. In the case of a page containing nested document and/or application roles, each nested document or application role may also have one banner landmark. If a page includes more than one banner landmark, each should have a unique label. Associated ARIA roles, states, and properties None Keyboard interactions None Required JavaScript features None Examples Here's a fake simple banner with a skip to navigation link, a logo, a title and a subtitle. As this is the main header for the site, we've added the banner landmark role to the container element. <div role="banner"> <a href="#nav" id="skipToMenu" class="skiptocontent">Skip To Keyboard Navigation</a> <img src="i...
ARIA: document role - Accessibility
rent's dynamic context, re-enabling the standard 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...
ARIA: feed role - Accessibility
thin a feed of blog posts, the convention is to tab into the nested feed with the Tab key and to provide another key, such as Alt + Page Down, to navigate from an 'outer' article to the first item in that article's nested feed. Navigate between the nested feed and main feed with Control + End , moving focus from the inner feed to the next article in the outer feed. WAI-ARIA roles, states, and properties aria-labelled If the feed has no visible title, the feed element has a label specified with aria-label. If it does, see aria-labelledby. aria-labelledby If the feed has a visible title, the feed element has aria-labelledby referring to the element containing the title. If not, add an aria-label. aria-busy When busy, such as when articles are being added or removed from the feed, set aria-...
ARIA: form role - Accessibility
users. Use the search landmark instead of the form landmark when the form is used for search functionality. Use the role="form" to identify a region of the page; do not use it to identify every form field. Even if you are using the form landmark instead of <form>, you are encouraged to use native HTML form controls like button, input, select, and textarea Associated WAI-ARIA Roles, States, and Properties No role specific states or properties. Keyboard Interactions No role specific keyboard interactions Required JavaScript features onsubmit The onSubmit event handler handles the event raised when the form is submitted. Anything that is not a <form> cannot be submitted, therefore you would have to use JavaScript to build an alternative data submission mechanism, for example with XMLHTTPRequ...
ARIA: List role - Accessibility
e list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions. Warning: If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a list and its listitems -- <ul>/<ol> and <li>. See Best practices for a full example. Associated WAI-ARIA Roles, States, and Properties listitem A single item in a list or directory. Elements with role listitem can only be found in an element with the role list or group. group A collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. Keyboard Interactions None. Required JavaScript features None. Examples ARIA Lists...
ARIA: Listitem role - Accessibility
the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions. Warning: If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a list and its listitems -- <ul>/<ol> and <li>. See Best practices for a full example. Associated WAI-ARIA Roles, States, and Properties list A list of items. Elements with role list must have one or more elements with the role listitem as children, a one or more elements with the role of group that have one or more elements with the listitem role as children. group A collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. ...
ARIA: Navigation Role - Accessibility
he HTML5 <nav> element to define a navigation landmark. If the HTML5 nav element technique is not being used, use a role="navigation" attribute to define a navigation landmark. Using the <nav> element will automatically communicate a section has a role of navigation. Developers should always prefer using the correct semantic HTML element over using ARIA. Associated WAI-ARIA Roles, States, and Properties aria-label A brief description of the purpose of the navigation, omitting the term "navigation", as the screen reader will read both the role and the contents of the label. Keyboard Interactions None. Required JavaScript features None. Examples <div role="navigation" aria-label="Customer service"> <ul> <li><a href="#">Help</a></li> <li><a href="#">Order tracking</li> <li>...
ARIA: Region role - Accessibility
l should be used.. region landmark roles content should make sense if separated from 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 accessi...
ARIA: img role - Accessibility
This seems to work OK across some browser/screenreader combinations, but some of them end up reading the label out twice. Use with caution and test thoroughly. Another example where this might be suitable is when using ASCII emoji combinations, like the legendary "Table flip": <div role="img" aria-label="Table flip"> <p> (????)?( ??? </p> </div> Associated WAI-ARIA Roles, States, and Properties aria-label An accessible name is required. An aria-label attribute Keyboard Interactions Required JavaScript features Examples star rating role="img" example Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'img' in that specification. Recommendation Screen reader support TBD ...
ARIA: rowgroup role - Accessibility
f one or more rows. Each row, in turn, contains child cells. These cells can be of different types, depending on whether they are column or row headers, or plain or grid cells. Note: Using the native HTML table element (<table>) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties Context roles role="table" One of the three possible contexts (along with grid and treegrid) in which you'll find a row. It identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> HTML element. role="grid" One of the three possible contexts (along with table and treegrid) in which you'll find a row.
ARIA: tab role - Accessibility
ctive elements to tabindex=-1, and to set the active element to tabindex=0. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'tab' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'tabs' in that specification. Working Draft Precedence order What are the related properties, and in what order will this attribute or property be read (which property will take precendence over this one, and which property will be overwritten. Screen reader support TBD ...
ARIA: table role - Accessibility
des for the selection state of individual cells, if left to right and top to bottom navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead. Note: Using a native HTML table element whenever possible 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-lab...
ARIA: button role - Accessibility
ting 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). 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. If the attribute is omitted or set to its default value of ar...
ARIA: checkbox role - Accessibility
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. 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. Ke...
ARIA: dialog role - Accessibility
ialog is showing. For non-modal dialogs it is still possible to interact with content 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...
ARIA: heading role - Accessibility
ike a heading. Screen readers would read the text and indicate that it is formatted like a heading. In addition, the level tells assistive 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 ...
WAI-ARIA Roles - Accessibility
Screen readers will instantly start reading out the updated content when the role is added. ...
ARIA - Accessibility
icking (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 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 ...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
M node through the cross-platform nsIAccessible and MSAA-specific IAccessible interfaces. Every accessibility object created must be cached, and must inherit from nsAccessibleWrap so that it supports a base implementation of nsIAccessible and IAccessible. Apart from that, it is free to override IAccessible or nsIAccessible methods. In this way each class is tailored to the specific abilities and properties of the HTML or XUL/UI objects it applies to, and can support both MSAA, ATK and hopefully any future accessibility API's we need to support. For example nsHTMLButtonAccessible overrides nsIAccessible::GetAccRole to expose ROLE_BUTTON for IAccessible::get_accRole which uses that. A more complicated set of nsIAccessible methods which can be overridden are GetAccFirstChild/GetAccLastChild/GetAccChi...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
ground-color: #ffffcc; padding: 12px; color: #000000; font-size: 14px; z-index: 1; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::after' in that specification. Working Draft No significant changes to the previous specification. CSS AnimationsThe definition of 'animations on pseudo-element properties' in that specification. Working Draft Allows animations on properties defined on pseudo-elements. Selectors Level 3The definition of '::after' in that specification. Recommendation Introduces the two-colon syntax. CSS Level 2 (Revision 1)The definition of '::after' in that specification. Recommendation Initial definition, using the one-colon syntax. ...
::backdrop - CSS: Cascading Style Sheets
er in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen. The ::backdrop pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer. ::backdrop neither inherits from nor is inherited by any other elements. No restrictions are made on what properties apply to this pseudo-element. Syntax ::backdrop Examples Styling the backdrop for full-screen video In this example, the backdrop style used when a video is shifted to full-screen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers. video::backdrop { background-color: #448; } The resulting screen looks like this: Note the dark grey-blue le...
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
{ content: " \21E6"; /* Hexadecimal for Unicode Leftwards white arrow*/ display: inline; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::before' in that specification. Working Draft No significant changes to the previous specification. CSS Animations Working Draft Allows animations on properties defined on pseudo-elements. Selectors Level 3The definition of '::before' in that specification. Recommendation Introduces the two-colon syntax. CSS Level 2 (Revision 1)The definition of '::before' in that specification. Recommendation Initial definition, using the one-colon syntax ...
::grammar-error - CSS: Cascading Style Sheets
The ::grammar-error CSS pseudo-element represents a text segment which the user agent has flagged as grammatically incorrect. Allowable properties Only a small subset of CSS properties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::grammar-error Examples Simple document grammar check In this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown. HTML <p>My friends is coming to the party tonight.</p> CSS ::grammar-error { text-decoration: underline red; color: red; } Result Specifications Specification Status Comment ...
::marker - CSS: Cascading Style Sheets
Web › CSS › ::marker
The ::marker CSS pseudo-element selects the marker box of a list item, which typically contains a bullet or number. It works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements. ::marker { color: blue; font-size: 1.2em; } Allowable properties Only certain CSS properties can be used in a rule with ::marker as a selector: All font properties The white-space property color text-combine-upright, unicode-bidi and direction properties The content property All animation and transition properties The specification states that additional CSS properties may be supported in future. Syntax ::marker Examples HTML <ul> <li>Peaches</li> <li>Apples</li> <li>Plums</li> </ul> CSS ul li::marker { color: red; font-size: 1.5em; } Resul...
::placeholder - CSS: Cascading Style Sheets
Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default. ...
::selection - CSS: Cascading Style Sheets
The ::selection CSS pseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text). ::selection { background-color: cyan; } Allowable properties Only certain CSS properties can be used with ::selection: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow In particular, background-image is ignored. Syntax /* Legacy Firefox syntax (version 61 and below) */ ::-moz-selection ::selection Examples HTML This text has special styles when you highlight it. <p>Also try selecting text in this paragraph.</p> CSS ::-moz-selection { color: gold; background-color: red; } p::-moz-selection { color: whit...
::spelling-error - CSS: Cascading Style Sheets
The ::spelling-error CSS pseudo-element represents a text segment which the user agent has flagged as incorrectly spelled. Allowable properties Only a small subset of CSS properties can be used in a rule with ::spelling-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::spelling-error Examples Simple document spell check In this example, eventual supporting browsers should highlight any flagged spelling errors with the styles shown. HTML <p contenteditable spellcheck="true">My friends are coegdfgfddffbgning to the party tonight.</p> CSS ::spelling-error { text-decoration: wavy red; } Result Specifications Specification Sta...
: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. 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 agen...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
ntent 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 assistive technology. This is commonly used for buttons that rely solely on an icon to convey purpose. What is an accessible name? | The Paciello Group Hidden content for better a11y | Go Make Things MDN Understanding WCAG, Guideline 2.4 explanations Understanding Success Criterion 2.4.4 | W3C Understanding WCAG 2.0 Specific...
:first - CSS: Cascading Style Sheets
Web › CSS › :first
The :first CSS pseudo-class, used with the @page at-rule, represents the first page of a printed document. (See :first-child for general first element of a node.) /* Selects the first page when printing */ @page :first { margin-left: 50%; margin-top: 50%; } Note: You can't change all CSS properties with this pseudo-class. You can only change the margins, orphans, widows, and page breaks of the document. Furthermore, you may only use absolute-length units when defining the margins. All other properties will be ignored. Syntax :first Examples HTML <p>First Page.</p> <p>Second Page.</p> <button>Print!</button> CSS @page :first { margin-left: 50%; margin-top: 50%; } p { page-break-after: always; } JavaScript document.querySelector("button").addEventListener('click', () => { ...
:left - CSS: Cascading Style Sheets
Web › CSS › :left
in; } Whether a given page is "left" or "right" is determined by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right page; if it has a major writing direction of right-to-left then it will be a :left page. Note: This pseudo-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :left Examples Setting a margin for left-hand pages @page :left { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of ':left' in that specification. Working ...
:right - CSS: Cascading Style Sheets
Web › CSS › :right
in; } Whether a given page is "left" or "right" is determined by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right page; if it has a major writing direction of right-to-left then it will be a :left page. Note: This pseudo-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :right Examples Setting margins for right-hand pages @page :right { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of ':right' in that specification. Worki...
@charset - CSS: Cascading Style Sheets
Web › CSS › @charset
acter; as it is not a nested statement, it cannot be used inside conditional group at-rules. If several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the character set of the HTML page is relevant. @charset "utf-8"; This at-rule is useful when using non-ASCII characters in some CSS properties, like content. 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 u...
system - CSS: Cascading Style Sheets
HTML <ul class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> CSS @counter-style alpha-modified { system: extends lower-alpha; prefix: "("; suffix: ") "; } ul { list-style: al...
@font-face - CSS: Cascading Style Sheets
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. 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 ...
-webkit-animation - CSS: Cascading Style Sheets
imation Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS animations are supported. Apple has a description in Safari CSS Reference. Note: This media feature is only supported by WebKit. If possible, use an @supports feature query instead. Syntax The -webkit-animation media feature is a Boolean whose value is true if the vendor-prefixed CSS animation properties are supported. Values true The browser supports -webkit prefixed CSS animations. false The browser doesn't support these prefixed CSS animations. Examples @media (-webkit-animation) { /* CSS to use if animations are supported */ } Specifications Not part of any standard. ...
forced-colors - CSS: Cascading Style Sheets
-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-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-col...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
10px) or (-ms-perspective: 10px) or (-o-perspective: 10px)) { ... /* CSS applied when 3D transforms, prefixed or not, are supported */ } Testing for the non-support of a specific CSS property @supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) { ... /* CSS to provide fallback alternative for text-align-last: justify */ } Testing for the support of custom properties @supports (--foo: green) { body { color: var(--varName); } } Testing for the support of a selector (eg. :is()) /* This rule won't be applied in browsers which don't support :is() */ :is(ul, ol) > li { ... /* CSS applied when the :is(...) selector is supported */ } @supports not selector(:is(a, b)) { /* Fallback for when :is() is unsupported */ ul > li, ol > li { ... /* ...
Adjacent sibling combinator - CSS: Cascading Style Sheets
The adjacent sibling combinator (+) separates two selectors and matches the second element only if it immediately follows the first element, and both are children of the same parent element. /* Paragraphs that come immediately after any image */ img + p { font-weight: bold; } Syntax former_element + target_element { style properties } Examples CSS li:first-of-type + li { color: red; } HTML <ul> <li>One</li> <li>Two!</li> <li>Three</li> </ul> Result Specifications Specification Status Comment Selectors Level 4The definition of 'next-sibling combinator' in that specification. Working Draft Renames it the "next-sibling" combinator. Selectors Level 3The definition of 'Adjacent sibling combinator' in that specification. Recommendatio...
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
ge, but only implemented in Gecko as of writing) @font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @character-variant) -- Define common names in font-variant-alternates for feature activated differently in OpenType. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing) Conditional group rules Much like the values of properties, each at-rule has a different syntax. Nevertheless, several of them can be grouped into a special category named conditional group rules. These statements share a common syntax and each of them can include nested statements--either rulesets or nested at-rules. Furthermore, they all convey a common semantic meaning--they all link some type of condition, which at any time evaluates to either true o...
CSSOM View - CSS: Cascading Style Sheets
CSSOM View is a module of CSS that lets you manipulate the visual view of a document, in particular its scrolling behavior. Reference Properties scroll-behavior Guides Coordinate systems A guide to the coordinate systems used to specify the position of a location in a display context, whether that context is a window on a monitor, a viewport on a mobile device, or a position on a sheet of paper when printing. Specifications Specification Status Comment CSS Object Model (CSSOM) View Module Working Draft Initial definition. ...
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
ckgrounds to elements. These are layered atop one another with the first background you provide on top and the last background listed in the back. Only the last background can include a background color. Specifying multiple backgrounds is easy: .myclass { background: background1, background 2, ..., backgroundN; } You can do this with both the shorthand background property and the individual properties thereof except for background-color. That is, the following background properties can be specified as a list, one per background: background, background-attachment, background-clip, background-image, background-origin, background-position, background-repeat, background-size. Example In this example, three backgrounds are stacked: the Firefox logo, an image of bubbles, and a linear gradient: HT...
CSS Backgrounds and Borders - CSS: Cascading Style Sheets
Styles in the CSS Backgrounds and Borders module allow filling backgrounds with color or an image (clipped or resized), or modifying them in other ways. These styles can also decorate borders with lines or images, and make them square or rounded. ...
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. ...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
low columns in continuous media display in the block direction, therefore allowing the reader to scroll down to view the next set of columns. Using vertical media queries One issue with multicol on the web is that, if your columns are taller than the viewport, the reader will need to scroll up and down to read, which is not good user experience. One way to avoid this is to only apply the column properties if you know you have enough height. In the example below we have used a min-height query to check the height before applying the column properties. In the final guide in this series we will see how Multicol works with the Fragmentation spec to give us control over how content breaks between columns. ...
Styling Columns - CSS: Cascading Style Sheets
p. 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-rule. These properties work in exactly the same way as the border properties: any valid border-style can 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 ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
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 content breaks between columns. Reference Multiple-column Layout Properties column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns Related CSS Fragmentation Properties break-after break-before break-inside ...
Using feature queries - CSS: Cascading Style Sheets
browser supports this property, then any valid value will do. The value part of the property value pair matters more if you are testing for new values of a particular property. A good example would be the display property. All browsers support display, as display: block dates back to CSS1. However the values display: flex and display: grid are newer. There are often additional values added to properties in CSS, and so the fact that you have to test for property and value means that you can detect support for these values. Testing for lack of support In addition to asking the browser if it supports a feature, you can test for the opposite by adding in the not keyword: @supports not (property: value) { CSS rules to apply } The CSS inside the following example feature query will run if the br...
CSS Counter Styles - CSS: Cascading Style Sheets
CSS Counter Styles is a module of CSS that lets you define your own counter styles. Reference Properties counter-increment counter-reset At-rules @counter-style system additive-symbols negative prefix suffix range pad speak-as fallback Guides Using CSS counters Describes how to use counters to number any HTML element or to perform complex counting. Specifications Specification Status Comment CSS Counter Styles Level 3 Candidate Recommendation Initial definition. ...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
matting context. The behaviour of elements which have a block or inline formatting context is also defined in this specification. For elements with a block formatting context, the spec says: "In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block. The vertical distance between two sibling boxes is determined by the 'margin' properties. Vertical margins between adjacent block-level boxes in a block formatting context collapse. In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch)." - 9.4.1 For elements with an inline formatting context: "In an inline formatting context, boxes are laid out horizontally, one after the other,...
CSS Generated Content - CSS: Cascading Style Sheets
CSS Generated Content is a module of CSS that defines how to add content to an element. Generated content can be used to add content to anonymous replaced elements or replace the content of a DOM node in very limited circumstances with a generated value. See the how to guide for generated content to learn more, and the content and quotes properties for implementation information. Reference Properties content quotes Specifications Specification Status Comment CSS Generated Content Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation Initial definition ...
Subgrid - CSS: Cascading Style Sheets
place into ten grid cells. As the subgrid is on both dimensions there is nowhere for the extra two items to go and so they go into the last track of the grid, as defined in the specification. If we remove the grid-template-rows value we enable regular creation of implicit tracks and, although these won't line up with the tracks of the parent, as many as are required will be created. The gap properties and subgrid If you have a gap, column-gap, or row-gap specified on the parent, this will be passed into the subgrid, so it will have the same spacing between tracks as the parent. In some situations however you may wish the subgrid tracks to have a different gap or no gap. This can be achieved by using the gap-* properties on the grid container of the subgrid. You can see this in the example be...
CSS Grid Layout - CSS: Cascading Style Sheets
y: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows: minmax(100px, auto); } .one { grid-column: 1 / 3; grid-row: 1; } .two { grid-column: 2 / 4; grid-row: 1 / 3; } .three { grid-column: 1; grid-row: 2 / 5; } .four { grid-column: 3; grid-row: 3; } .five { grid-column: 2; grid-row: 4; } .six { grid-column: 3; grid-row: 4; } Reference CSS properties grid-template-columns grid-template-rows grid-template-areas grid-template grid-auto-columns grid-auto-rows grid-auto-flow grid grid-row-start grid-column-start grid-row-end grid-column-end grid-row grid-column grid-area row-gap column-gap gap CSS functions repeat() minmax() fit-content() CSS data types <flex> Glossary entries Grid Grid Lines Grid Tra...
CSS Images - CSS: Cascading Style Sheets
CSS Images is a module of CSS that defines what types of images can be used (the <image> type, containing URLs, gradients and other types of images), how to resize them and how they, and other replaced content, interact with the different layout models. Reference Properties image-orientation image-rendering image-resolution object-fit object-position Functions linear-gradient() radial-gradient() repeating-linear-gradient() repeating-radial-gradient() conic-gradient() repeating-conic-gradient() url() element() image() cross-fade() Data types <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. Implementing image sprites in CSS Describes the common technique grouping several images ...
CSS Masking - CSS: Cascading Style Sheets
CSS Masking is a CSS module that defines means, including masking and clipping, for partially or fully hiding portions of visual elements. Reference Properties clip clip-path clip-rule mask mask-border mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size mask-type Specifications Specification Status Comment CSS Masking Module Level 1 Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'mask' in that specification. Recommendation Initial definition ...
CSS Miscellaneous - CSS: Cascading Style Sheets
These pages contain CSS properties that are highly experimental or don't fit in any other categories. Reference Properties all text-rendering Guides None. Specifications These properties are mostly unrelated to each other. Consult their individual pages for specifications. ...
CSS Motion Path - CSS: Cascading Style Sheets
, and can choose to rotate it at any point using offset-rotate. Basic example <div id="motion-demo"></div> #motion-demo { offset-path: path('M20,20 C20,100 200,0 200,100'); animation: move 3000ms infinite alternate ease-in-out; width: 40px; height: 40px; background: cyan; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } Reference Properties offset offset-anchor offset-distance offset-path offset-position offset-rotate Specifications Specification Status Comment Motion Path Module Level 1 Working Draft Initial definition. ...
CSS Paged Media - CSS: Cascading Style Sheets
Web › CSS › CSS Pages
CSS Paged Media is a module of CSS that defines how page switches are handled. ...
Stacking context example 2 - CSS: Cascading Style Sheets
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. ...
CSS Positioned Layout - CSS: Cascading Style Sheets
CSS Positioned Layout is a module of CSS that defines how to position elements on the page. Reference CSS properties bottom clear float left position right top z-index Guides Understanding CSS z-index Presents the notion of stacking context and explains how z-ordering works, with several examples. Specifications Specification Status Comment CSS Positioned Layout Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation ...
CSS Ruby Layout - CSS: Cascading Style Sheets
Web › CSS › CSS Ruby
CSS Ruby Layout is a module of CSS that provides the rendering model and formatting controls related to the display of ruby annotation. ...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
The scroll-snap-type property is used on the scroll container to state the type and direction of scrolling. ...
CSS Shapes - CSS: Cascading Style Sheets
lines to wrap round the shape rather than following the rectangle of the element's box. Basic example The example below shows an image that has been floated left, and the shape-outside property applied with a value of circle(50%). This creates a circle shape, and the content wrapping the float now wraps around that shape. This changes the length of the wrapping text's line boxes. ...
CSS Table - CSS: Cascading Style Sheets
Web › CSS › CSS Table
CSS Table is a CSS module that defines how to lay out table data. ...
CSS Text - CSS: Cascading Style Sheets
Web › CSS › CSS Text
CSS Text is a module of CSS that defines how to perform text manipulation, like line breaking, justification and 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 Text Decoration - CSS: Cascading Style Sheets
CSS Text Decoration is a module of CSS that defines features relating to text decoration, such as underlines, text shadows, and emphasis marks. Reference Properties letter-spacing text-align text-decoration text-decoration-color text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing Guides None. Examples .under { text-decoration: underline red; } .over { text-decoration: wavy overline lime; } .line { text-decoration: line-through; } .plain { text-decoration: none; } .underover { text-decoration: dashed underline overline; } .thick { text-...
CSS Transforms - CSS: Cascading Style Sheets
CSS Transforms is a module of CSS that defines how elements styled with CSS can be transformed in two-dimensional or three-dimensional space. Reference Properties backface-visibility perspective perspective-origin rotate scale transform transform-box transform-origin transform-style translate Data types <transform-function> Guides Using CSS transforms Step-by-step tutorial about how to transform elements styled with CSS. Specifications Specification Status Comment CSS Transforms Level 1 Working Draft Initial definition. CSS Transforms Level 2 Editor's Draft Adds individual transforms. ...
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. ...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
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 ">". ...
CSS Writing Modes - CSS: Cascading Style Sheets
CSS Writing Modes is a CSS module that defines various international writing modes, such as left-to-right (e.g. used by Latin and Indic scripts), right-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
Child combinator - CSS: Cascading Style Sheets
argin: 2em; } Elements matched by the second selector must be the immediate children of the elements matched by the first selector. This is stricter than the descendant combinator, which matches all elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the number of "hops" up the DOM. Syntax selector1 > selector2 { style properties } Examples CSS span { background-color: white; } div > span { background-color: DodgerBlue; } HTML <div> <span>Span #1, in the div. <span>Span #2, in the span that's in the div.</span> </span> </div> <span>Span #3, not in the div at all.</span> Result Specifications Specification Status Comment Selectors Level 4The definition of 'child combina...
Column combinator - CSS: Cascading Style Sheets
The column combinator (||) is placed between two CSS selectors. It matches only those elements matched by the second selector that belong to the column elements matched by the first. ...
Compositing and Blending - CSS: Cascading Style Sheets
Compositing and Blending is a CSS module that defines how shapes of different elements are combined into a single image. ...
Filter Effects - CSS: Cascading Style Sheets
Filter Effects is a module of CSS that defines a way of processing an element's rendering before it is displayed in the document. Reference Properties backdrop-filter filter Data types <filter-function> Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'filter' in that specification. Working Draft Initial definition. ...
General sibling combinator - CSS: Cascading Style Sheets
The general sibling combinator (~) separates two selectors and matches the second element only if it follows the first element (though not necessarily immediately), and both are children of the same parent element. /* Paragraphs that are siblings of and subsequent to any image */ img ~ p { color: red; } Syntax former_element ~ target_element { style properties } Examples CSS p ~ span { color: red; } HTML <span>This is not red.</span> <p>Here is a paragraph.</p> <code>Here is some code.</code> <span>And here is a red span!</span> <code>More code...</code> <span>And this is a red span!</span> Result Specifications Specification Status Comment Selectors Level 4The definition of 'subsequent-sibling combinator' in that specification. Working Draft ...
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 ...
Inline formatting context - CSS: Cascading Style Sheets
the split occurs. In the next example there is a (<span>) element wrapping a set of words wrapping onto two lines. The border on the <span> breaks at the wrapping point. Margins, borders, and padding in the 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 writin...
Column layouts - CSS: Cascading Style Sheets
th equal heights -- flexbox Flexbox can be used to break content into columns by setting flex-direction to row, however flexbox targets the elements inside the flex container and will place each direct child into a new column. This is a different behavior to what you saw with multicol. There is currently no way to add a rule between flex items, and browser support for the column-gap and row-gap properties is limited. Therefore to create gaps between items use a margin. Download this example Flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-wrap property on the container to wrap. These new flex lines will distribute space along that line only -- the items in the new line will not line up with items in the line above, as you'll see in the e...
Layout mode - CSS: Cascading Style Sheets
normal flow wrapping around it. Positioned layout, designed for positioning elements without much interaction with other elements. Multi-column layout, designed for laying content out in columns as in a newspaper. Flexible box layout, designed for laying out complex pages that can be resized smoothly. Grid layout, designed for laying out elements relative to a fixed grid. Note: Not all CSS properties apply to all layout modes. Most of them apply to one or two of them and have no effect if they are set on an element participating in another layout mode. ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
Microsoft applications such as Edge and Internet Explorer support a number of special Microsoft extensions to CSS. These extensions are prefixed with -ms-. Microsoft-only properties (avoid using on websites) Note: These properties will only work in Microsoft applications, and are not on a standards track. -ms-accelerator -ms-block-progression -ms-content-zoom-chaining -ms-content-zooming -ms-content-zoom-limit -ms-content-zoom-limit-max -ms-content-zoom-limit-min -ms-content-zoom-snap -ms-content-zoom-snap-points -ms-content-zoom-snap-type -ms-filter -ms-flow-from -ms-flow-into -ms-high-contrast-adjust -ms-hyphenate-limit-chars -ms-hyphenate-limit-lines -ms-hyphenate-limit-zone -ms-ime-align -ms-overflow-style -ms-scrollbar-3dlight-color -ms-scrollbar-arrow-color ...
Privacy and the :visited selector - CSS: Cascading Style Sheets
ments and the element being matched is different from the link whose presence in history is being tested, the element will be rendered as if the link were unvisited, as well. Limits to visited link styles You can style visited links, but there are limits to which styles you can use. Only the following styles can be applied to visited links: color background-color border-color (and its sub-properties) column-rule-color outline-color The color parts of 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 do...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
The algorithm, in summary The algorithm can for the most part be summarized by these four rules. ...
Selector list - CSS: Cascading Style Sheets
h1, h2, h3, h4, h5, h6 { font-family: helvetica; } Multi Line Grouping Grouping selectors in a multiple lines using a comma-separated lists. ...
Type selectors - CSS: Cascading Style Sheets
The CSS type selector matches elements by node name. In other words, it selects all elements of the given type within a document. /* All <a> elements. */ a { color: red; } Syntax element { style properties } Examples CSS span { background-color: skyblue; } HTML <span>Here's a span with some text.</span> <p>Here's a p with some text.</p> <span>Here's a span with more text.</span> Result Specifications Specification Status Comment Selectors Level 4The definition of 'Type (tag name) selector' in that specification. Working Draft No changes Selectors Level 3The definition of 'type selectors' in that specification. Recommendation No changes CSS Level 2 (Revision 1)The definition of 'type selectors' in that specification. Re...
Universal selectors - CSS: Cascading Style Sheets
For instance, *.warning and .warning are equivalent. ...
<angle> - CSS: Cascading Style Sheets
Web › CSS › angle
. Syntax The <angle> data type consists of a <number> followed by one of the units listed below. As with all dimensions, there is no space between the unit literal and the number. The angle unit is optional after the number 0. Optionally, it may be preceded by a single + or - sign. Positive numbers represent clockwise angles, while negative numbers represent counterclockwise angles. For static properties of a given unit, any angle can be 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...
animation-delay - CSS: Cascading Style Sheets
ater, immediately from its beginning, or immediately and partway through the animation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often convenient to use the shorthand property animation to set all animation properties at once. Syntax /* Single animation */ animation-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 po...
animation-direction - CSS: Cascading Style Sheets
ackward, or alternate back and forth between playing the sequence forward and backward. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often convenient to use the shorthand property animation to set all animation properties at once. Syntax /* Single animation */ animation-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; Va...
animation-duration - CSS: Cascading Style Sheets
ion CSS property sets the length of time that an animation takes to complete one 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. 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 val...
animation-iteration-count - CSS: Cascading Style Sheets
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. 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 ...
animation-name - CSS: Cascading Style Sheets
ore @keyframes at-rules describing the animation or animations to apply to 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. 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 ke...
background-clip - CSS: Cascading Style Sheets
ent 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. Syntax /* Keyword values */ backgroun...
background-image - CSS: Cascading Style Sheets
nd us a pull request. The background images are drawn on stacking context layers on top of each other. The first layer specified is drawn as if it is closest to the 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 backgroun...
<basic-shape> - 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 The <basic-shape> data type is defined with one of the basic shape functions listed below. When creating a shape, the reference box is defined by each property that uses <basic-shape> values. ...
<blend-mode> - CSS: Cascading Style Sheets
Syntax The <blend-mode> data type is defined using a keyword value chosen from the list below. Values normal The final color is the top color, regardless of what the bottom color is. The effect is like two opaque pieces of paper overlapping. ...
border-block-color - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
border-block-width - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
border-bottom-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. ...
border-end-end-radius - CSS: Cascading Style Sheets
Editor's Draft Initial definition. ...
border-end-start-radius - CSS: Cascading Style Sheets
Editor's Draft Initial definition. ...
border-inline-color - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
border-inline-width - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
border-left-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. ...
border-right-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. ...
border-start-end-radius - CSS: Cascading Style Sheets
Editor's Draft Initial definition. ...
border-start-start-radius - CSS: Cascading Style Sheets
Editor's Draft Initial definition. ...
border-top-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. ...
box-decoration-break - CSS: Cascading Style Sheets
ecifies 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 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...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
This is a property for controlling parts of the XUL box model. It does not match either the old CSS Flexible 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: uns...
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
The effect of this is only visible if there is extra space in the box. ...
break-after - CSS: Cascading Style Sheets
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. If more than one of them are such a break, the one...
break-before - CSS: Cascading Style Sheets
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. If more than one of them are such a break, the one...
caption-side - CSS: Cascading Style Sheets
Editor's Draft Defines the top and bottom values as relative to the writing-mode value. CSS Level 2 (Revision 1)The definition of 'caption-side' in that specification. Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data...
clear - CSS: Cascading Style Sheets
Web › CSS › clear
Editor's Draft Adds the values inline-start and inline-end CSS Level 2 (Revision 1)The definition of 'clear' in that specification. Recommendation No significant changes, though details are clarified. CSS Level 1The definition of 'clear' in that specification. Recommendation Initial de...
color - CSS: Cascading Style Sheets
Web › CSS › 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. ...
column-count - CSS: Cascading Style Sheets
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. Syntax /* Keyword value */ column-count: auto; /* <integer> value */ column-count: 3; /* Global values */ column-count: inherit; column-count: initial; column-count: unset; Values auto The number of columns is determined by other CSS properties, such as column-width. <integer> Is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed. If the column-width is also set to a non-auto value, it merely indicates the maximum allowed number of columns. Formal definition Initial valueautoApplies toBlock containers except table wrapper boxesInheritednoComputed valueas specifi...
column-width - CSS: Cascading Style Sheets
isted below. Values <length> Indicates the optimal column width. The actual column width may differ from the specified value: it may be wider when necessary to fill available space, and narrower when the available space is too small. The value must be strictly positive or the declaration is invalid. Percentage values are also invalid. auto The width of the column is determined by other CSS properties, such as column-count. Formal definition Initial valueautoApplies toBlock containers except table wrapper boxesInheritednoComputed valuethe absolute length, zero or largerAnimation typea length Formal syntax <length> | auto Examples Setting column width in pixels HTML <p class="content-box"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ...
Computed value - CSS: Cascading Style Sheets
uted 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 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 use...
conic-gradient() - CSS: Cascading Style Sheets
nt it applies to, or size of the <image> is set to something other than the element size. To create a conic gradient that repeats so as to fill a 360 degree rotation, use the repeating-conic-gradient() function instead. Because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. For this reason, conic-gradient() won't work on background-color and other properties that use the <color> data type. Why is it called a "conic" gradient? If the color stops are much lighter on one side than the other, it can look like a cone from above. Composition of a conic gradient The conic-gradient syntax is similar to the radial-gradient syntax, but the color-stops are placed around a gradient arc, the circumference of a circle, rather than on the gradient line emergin...
contain - CSS: Cascading Style Sheets
Web › CSS › contain
to contain: size layout paint. content Indicates that all containment rules except size and style are applied to the element. This is equivalent to contain: layout paint. size Indicates that the element can be sized without the need to examine its descendants' sizes. layout Indicates that nothing outside the element may affect its internal layout and vice versa. style Indicates that, for properties that can have effects on more than just an element and its descendants, those effects don't escape the containing element. Note that this value is marked "at-risk" in the spec and may not be supported everywhere. paint Indicates that descendants of the element don't display outside its bounds. If the containing box is offscreen, the browser does not need to paint its contained elements -- these...
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
where 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. 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, initia...
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
ified. /* Simple usage - style defaults to decimal */ counters(countername, '-'); /* changing the counter display */ counters(countername, '.', upper-roman) A counter has no visible effect by itself. The counters() function (and counter() function) is what makes it useful by returning developer defined content. Note: The counters() 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 counters, 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, initi...
direction - CSS: Cascading Style Sheets
Web › CSS › direction
e unicode-bidi property. It also sets the default alignment of text, block-level elements, and the direction that 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 ...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
tch 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 outer and an inner display type. The outer display type describes whether the element is block-level or inline-level. The inner display type describes how the children of that box behave. As a...
<display-inside> - CSS: Cascading Style Sheets
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 the formatting root l...
<display-listitem> - CSS: Cascading Style Sheets
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. ...
<easing-function> - CSS: Cascading Style Sheets
time ratio to an output ratio, both expressed as <number>s. For these values, 0.0 represents the initial state, and 1.0 represents the final state. Depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. This causes the animation to go farther than the final state, and then return. For some properties, such as left or right, this creates a kind of "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: l...
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. ...
<filter-function> - CSS: Cascading Style Sheets
Syntax The <filter-function> data type is specified using one of the filter functions listed below. Each function requires an argument which, if invalid, results in no filter being applied. blur() Blurs the image. brightness() Makes the image brighter or darker. contrast() Increases or decreases the image's contrast. drop-shadow() Applies a drop shadow behind the image. grayscale() Converts the image to grayscale. ...
filter - CSS: Cascading Style Sheets
Web › CSS › filter
fied as none or one or more of the functions listed below. If the parameter for any function is invalid, the function returns none. Except where noted, the functions that take a value expressed with a percent sign (as in 34%) also accept the value expressed as decimal (as in 0.34). When a single filter property has two or more functions it's results will be different from when two or more filter properties are separately applied with the same functions. SVG filter url() Takes an URI pointing to an SVG filter, which may be embedded in an external XML file. filter: url(resources.svg#c1) Filter functions blur() The blur() fucntion applies a Gaussian blur to the input image. The value of radius defines the value of the standard deviation to the Gaussian function, or how many pixels on the scree...
flex-grow - CSS: Cascading Style Sheets
Web › CSS › flex-grow
dependent on the flex-direction value. 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. 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 a...
flex-shrink - 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. ...
flex-wrap - CSS: Cascading Style Sheets
Web › CSS › flex-wrap
items are forced onto one line or can wrap onto multiple lines. If 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 t...
<flex> - CSS: Cascading Style Sheets
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. ...
float - CSS: Cascading Style Sheets
Web › CSS › float
ft; background: pink; } .right { float: right; background: cyan; } Result Clearing floats Sometimes you may want to force an item to move below any floated elements. For instance, you may want paragraphs to remain adjacent to floats, but force headings to be on their own line. See clear for examples. Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'float and clear' in that specification. Editor's Draft Adds the values inline-start and inline-end. CSS Level 2 (Revision 1)The definition of 'float' in that specification. Recommendation No change CSS Level 1The definition of 'float' in that specification. Recommendation Initial definition ...
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
uld specify 0.75em (because 12/16 = 0.75). Similarly, if you want a font size of 10px, then specify 0.625em (10/16 = 0.625); for 22px, specify 1.375em (22/16). The em is a very useful unit in CSS, since it automatically adapts its length relative to the font that the reader chooses to use. em and ex units on the font-size property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em units and percentages do the same thing for font-size. One important fact to keep in mind: em values compound. Take the following HTML and CSS: html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6em; } <div> <span>Outer <span>inner</span> outer</span> </div> The resu...
<frequency> - CSS: Cascading Style Sheets
Web › CSS › frequency
Syntax The <frequency> data type consists of a <number> followed by one of the units listed below. As with all CSS dimensions, there is no space between the unit literal and the number. Units Hz Represents a frequency in hertz. Examples: 0Hz, 1500Hz, 10000Hz. kHz Represents a frequency in kilohertz. Examples: 0kHz, 1.5kHz, 10kHz. Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0Hz or 0kHz. ...
grid-auto-columns - CSS: Cascading Style Sheets
the track size is clamped at argument if it is greater than the auto minimum. auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. Note: auto track sizes (and only auto track sizes) can be streched by the align-content and justify-content properties. Formal definition Initial valueautoApplies togrid containersInheritednoPercentagesrefer to corresponding dimension of the content areaComputed valuethe percentage as specified or the absolute lengthAnimation typediscrete Formal syntax <track-size>+where <track-size> = <track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )where <trac...
grid-auto-rows - CSS: Cascading Style Sheets
content, if the grid container is sized under a minimal content constraint). auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. Note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties. Formal definition Initial valueautoApplies togrid containersInheritednoPercentagesrefer to corresponding dimension of the content areaComputed valuethe percentage as specified or the absolute lengthAnimation typediscrete Formal syntax <track-size>+where <track-size> = <track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )where <trac...
grid-template-areas - CSS: Cascading Style Sheets
s, establishing the cells in the grid and assigning them names. The source for this interactive example is stored in a GitHub repository. If you'd like to 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;...
grid-template-columns - CSS: Cascading Style Sheets
um, a <flex> value sets the track's flex factor. It is invalid as a minimum. auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. Note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties. fit-content( [ <length> | <percentage> ] ) Represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) Represents a repeated fragment of the track list, allowi...
grid-template-rows - CSS: Cascading Style Sheets
um, a <flex> value sets the track's flex factor. It is invalid as a minimum. auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. Note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties. fit-content( [ <length> | <percentage> ] ) Represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) Represents a repeated fragment of the track list, allowi...
height - CSS: Cascading Style Sheets
Web › CSS › height
rty defines the height of the content area. If box-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 calcula...
image-rendering - CSS: Cascading Style Sheets
The user agent will scale an image when the page 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 100x100px, but its actual dimensions are 200x200px (or 50x50px), then the image will be upscaled (or downscaled) using the algorithm specified by image-rendering. This property has no effect on non-scaled images. ...
<image> - CSS: Cascading Style Sheets
Web › CSS › image
spect ratio most similar to the containing box.) Images with no intrinsic dimensions but with an intrinsic aspect ratio between its width and height, like an SVG or other vector format. Images with neither intrinsic dimensions, nor an intrinsic aspect ratio, like a CSS gradient. ...
image() - CSS: Cascading Style Sheets
under or behind all the background images, this can be used to put (generally semi-transparent) colors over other images. The size of the color swatch can be set with the background-size property. This is different from the background-color, which sets a color to cover the entire element. Both image(color) and background-color placements are impacted by the background-clip and background-origin properties. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the d...
inherit - CSS: Cascading Style Sheets
Web › CSS › inherit
The inherit CSS keyword causes the element for which it is specified to take the computed value of the property from its parent element. 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. Examples Exclude selected elements from a rule /* Make second-level headers green */ h2 { color: green; } /* ...but leave those in the sidebar alone so they use their parent's color */...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
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. ...
isolation - CSS: Cascading Style Sheets
Web › CSS › isolation
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 valueautoApplies toAll elements. In SVG, it applies to container elements, graphics elements, and graphics referencing elements.InheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | isolate Examples Forcing a new stacking context for an element HTML <...
<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() Where a <...
linear-gradient() - CSS: Cascading Style Sheets
ze, nor a preferred ratio. Its concrete size will match the size of the element it applies to. To create a linear gradient that repeats so as to fill its container, use the repeating-linear-gradient() function instead. Because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. For this reason, linear-gradient() won't work on background-color and other properties that use the <color> data type. Composition of a linear gradient A linear gradient is defined by an axis--the gradient line--and two or more color-stop points. Each point on the axis is a distinct color; to create a smooth gradient, the linear-gradient() function draws a series of colored lines perpendicular to the gradient line, each one matching the color of the point where it intersects the ...
margin-block-end - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
margin-block-start - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
margin-inline-end - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
margin-inline-start - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
mask-border-outset - CSS: Cascading Style Sheets
ment's border box -- you can use it to make the mask start from part way across the border, rather than the inside of it. mask-border-outset: 1rem; Chromium-based browsers support an outdated version of this property -- mask-box-image-outset -- with a prefix: -webkit-mask-box-image-outset: 1rem; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-outset' in that specification. Candidate Recommendation Initial definition ...
mask-border-repeat - CSS: Cascading Style Sheets
-- i.e. will it just repeat, or be scaled slightly so a whole number of slices fits, or be stretched so one slice fits? mask-border-repeat: round; Chromium-based browsers support an outdated version of this property -- mask-box-image-repeat -- with a prefix: -webkit-mask-box-image-repeat: round; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-repeat' in that specification. Candidate Recommendation Initial definition ...
mask-border-source - CSS: Cascading Style Sheets
et. When it eventually starts to be supported, it will serve to define the source of the border mask. mask-border-source: url(image.jpg); Chromium-based browsers support an outdated version of this property -- mask-box-image-source -- with a prefix: -webkit-mask-box-image-source: url(image.jpg); Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-source' in that specification. Candidate Recommendation Initial definition ...
mask-border-width - CSS: Cascading Style Sheets
mask -- setting this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; Chromium-based browsers support an outdated version of this property -- mask-box-image-width -- with a prefix: -webkit-mask-box-image-width: 20px; Note: The mask-border page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask-border-width' in that specification. Candidate Recommendation Initial definition ...
minmax() - CSS: Cascading Style Sheets
Web › CSS › minmax
tion of the grid items occupying the grid track. auto As a maximum, identical to max-content. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. ...
object-fit - CSS: Cascading Style Sheets
background-size ...
object-position - CSS: Cascading Style Sheets
...
offset-path - CSS: Cascading Style Sheets
The path, as can be seen in the rendering of the SVG code, is a line drawing of a house with a chimney. SVG The top and bottom halves of the scissors would appear in the top left of the canvas were they not positioned along the starting point of the motion path defined by offset-path. <svg xmlns="...
Guide to scroll anchoring - CSS: Cascading Style Sheets
here 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 reading Explainer document on th...
padding-block-end - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
padding-block-start - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
padding-inline-end - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
padding-inline-start - CSS: Cascading Style Sheets
Editor's Draft Initial definition ...
page-break-after - CSS: Cascading Style Sheets
Editor's Draft Adds the values recto and verso. CSS Paged Media Module Level 3The definition of 'page-break-after' in that specification. Working Draft Extends the element that this property applies to table rows and table row groups. CSS Level 2 (Revision 1)The definition of 'page-break-aft...
page-break-before - CSS: Cascading Style Sheets
Editor's Draft Adds the values recto and verso. CSS Paged Media Module Level 3The definition of 'page-break-before' in that specification. Working Draft Extends the element that this property applies to table rows and table row groups. CSS Level 2 (Revision 1)The definition of 'page-break-be...
paint-order - CSS: Cascading Style Sheets
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 shapes involving the use of the marker-* properties (e.g. marker-start) and <marker> element. They do not apply to HTML text, so in that case, you can only determine the order of stroke and fill. Values normal Paint the different items in normal paint order. stroke, fill, markers Specify some or all of these values in the order you want them to be painted in. Formal definition Initial valuenormalApplies totext elementsInheritedyesComp...
paint() - CSS: Cascading Style Sheets
Web › CSS › paint
0); background-image: paint(hollowHighlights, stroke, 2px); } li:nth-of-type(3n) { --boxColor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowHighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxColor: hsla(255, 90%, 60%, 1.0); background-image: paint(hollowHighlights, stroke, 1px); } We've included a custom property in the selector block defining a boxColor. Custom properties are accessible to the PaintWorklet. Specifications Specification Status Comment CSS Painting API Level 1The definition of 'Paint Notation' 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...
<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, valu...
perspective-origin - CSS: Cascading Style Sheets
CSS property determines the position at which the viewer is looking. It is used as the vanishing point by the perspective 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 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-...
radial-gradient() - CSS: Cascading Style Sheets
ze, nor a preferred ratio. Its concrete size will match the size of the element it applies to. To create a radial gradient that repeats so as to fill its container, use the repeating-radial-gradient() function instead. Because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. For this reason, radial-gradient() won't work on background-color and other properties that use the <color> data type. Composition of a radial gradient A radial gradient is defined by a center point, an ending shape, and two or more color-stop points. To create a smooth gradient, the radial-gradient() function draws a series of concentric shapes radiating out from the center to the ending shape (and potentially beyond). The ending shape may be either a circle or an ellipse. Col...
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. /* <track-repeat> values */ repeat(4, 1fr) repeat(4, [col-start] 250px [col-end]) repeat(4, [col-start] 60% [col-end]) repeat(4, [col-start] 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]) ...
repeating-conic-gradient() - CSS: Cascading Style Sheets
no natural or preferred size, nor a preferred ratio. Its concrete size will match the size of the element it applies to, or the size the <image> is set to if it's set to something other than the element's size. Because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. For this reason, repeating-conic-gradient() won't work on background-color and other properties that use the <color> data type. To create a conic gradient that doe not repeat, make the gradient a full 360 degree rotation, or use the conic-gradient() function instead. Understanding repeating conic gradients The repeating-conic-gradient syntax is similar to the conic-gradient() and repeating-radial-gradient() syntax. Like the non-repeating conic-gradient, the color-stops are placed arou...
repeating-linear-gradient() - CSS: Cascading Style Sheets
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> data type, they can only be used where <image>s can be used. For this reason, repeating-linear-gradient() won't work on background-color and other properties that use the <color> data type. Syntax /* A repeating gradient tilted 45 degrees, starting blue and finishing red, repeating 3 times */ repeating-linear-gradient(45deg, blue, red 33.3%); /* A repeating gradient going from the bottom right to the top left, starting blue and finishing red, repeating every 20px */ repeating-linear-gradient(to left top, blue, red 20px); /* A gradient going ...
repeating-radial-gradient() - CSS: Cascading Style Sheets
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 type, they can only be used where <image>s can be used. For this reason, repeating-radial-gradient() won't work on background-color and other properties that use the <color> data type. Syntax /* A gradient at the center of its container, starting red, changing to blue, and finishing green, with the colors repeating every 30px */ repeating-radial-gradient(circle at center, red 0, blue, green 30px); /* An elliptical gradient near the top left of its container, starting red, changing to green and back again, repeating five times betwe...
resize - CSS: Cascading Style Sheets
Web › CSS › resize
This paragraph is resizable in all directions, because the CSS `resize` property is set to `both` on this element. </p> </div> CSS .resizable { resize: both; overflow: scroll; border: 1px solid black; } div { height: 300px; width: 300px; } p { height: 200px; width: 200px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'resize' in that specification. Editor's Draft Adds the values block and inline. CSS Basic User Interface Module Level 3The definition of 'resize' in that specification. Recommendation Initial definition. ...
right - CSS: Cascading Style Sheets
Web › CSS › right
When position is set to relative, the right property specifies the distance the element's right edge is moved to the left from its normal position. When position is set to sticky, the right property is used to compute the sticky-constraint rectangle. When position is set to static, the right property has no effect. When both left and right are defined, if not prevented from doing so by other properties, the element will stretch to satisfy both. If the element cannot stretch to satisfy both -- for example, if a width is declared -- the position of the element is over-constrained. When this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left. Formal definition Initial valueautoApplies topositioned ele...
scroll-margin-block - CSS: Cascading Style Sheets
The scroll-margin-block shorthand property sets the scroll margins of an element in the block dimension. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constituent properties This property is a shorthand for the following CSS properties: scroll-margin-block-end scroll-margin-block-start Syntax /* <length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* Global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; Values <length> An outset from the corresponding edge of the scroll container. Description The scroll-margin values represent ...
scrollbar-color - CSS: Cascading Style Sheets
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 scrollbar, in the absence of any other related scrollbar color properties. dark Show a dark scrollbar, which can be either a dark variant of scrollbar provided 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...
Specified value - CSS: Cascading Style Sheets
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: green; } Result Speci...
<string> - CSS: Cascading Style Sheets
Web › CSS › string
Syntax The <string> data type is composed of any number of Unicode characters surrounded by either double (") or single (') quotes. Most characters can be represented literally. All characters can also be represented with their respective Unicode code points in hexadecimal, in which case they are preceded by a backslash (\). For example, \22 represents a double quote, \27 a single quote ('), and \A9 the copyright symbol ((C)). Importantly, certain characters which would otherwise be invalid can be escaped with a backslash. ...
text-align - CSS: Cascading Style Sheets
Editor's Draft No changes CSS Text Module Level 4The definition of 'text-align' in that specification. Editor's Draft Added the <string> value. CSS Text Module Level 3The definition of 'text-align' in that specification. Working Draft Added the start, end, and match-parent values. Changed t...
text-decoration-color - CSS: Cascading Style Sheets
...
text-orientation - CSS: Cascading Style Sheets
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. use-glyph-orientation On SVG elements, this keyword leads to use the value of the deprecated SVG properties glyph-orientation-vertical and glyph-orientation-horizontal. Formal definition Initial valuemixedApplies toall elements, except table row groups, rows, column groups, and columnsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax mixed | upright | sideways Examples HTML <p>Lorem ipsum dolet semper quisquam.</p> CSS p { writing-mode: vertical-rl; text-orientati...
<time-percentage> - CSS: Cascading Style Sheets
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. Valid percentages 50% +50% Optional plus sign -50% Negative percentages are not valid for all properties that accept percentages Invalid percentages 50 % Space not allowed between the space and the percentage sign Valid times 12s Positive integer -456ms Negative integer 4.3ms Non-integer 14mS The unit is case-insensitive, although capital letters are not recommended. +0s Zero with a leading + and a unit -0ms Zero with a leading - and a unit Inval...
<time> - CSS: Cascading Style Sheets
Web › CSS › time
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. ...
transform-box - CSS: Cascading Style Sheets
/* Keyword values */ transform-box: content-box; transform-box: border-box; transform-box: fill-box; transform-box: stroke-box; transform-box: view-box; /* Global values */ transform-box: inherit; transform-box: initial; transform-box: unset; Syntax The transform-box property is specified as one of the keyword values listed below. Values content-box The content box is used as the reference 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. ...
perspective() - CSS: Cascading Style Sheets
ype. The source for this interactive example is stored in a GitHub repository. If 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 in a 2-dimensional view, or the screen. A positive value makes the element appear closer to the user than the r...
transition-delay - CSS: Cascading Style Sheets
on effect immediately. A positive value will delay the start of the transition effect for the given length of time. A negative value will begin the transition effect immediately, and partway through the effect. In other words, the effect will be animated as if it had already been running for the given length of time. You may specify multiple delays, which is useful when transitioning multiple properties. Each delay will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. If there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. If there are more delays, the list of delay values will be truncated to match the number of properties. In both cases, the CSS declarat...
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. ...
unicode-bidi - CSS: Cascading Style Sheets
r with the direction property, determines how bidirectional text in a document is handled. For example, if a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex Unicode algorithm to 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 */ ...
<url> - CSS: Cascading Style Sheets
Web › CSS › url
URI or URL? There is a difference between a URI and a URL. A URI simply identifies a resource. A URL is a type of URI, and describes the location of a resource. A URI can be either a URL or a name (URN) of a resource. 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, whether a URL or a URN. Confusingly, this meant that url() could be used to create a <uri> CSS data type. ...
width - CSS: Cascading Style Sheets
Web › CSS › width
ement's width. By default, it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The min-width and max-width properties override width. Syntax /* <length> values */ width: 300px; width: 25em; /* <percentage> value */ width: 75%; /* Keyword values */ width: max-content; width: min-content; width: fit-content(20em); width: auto; /* Global values */ width: inherit; width: initial; width: unset; The width property is specified as either: one of the following keyword values: min-content, max-content, fit-cont...
CSS: Cascading Style Sheets
Web › CSS
ference: 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 can be used, and the choices...
Demos of open web technologies
Web Audio Fireworks IoQuake3 (source code) Escher puzzle (source code) Kai 'Opua (source code) Virtual Reality The Polar Sea (source code) Sechelt fly-through (source code) CSS CSS Zen Garden CSS floating logo "mozilla" Paperfold CSS Blockout Rubik's cube Pure CSS Slides Planetarium (source code) Loader with blend modes Text reveal with clip-path Ambient shadow with custom properties Luminiscent vial CSS-based single page application (source code) Transformations Impress.js (source code) Games IoQuake3 (source code) Kai 'Opua (source code) Web APIs Notifications API HTML5 Notifications (source code) Web Audio API Web Audio Fireworks oscope.js - JavaScript oscilloscope HTML5 Web Audio Showcase (source code) HTML5 Audio Visualizer (source code) ...
Getting Started - Developer guides
make an HTTP request In order to make an HTTP request to the server with JavaScript, you need an instance of an object with the necessary functionality. This is where XMLHttpRequest comes in. Its predecessor originated in Internet Explorer as an ActiveX object called XMLHTTP. Then, Mozilla, Safari, and other browsers followed, implementing an XMLHttpRequest object that supported the methods and properties of Microsoft's original ActiveX object. Meanwhile, Microsoft implemented XMLHttpRequest as well. // Old compatibility code, no longer needed. if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+ ... httpRequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE 6 and older httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } Note: For illustration purposes, the above ...
WAI ARIA Live Regions/API Support - Developer guides
more below) Browser could not calculate this Was the root cause of this event explicit user input? Does not 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...
Writing Web Audio API code that works in every browser - Developer guides
probably 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. Unfortunately, Chrome, Safari and Opera still use the webkitAudioContext prefixed name. Furthermore, as a result of the spec being still in flux, some browsers use deprecated properties and method names that are not present in standards-compliant browsers: Safari uses the old method names, Firefox uses the new ones, and Chrome and Opera use both. In addition, not all features of Web Audio are already implemented in Firefox yet. What do we do!? We don't want to maintain two or more separate code bases, and feature detection code is cumbersome! Plus we want to write code that reli...
Block formatting context - Developer guides
k Formatting Context' in that specification. Recommendation Initial definition. See also float, clear CSS Key Concepts: CSS syntax, at-rule, comments, specificity and inheritance, the box, layout modes and visual formatting models, and margin collapsing, or the initial, computed, resolved, specified, used, and actual values. Definitions of value syntax, shorthand properties and replaced elements. ...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
l 1 and others at level 4, with all the intermediate levels covered. New background styling features It is now possible to put shadows on elements using box-shadow, multiple backgrounds, and CSS filters. You can learn more about these by reading Advanced box effects. More fancy borders Not only it is now possible to use images to style borders, using border-image and its associated longhand properties, but rounded borders are supported via the border-radius property. Animating your style Using CSS Transitions to animate between different states or using CSS Animations to animate parts of the page without a triggering event, you can now control mobile elements on your page. Typography improvement Authors have better control to reach better typography. They can control text-overflow and hyph...
Index - Developer guides
Web › Guide › Index
e browser defaults. The player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. 9 Cross-browser audio basics Apps, Audio, Guide, HTML5, Media, events This article provides: a basic guide to creating a cross-browser HTML5 audio player with all the associated attributes, properties, and events explained a guide to custom controls created using the Media API 10 Live streaming web audio and video Guide, adaptive streaming Live streaming technology is often employed to relay live events such as sports, concerts and more generally TV and Radio programmes that are output live. Often shortened to just streaming, live streaming is the process of transmittin...
Writing forward-compatible websites - Developer guides
hipped 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 support of the unprefixed version of something, its behavior can still change in unexpected ways. Most especially, don't use the unprefixed version if no browser actually supports it. You can't assume that the syntax of the final version will be the same as the syntax of any of the prefixed versions. Code hygien...
HTML attribute: size - HTML: Hypertext Markup Language
Web › HTML › Attributes › size
nes the width of the <input> and the height of the <select> element. For the input, if the type attribute is text or password then it's the number of characters. This must be an integer value 0 or higher. If no size is specified, or an invalid value is specified, the input has no size declared, and the form control will be the default width based on the user agent. If CSS targets the element with properties impacting the width, CSS takes precedence. The size attribute has no impact on constraint validation. Examples By adding size on some input types, the width of the input can be controlled. Adding size on a select changes the height, definining how many options are visible in the closed state. <label for="fruit">Enter a fruit</label> <input type="text" size="15" id="fruit"> <label for="vegetab...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
o intrinsic visual output of its own unless the controls attribute is specified, in which case the browser's default controls are shown. The default controls have a display value of inline by default, and it is often a good idea set the value to block to improve control over positioning and layout, unless you want it to sit within a text block or similar. You can style the default controls with properties that affect the block as a single unit, so for example you can give it a border and border-radius, padding, margin, etc. You can't however style the individual components inside the audio player (e.g. change the button size or icons, change the font, etc.), and the controls are different across the different browsers. To get a consistent look and feel across browsers, you'll need to create custo...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
HTMLQuoteElement Attributes This element's attributes include the global attributes. cite 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. Usage notes To change the indentation applied to the quoted text, use the CSS margin-left and/or margin-right properties, or the margin shorthand property. To include shorter quotes inline rather than in a separate block, use the <q> (Quotation) element. Example This example demonstrates the use of the <blockquote> element to quote a passage from RFC 1149, A Standard for the Transmission of IP Datagrams on Avian Carriers. <blockquote cite="https://tools.ietf.org/html/rfc1149"> <p>Avian carriers can provide hi...
<br>: The Line Break element - HTML: Hypertext Markup Language
Web › HTML › Element › br
ibility concerns Creating separate paragraphs of text using <br> is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. Screen readers may announce the presence of the element, but not any content contained within <br>s. This can be a confusing and frustrating experience for the person using the screen reader. Use <p> elements, and use CSS properties like margin to control their spacing. Technical summary Content categories Flow content, phrasing content. Permitted content None, it is an empty element. Tag omission Must have a start tag, and must not have an end tag. In XHTML documents, write this element as <br />. Permitted parents Any element that accepts phrasing content. Implicit...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › caption
e 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. Usage notes The <caption> element should be the first child of its parent <table> element. When the <table> element that contains the <caption> is the only descendant of a <figure> element, you should use the <figcaption> element instead of <caption>. Example This simple example presents a table that includes a caption. <table> <caption>Example Caption</cap...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › center
ent (<center>) is a block-level element that displays its block-level or inline contents centered horizontally within its containing element. The container is usually, but isn't required to be, <body>. This tag has been deprecated in HTML 4 (and XHTML 1) in favor of the CSS text-align property, which can be applied to the <div> element or to an individual <p>. For centering blocks, use other CSS properties like margin-left and margin-right and set them to auto (or set margin to 0 auto). 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. Example 1 <center>This text will be centered. <p>So will this paragraph.</p></center> Example 2 (CSS alternative) <div style=...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
e and is used for defining common semantics on all common cells. It is generally found within a <colgroup> 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. <col> allows styling columns using CSS, but only a few properties will have an effect on the column (see the CSS 2.1 specification for a list). Content categories None. Permitted content None, it is an empty element. Tag omission It must have start tag, but must not have an end tag. Permitted parents <colgroup> only, though it can be implicitly defined as its start tag is not mandatory. The <colgroup> must not ha...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
Customizing the disclosure widget The disclosure triangle itself can be customized, although this is not as broadly supported. There are variations in how browsers support this customization due to experimental implementations as the element was standardized, so we'll have to use multiple approaches for a while. The <summary> element supports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). For example, we can remove the disclosure widget icon by setting list-style: none. Chrome doesn't support this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in that browser. CSS details { font: 16px "Op...
<div>: The Content Division element - HTML: Hypertext Markup Language
Web › HTML › Element › div
ory. Permitted parents Any element that accepts flow content. Or (in WHATWG HTML): <dl> element. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLDivElement Attributes This element includes the global attributes. Note: The align attribute is obsolete; do not use it anymore. Instead, you should use CSS properties or techniques such as CSS Grid or CSS Flexbox to align and position <div> elements on the page. Usage notes The <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate. Examples A simple example <div> <p>Any kind of content here. Such as &lt;p&gt;, &lt;table&gt;. You name it!</p> </div> The result looks like this: A styled exa...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
amount of default padding. The element has min-inline-size: min-content by default. If a <legend> is present, it is placed over the block-start border. The <legend> shrink-wraps, and also establishes a formatting context. The display value is blockified. (For example, display: inline behaves as block.) There will be an anonymous box holding the contents of the <fieldset>, which inherits certain properties from the <fieldset>. If the <fieldset> is styled with display: grid or display: inline-grid, then the anonymous box will be a grid formatting context. If the <fieldset> is styled with display: flex or display: inline-flex, then the anonymous box will be a flex formatting context. Otherwise, it establishes a block formatting context. You can feel free to style the <fieldset> and <legend> in any w...
<font> - HTML: Hypertext Markup Language
Web › HTML › Element › font
time as all elements related to styling only, then made obsolete in HTML5. Starting with HTML 4, HTML does not convey styling information anymore (outside the <style> element or the style attribute of each element). For any new web development, styling should be written using CSS only. The former behavior of the <font> element can be achieved, and even better controlled using the CSS Fonts CSS properties. Attributes Like all other HTML elements, this element supports the global attributes. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. face This 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 ...
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
e for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> The displayed date format will differ from the actual value -- the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. You can get and set the date value in JavaScript with the input element's value and valueAsNumber properties. For example: var dateControl = document.querySelector('input[type="date"]'); dateControl.value = '2017-06-01'; console.log(dateControl.value); // prints "2017-06-01" console.log(dateControl.valueAsNumber); // prints 1496275200000, a UNIX timestamp This code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (June 1st, 2017). It then reads that value back in st...
<input type="datetime-local"> - HTML: Hypertext Markup Language
<input type="submit" value="Book party!"> </div> </form> If you try to submit the form with an incomplete date (or with a date outside the set bounds), the browser displays an error. Try playing with the example now: Here's a screenshot for those of you who aren't using a supporting browser: Here's the CSS used in the above example. Here we make use of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid. We had to put the icons on a <span> next to the input, not on the input itself, because in Chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; display: flex; align-items: center; } label { display: inline-block; width: 300px; } ...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
sses is entered into the input box. Browsers that implement the specification should be using an algorithm equivalent to the following regular expression: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61} [a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ To learn more about how form validation works and how to take advantage of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid, see Form data validation. Note: There are known specification issues related to international domain names and the validation of e-mail addresses in HTML. See W3C bug 15489 for details. Pattern validation If you need the entered e-mail address to be restricted further than just "any string that looks like an e-mail addres...
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
ps://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 files can be identified using the input's HTMLInputElement.files proper...
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
e="submit" value="Submit form"> </div> </form> If you try to submit the form without both the month and year specified (or with a date outside the set bounds), the browser displays an error. Try playing with the example now: Here's a screenshot for those of you who aren't using a supporting browser: Here's the CSS used in the above example. Here we make use of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid. We had to put the icons on a <span> next to the input, not on the input itself, because in Chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
g example we are setting a minimum time of 12:00 and a maximum time of 18:00: <form> <label for="appt-time">Choose an appointment time (opening hours 12:00 to 18:00): </label> <input id="appt-time" type="time" name="appt-time" min="12:00" max="18:00"> <span class="validity"></span> </form> Here's the CSS used in the above example. Here we make use of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid. We had to put the icons on a <span> next to the input, not on the input itself, because in Chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30...
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
In the following example we are setting a minimum value of Week 01, 2017 and a maximum value of Week 52, 2017: <form> <label for="week">What week would you like to start?</label> <input id="week" type="week" name="week" min="2017-W01" max="2017-W52"> <span class="validity"></span> </form> Here's the CSS used in the above example. Here we make use of the :valid and :invalid CSS properties to style the input based on whether or not the current value is valid. We had to put the icons on a <span> next to the input, not on the input itself, because in Chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
how white space lets visual users skip around. Using empty <p> elements to add space between paragraphs is problematic for people who navigate with screen-reading technology. Screen readers may announce the paragraph's presence, but not any content contained within it -- because there is none. This can confuse and frustrate the person using the screen reader. If extra space is desired, use CSS properties like margin to create the effect: p { margin-bottom: 2em; // increase white space after a paragraph } Specifications Specification Status Comment HTML Living StandardThe definition of '<p>' in that specification. Living Standard No change since the latest W3C snapshot HTML5 HTML5The definition of '<p>' in that specification. Recommendation al...
<picture>: The Picture element - HTML: Hypertext Markup Language
Web › HTML › Element › picture
ding role Permitted ARIA roles No role permitted DOM interface HTMLPictureElement Attributes This element includes only global attributes. Usage notes You can use the object-position property to adjust the positioning of the image within the element's frame, and the object-fit property to control how the image is resized to fit within the frame. Note: Use these properties on the child <img> element, not the <picture> element. Examples These examples demonstrate how different attributes of the <source> element change the selection of the image inside <picture>. The media attribute The media attribute specifies a media condition (similar to a media query) that the user agent will evaluate for each <source> element. If the <source>'s media condition evaluates t...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
a keyboard-focused link. Pressing Space to select/deselect "focused" select options. Styling with CSS The <select> element is notoriously difficult to style productively with CSS. You can affect certain aspects like any element -- for example, manipulating the box model, the displayed font, etc., and you can use the appearance property to remove the default system appearance. However, these properties don't produce a consistent result across browsers, and it is hard to do things like line different types of form element up with one another in a column. The <select> element's internal structure is complex, and hard to control. If you want to get full control, you should consider using a library with good facilities for styling form widgets, or try rolling your own dropdown menu using non-semant...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
umn and the bottom of the table and the last row. To achieve a similar effect, apply the border-spacing property to the <table> element. border-spacing does not have any effect if border-collapse is set to collapse. frame This enumerated attribute defines which side of the frame surrounding the table must be displayed. To achieve a similar effect, use the border-style and border-width properties. rules This enumerated attribute defines where rules, i.e. lines, should appear in a table. It can have the following values: none, which indicates that no rules will be displayed; it is the default value; groups, which will cause the rules to be displayed between row groups (defined by the <thead>, <tbody> and <tfoot> elements) and between column groups (defined by the <col> and <...
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
middle: Centers the text in the cell. and top: Positions the text near the top of the cell. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS vertical-align property instead. width Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recommended cell width. Additional space can be added with the cellspacing and cellpadding properties and the width of the <col> element can also create extra width. But, if a column's width is too narrow to show a particular cell properly, it will be widened when displayed. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS width property instead. Examples See <table> for examples on <th>. Specifications Specification Status Comment ...
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
> <td>15.00</td> </tr> </tbody> </table> CSS The CSS is much more involved this time. it's not complicated, but there's a lot going on. Let's break it down. The table and base styles table { border: 1px solid black; font: 16px "Open Sans", Helvetica, Arial, sans-serif; border-spacing: 0; border-collapse: collapse; } Here we've added the border-spacing and border-collapse properties to eliminate spacing between cells and collapse borders that touch one another to be a single border instead of winding up with double borders. th, td { border: 1px solid black; padding:4px 6px; } th { vertical-align: bottom; } And here are the default styles for all table cells. Now let's customize! The top header: overall We're going to look at the top header in two pieces. First, th...
dir - HTML: Hypertext Markup Language
ses 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 text will display correctly even on a browser that doesn't support CSS o...
itemscope - HTML: Hypertext Markup Language
itemscope is a boolean global attribute that defines the scope of associated metadata. Specifying the itemscope attribute for an element creates a new item, which results in a number of name-value pairs that are associated with the element. A related attribute, itemtype, is used to specify the valid URL of a vocabulary (such as schema.org) that describes the item and its properties context. In each of the following examples, the vocabulary is from schema.org. Every HTML element may have an itemscope attribute specified. An itemscope element that does not have an associated itemtype must have an associated itemref. Note: Find more about itemtype attributes at http://schema.org/Thing Simple example HTML The following example specifies the itemscope attribute. The example specifies the itemtype...
HTML: Hypertext Markup Language
Web › HTML
they can contain and elements that can or can't be used in them. This is a guide to these categories. Quirks mode and standards mode Historical information on quirks mode and standards mode. Related topics Applying color to HTML elements using CSS This article covers most of the ways you use CSS to add color to HTML content, listing what parts of HTML documents can be colored and what CSS properties to use when doing so. Includes examples, links to palette-building tools, and more. View All... ...
Using HTTP cookies - HTTP
Web › HTTP › Cookies
e other regulations governing the use of cookies in your locality. The burden is on you to know and comply with these regulations. There are companies that offer "cookie banner" code that helps you comply with these regulations. Other ways to store information in the browser Another approach to storing data in the browser is the Web Storage API. The window.sessionStorage and window.localStorage properties correspond to session and permanent cookies in duration, but have larger storage limits than cookies, and are never sent to a server. More structured and larger amounts of data can be stored using the IndexedDB API, or a library built on it. Other techniques have been created to cause cookies to be recreated after they are deleted, known as "zombie" cookies. These techniques violate the principl...
CSP: style-src - HTTP
Unsafe inline styles Note: Disallowing inline styles and inline scripts is one of the biggest securi...
Content-Security-Policy - HTTP
Specifies valid sources for stylesheets. style-src-elem Specifies valid sources for stylesheets <style> elements and <link> elements with rel="stylesheet". style-src-attr Specifies valid sources for inline styles applied to individual DOM elements. worker-src Specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. Document directives Document directives govern the properties of a document or worker environment to which a policy applies. base-uri Restricts the URLs which can be used in a document's <base> element. plugin-types Restricts the set of plugins that can be embedded into a document by limiting the types of resources which can be loaded. sandbox Enables a sandbox for the requested resource similar to the <iframe> sandbox attribute. Navigation direct...
About JavaScript - JavaScript
both Java and C++ to reduce the number of new concepts required to learn the language. Language constructs, such as if statements, for and while loops, and switch and try ... catch blocks function the same as in these languages (or nearly so). JavaScript can function as both a procedural and an object oriented language. Objects are created programmatically in JavaScript, by attaching methods and properties to otherwise empty objects at run time, as opposed to the syntactic class definitions common in compiled languages like C++ and Java. Once an object has been constructed it can be used as a blueprint (or prototype) for creating similar objects. JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), ...
Closures - JavaScript
on, 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 useful because they let you associate data (the lexical environment) with a function that operates on that data. This has obvious parallels to object-oriented programming, where objects allow you to associate data (the object's properties) with one or more methods. Consequently, you can use a closure anywhere that you might normally use an object with only a single method. Situations where you might want to do this are particularly common on the web. Much of the code written in front-end JavaScript is event-based. You define some behavior, and then attach it to an event that is triggered by the user (such as a click or a keypres...
Concurrency model and the event loop - JavaScript
loop got its name because of how it's usually implemented, which usually resembles: while (queue.waitForMessage()) { queue.processNextMessage() } queue.waitForMessage() waits synchronously for a message to arrive (if one is not already available and waiting to be handled). "Run-to-completion" Each message is processed completely before any other message is processed. This offers some nice properties when reasoning about your program, including the fact that whenever a function runs, it cannot be pre-empted and will run entirely before any other code runs (and can modify data the function manipulates). This differs from C, for instance, where if a function runs in a thread, it may be stopped at any point by the runtime system to run some other code in another thread. A downside of this model...
Functions - JavaScript
rn number * number; Primitive parameters (such as a number) are passed to functions by value; the value is passed to the function, but if the function changes the value of the parameter, this change is not reflected globally or in the calling function. If you pass an object (i.e. ...
Iterators and generators - JavaScript
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 iterator object can be iterated explicitly by repeatedly calling next(). Iterating over an iterator is said to consume the iterator, because it is generally only possible to d...
JavaScript modules - JavaScript
y, 480, 320); let reportList = createReportList(myCanvas.id); let square1 = draw(myCanvas.ctx, 50, 50, 100, 'blue'); reportArea(square1.length, reportList); reportPerimeter(square1.length, reportList); Note: Although imported features are available in the file, they are read only views of the feature that was exported. You cannot change the variable that was imported, but you can still modify properties similar to const. Additionally, these features are imported as live bindings, meaning that they can change in value even if you 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 ...
Text formatting - JavaScript
ten}.`); // "Fifteen is 15 and not 20." For more information, read about Template literals in the JavaScript reference. Internationalization The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The constructors for Collator, NumberFormat, and DateTimeFormat objects are properties of the Intl object. Date and time formatting The DateTimeFormat object is useful for formatting date and time. The following formats a date for English as used in the United States. (The result is different in another time zone.) const msPerDay = 24 * 60 * 60 * 1000; // July 17, 2014 00:00:00 UTC. const july172014 = new Date(msPerDay * (44 * 365 + 11 + 197)); const options = { year: '2-digit...
JavaScript Guide - JavaScript
ical operators Conditional (ternary) operator Numbers and dates Number literals Number object Math object Date object Text formatting String literals String object Template literals Internationalization Regular Expressions Indexed collections Arrays Typed arrays Keyed collections Map WeakMap Set WeakSet Working with objects Objects and properties Creating objects Defining methods Getter and setter Details of the object model Prototype-based OOP Creating object hierarchies Inheritance Promises Guarantees Chaining Error propagation Composition Timing Iterators and generators Iterators Iterables Generators Meta programming Proxy Handlers and traps Revocable Proxy Reflect Ja...
About the JavaScript reference - JavaScript
to JavaScript, start with the guide. Once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs. Structure of the reference In the JavaScript reference you can find the following chapters: Standard built-in objects This chapter documents all the JavaScript standard built-in objects, along with their methods and properties. Statements and declarations JavaScript applications consist of statements with an appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon. This isn't a keyword, but a group of keywords. Expressions and operators This chapter documents all the JavaScript language operators, expressions and key...
Private class fields - JavaScript
There is however an experimental proposal to allow defining private class fields using a hash # prefix is added. Syntax class ClassWithPrivateField { #privateField } class ClassWithPrivateMethod { #privateMethod() { return 'hello world' } } class ClassWithPrivateStaticField { static #PRIVATE_STATIC_FIELD } Examples Private static fields Private fields are accessible on the class constructor from inside the class declaration itself. The limitation of static variables being called by only static methods still holds. ...
TypeError: can't redefine non-configurable property "x" - JavaScript
ypeError: can't redefine non-configurable property "x" (Firefox) TypeError: Cannot redefine property: "x" (Chrome) Error type TypeError What went wrong? It was attempted to redefine a property, but that property is non-configurable. The configurable attribute controls whether the property can be deleted from the object and whether its attributes (other than writable) can be changed. Usually, properties in an object created by an 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. var obj = Object.create({}); Object.defineProper...
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated - JavaScript
te' operator to an unqualified name is deprecated (Firefox) SyntaxError: Delete of an unqualified identifier in strict mode. (Chrome) Error type SyntaxError in strict mode only. What went wrong? Normal variables in JavaScript can't be deleted using the delete operator. In strict mode, an attempt to delete a variable will throw an error and is not allowed. The delete operator can only delete properties on an object. Object properties are "qualified" if they are configurable. Unlike what common belief suggests, the delete operator has nothing to do with directly freeing memory. Memory management is done indirectly via breaking references, see the memory management page and the delete operator page for more details. This error only happens in strict mode code. In non-strict code, the operation ...
ReferenceError: deprecated caller or arguments usage - JavaScript
The JavaScript strict mode-only exception "deprecated caller or arguments usage" occurs when the deprecated Function.caller or Function.arguments properties are used. Message TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context (Edge) Warning: ReferenceError: deprecated caller usage (Firefox) Warning: ReferenceError: deprecated arguments usage (Firefox) TypeError: 'callee' and 'caller' cannot be accessed in strict mode. (Safari) Error type A strict-mode-only warning that a ReferenceError occurred. JavaScript execution won't be halted. What went wrong? In strict mode, the Function.caller or Function.arguments properties are used and shouldn't be. They are deprecated, because they leak the function caller, are non-standard, har...
TypeError: setting getter-only property "x" - JavaScript
What went wrong? There is an attempt to set a new value to a property for which only a getter is specified. ...
TypeError: invalid assignment to const "x" - JavaScript
a value. ...
SyntaxError: JSON.parse: bad parsing - JavaScript
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. JSON.parse('{"foo": 01}'); // SyntaxError: JSON.parse: expected ',' or '}' afte...
SyntaxError: missing name after . operator - JavaScript
[]), but not both. Square brackets allow computed property access. var obj = { foo: { bar: "baz", bar2: "baz2" } }; var i = 2; obj.[foo].[bar] // SyntaxError: missing name after . operator obj.foo."bar"+i; // SyntaxError: missing name after . operator To fix this code, you need to access the object like this: obj.foo.bar; // "baz" // or alternatively obj["foo"]["bar"]; // "baz" // computed properties require square brackets obj.foo["bar" + i]; // "baz2" Property access vs. concatenation If you are coming from another programming language (like PHP), it is also easy to mix up the dot operator (.) and the concatenation operator (+). console.log("Hello" . "world"); // SyntaxError: missing name after . operator Instead you need to use a plus sign for concatenation: console.log("Hello" + "W...
SyntaxError: missing ; before statement - JavaScript
eck the syntax when this error is thrown. Examples Unescaped strings This error can occur easily when not escaping strings properly and the JavaScript engine is expecting the end of your string already. For example: var foo = 'Tom's bar'; // SyntaxError: missing ; before statement You can use double quotes, or escape the apostrophe: var foo = "Tom's bar"; var foo = 'Tom\'s bar'; Declaring properties with var You cannot declare properties of an object or array with a var declaration. var obj = {}; var obj.foo = 'hi'; // SyntaxError missing ; before statement var array = []; var array[0] = 'there'; // SyntaxError missing ; before statement Instead, omit the var keyword: var obj = {}; obj.foo = 'hi'; var array = []; array[0] = 'there'; Bad keywords If you come from another programming...
TypeError: More arguments needed - JavaScript
avaScript exception "more arguments needed" occurs when there is an error with how a function is called. More arguments need to be provided. Message TypeError: argument is not an Object and is not null (Edge) TypeError: Object.create requires at least 1 argument, but only 0 were passed TypeError: Object.setPrototypeOf requires at least 2 arguments, but only 0 were passed TypeError: Object.defineProperties requires at least 1 argument, but only 0 were passed Error type TypeError. What went wrong? There is an error with how a function is called. More arguments need to be provided. Examples Required arguments not provided The Object.create() method requires at least one argument and the Object.setPrototypeOf() method requires at least two arguments: var obj = Object.create(); // TypeError: O...
TypeError: "x" is not a non-null object - JavaScript
iption 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 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({}, 'k...
TypeError: can't delete non-configurable array element - JavaScript
t went wrong? It was attempted to shorten the length of an array, but one of the array's elements is non-configurable. When shortening an array, the elements beyond the new array length will be deleted, which failed in this situation. The configurable attribute controls whether the property can be deleted from the object and whether its attributes (other than writable) can be changed. Usually, properties in an object created by an array 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. var arr = []; Object.defineProperty(ar...
ReferenceError: reference to undefined property "x" - JavaScript
urs when a script attempted to access an object property which doesn't exist. Message ReferenceError: reference to undefined property "x" (Firefox) Error type (Firefox only) ReferenceError warning which is reported only if javascript.options.strict preference is set to true. What went wrong? The script attempted to access an object property which doesn't exist. There are two ways to access properties; see the property accessors reference page to learn more about them. Examples Invalid cases In this case, the property bar is an undefined property, so a ReferenceError will occur. var foo = {}; foo.bar; // ReferenceError: reference to undefined property "bar" Valid cases To avoid the error, you need to either add a definition for bar to the object or check for the existence of the bar pro...
AggregateError - JavaScript
AggregateError.prototype.name Error name, defaults to AggregateError. ...
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 introduced. ...
Array.prototype.copyWithin() - JavaScript
d of the same name. The sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap. The copyWithin function is intentionally generic, it does not require that its this value be an Array object. The copyWithin method is a mutable method. It does not alter the length of this, but it will change its content and create new properties, if necessary. Polyfill if (!Array.prototype.copyWithin) { Object.defineProperty(Array.prototype, 'copyWithin', { value: function(target, start/*, end*/) { // Steps 1-2. if (this == null) { throw new TypeError('this is null or not defined'); } var O = Object(this); // Steps 3-5. var len = O.length >>> 0; // Steps 6-8. var relativeTarget = target >>...
Array.prototype.find() - JavaScript
// e. Increase k by 1. k++; } // 7. Return undefined. return undefined; }, configurable: true, writable: true }); } If you need to support truly obsolete JavaScript engines that don't support Object.defineProperty, it is best not to polyfill Array.prototype at all, as you cannot make it non-enumerable. ...
Array.prototype.length - JavaScript
-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 false, any attempts to delete the property or change its attributes (Writable, Co...
Array.prototype.pop() - JavaScript
urn value The removed element from the array; undefined if the array is empty. Description The pop method removes the last element from an array and returns that value to the caller. pop is intentionally generic; this method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. If you call pop() on an empty array, it returns undefined. Array.prototype.shift() has similar behavior to pop, but applied to the first element in an array. Examples Removing the last element of an array The following code creates the myFish array containing four elements, then removes its last element. var myFish = ['angel', 'clown', 'mandarin', 's...
Array.prototype.reverse() - JavaScript
value The reversed array. Description The reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array. reverse is intentionally generic; this method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. Examples Reversing the elements in an array The following example creates an array a, containing three elements, then reverses the array. The call to reverse() returns a reference to the reversed array a. const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.reverse(); console.log(a); // [3, 2, 1] Reversing the elements in an array-like object The...
Array.prototype.shift() - JavaScript
method removes the element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value. If the length property is 0, undefined is returned. shift is intentionally generic; this method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. Array.prototype.pop() has similar behavior to shift, but applied to the last element in an array. Examples Removing an element from an array The following code displays the myFish array before and after removing its first element. It also displays the removed element: var myFish = ['angel', 'clown', 'mandarin', 'surgeon']; console.log('myFish before:...
Array.prototype.sort() - JavaScript
onveniently used with function expressions: var numbers = [4, 2, 5, 1, 3]; numbers.sort(function(a, b) { return a - b; }); console.log(numbers); // [1, 2, 3, 4, 5] ES2015 provides arrow function expressions with even shorter syntax. let numbers = [4, 2, 5, 1, 3]; numbers.sort((a, b) => a - b); console.log(numbers); // [1, 2, 3, 4, 5] Objects can be sorted, given the value of one of their properties. var items = [ { name: 'Edward', value: 21 }, { name: 'Sharpe', value: 37 }, { name: 'And', value: 45 }, { name: 'The', value: -12 }, { name: 'Magnetic', value: 13 }, { name: 'Zeros', value: 37 } ]; // sort by value items.sort(function (a, b) { return a.value - b.value; }); // sort by name items.sort(function(a, b) { var nameA = a.name.toUpperCase(); // ignore upper and lowerca...
Array.prototype.toLocaleString() - JavaScript
ng their toLocaleString methods and these Strings are separated by a locale-specific String (such as a comma ","). Syntax arr.toLocaleString([locales[, options]]); Parameters locales Optional A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the locales argument, see the Intl page. options Optional An object with configuration properties, for numbers see Number.prototype.toLocaleString(), and for dates see Date.prototype.toLocaleString(). Return value A string representing the elements of the array. Polyfill // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring if (!Array.prototype.toLocaleString) { Object.defineProperty(Array.prototype, 'toLocaleString', { value: function(locales, options) { // ...
Array.prototype.unshift() - JavaScript
n value The new length property of the object upon which the method was called. Description The unshift method inserts the given values to the beginning of an array-like object. unshift is intentionally generic. This method can be called or applied to objects resembling arrays. Objects which do not contain a length property--reflecting the last in a series of consecutive, zero-based numerical properties--may not behave in any meaningful manner. Please note that, if multiple elements are passed as parameters, they're inserted in chunk at the beginning of the object, in the exact same order they were passed as parameters. Hence, calling unshift with n arguments once, or calling it n times with 1 argument (with a loop, for example), don't yield the same results. See example: let arr = [4, 5, 6] ...
ArrayBuffer - JavaScript
or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer. The ArrayBuffer() constructor creates a new ArrayBuffer of the given length in bytes. You can also get an array buffer from existing data, for example from a Base64 string or from a local file. Constructor ArrayBuffer() Creates a new ArrayBuffer object. Static properties get ArrayBuffer[@@species] The constructor function that is used to create derived objects. Static methods ArrayBuffer.isView(arg) Returns true if arg is one of the ArrayBuffer views, such as typed array objects or a DataView. Returns false otherwise. Instance properties ArrayBuffer.prototype.byteLength The read-only size, in bytes, of the ArrayBuffer. This is established when the...
Atomics - JavaScript
The Atomics object provides atomic operations as static methods. They are used with SharedArrayBuffer and ArrayBuffer objects. Description The Atomic operations are installed on an Atomics module. 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 ("fa...
DataView - JavaScript
umber 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. Fixed at construction time and thus read only. DataView.prototype.byteOffset The offset (in bytes) of this view from the start of its ArrayBuffer. Fixed at construction time and...
Date.prototype.toLocaleDateString() - JavaScript
rmatting 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 object and use the function provided by its format property. Examples Using toLocaleDateString() ...
Date.prototype.toLocaleString() - JavaScript
ing 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 function provided by its format property. Examples Using toLocaleString() In basic use without specifying...
Date.prototype.toLocaleTimeString() - JavaScript
se 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 object and use the function provided by its format property. Examples Using toLocaleTimeString...
Error.prototype.stack - JavaScript
tep will be separated by a newline, with the first part of the line being the function name (if not a call from the global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line number. (Note that the Error object also possesses the fileName, lineNumber and columnNumber properties for retrieving these from the error thrown (but only the error, and not its trace).) Note that this is the format used by Firefox. There is no standard formatting. However, Safari 6+ and Opera 12- use a very similar format. Browsers using the V8 JavaScript engine (such as Chrome, Opera 15+, Android Browser) and IE10+, on the other hand, uses a different format (see the archived MSDN error.stack ...
Error.prototype.toSource() - JavaScript
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. Note: Be aware that the properties used by the toSource method in the creation of this string are mutable and may not accurately reflect the function used to create an error instance or the filename or line number where the actual error occurred. Specifications Not part of any standard. ...
Error - JavaScript
ting an error that occurs when a variable or parameter is not of a valid type. URIError Creates an instance representing an error that occurs when encodeURI() or decodeURI() are passed invalid parameters. Constructor Error() Creates a new Error object. Static methods Error.captureStackTrace() A non-standard V8 function that creates the stack property on an Error instance. Instance properties Error.prototype.message Error message. Error.prototype.name Error name. Error.prototype.description A non-standard Microsoft property for the error description. Similar to message. Error.prototype.number A non-standard Microsoft property for an error number. Error.prototype.fileName A non-standard Mozilla property for the path to the file that raised this error. Error.prototype.lineN...
EvalError - JavaScript
Although ECMA-262 specifies that EvalError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. EvalError.prototype.name Error name. Inherited from Error. ...
Function.prototype.apply() - JavaScript
, you do not have to know the arguments of the called object when you use the apply method. You can use arguments to pass all the arguments to the called object. The called object is then responsible for handling the arguments. Since ECMAScript 5th Edition, you can also use any kind of object which is array-like. In practice, this means it's going to have a length property, and integer ("index") properties in the range (0..length - 1). For example, you could use a NodeList, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. Note: Many older browsers--including Chrome <17 and Internet Explorer <9--don't accept array-like objects, and will throw an exception. Examples Using apply to append an array to another You can use push to append an element to an array. And, because push...
Function.prototype.call() - JavaScript
e apply() accepts a single array of arguments. Examples Using call to chain constructors for an object You can use call to chain constructors for an object (similar to Java). In the following example, the constructor for the Product object is defined with two parameters: name and price. Two other functions, Food and Toy, invoke Product, passing this, name, and price. Product initializes the properties name and price, both specialized functions define the category. function Product(name, price) { this.name = name; this.price = price; } function Food(name, price) { Product.call(this, name, price); this.category = 'food'; } function Toy(name, price) { Product.call(this, name, price); this.category = 'toy'; } const cheese = new Food('feta', 5); const fun = new Toy('robot', 40); U...
Function.name - JavaScript
console.log(object.someMethod.name); // someMethod To change it, use Object.defineProperty(). Shorthand method names var o = { foo(){} }; o.foo.name; // "foo"; Bound function names Function.bind() produces a function whose name is "bound " plus the function name. function foo() {}; foo.bind({}).name; // "bound foo" Function names for getters and setters When using get and set accessor properties, "get" or "set" will appear in the function name. let o = { get foo(){}, set foo(x){} }; var descriptor = Object.getOwnPropertyDescriptor(o, "foo"); descriptor.get.name; // "get foo" descriptor.set.name; // "set foo"; Function names in classes You can use obj.constructor.name to check the "class" of an object (but be sure to read the warnings below): function Foo() {} // ES2015 Syntax: ...
Function - JavaScript
code (function(){}).constructor === Function, which returns true. Constructor Function() Creates a new Function object. Calling the constructor directly can create functions dynamically but suffers from security and similar (but far less significant) performance issues to eval. However, unlike eval, the Function constructor creates functions that execute in the global scope only. Instance properties Function.arguments An array corresponding to the arguments passed to a function. This is deprecated as a property of Function. Use the arguments object (available within the function) instead. Function.caller Specifies the function that invoked the currently executing function. This property is deprecated, and is only functional for some non-strict functions. Function.displayName The di...
InternalError - JavaScript
The InternalError object indicates an error that occurred internally in the JavaScript engine. Example cases are mostly when something is too large, e.g.: "too many switch cases", "too many parentheses in regular expression", "array initializer too large", "too much recursion". Constructor InternalError() Creates a new InternalError object. Instance properties InternalError.prototype.message Error message. Inherited from Error. InternalError.prototype.name Error name. Inherited from Error. InternalError.prototype.fileName Path to file that raised this error. Inherited from Error. InternalError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. InternalError.prototype.columnNumber Column number in line that raised this error. I...
Intl.Collator() constructor - JavaScript
vided, 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. 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 lea...
Intl.Collator - JavaScript
Intl.Collator.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.Collator.prototype.compare Getter function that compares two strings according to the sort order of this Intl.Collator object. Intl.Collator.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 positiv...
Intl.DateTimeFormat - JavaScript
Intl.DateTimeFormat.prototype.format() Getter function that formats a date according to the locale and formatting options of this DateTimeFormat object. Intl.DateTimeFormat.prototype.formatToParts() Returns an Array of objects representing the date string in parts that can be used for custom locale-aware formatting. Intl.DateTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object. Intl.DateTimeFormat.prototype.formatRange() This method receives two Dates and formats the date range in the most concise way based on the locale and options provided when instantiating DateTimeFormat. Intl.DateTimeFormat.prototype.formatRangeToParts() This method receives two Dates and returns an Array...
Intl.DisplayNames() constructor - JavaScript
ument, see the Intl page. The following Unicode extension key is allowed: nu The numbering system to be used. Possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". options Optional An object with some or all of the following properties: localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". 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". "language" "region" "script" "currency" ...
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. 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 t...
Intl.DisplayNames - JavaScript
() 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.DisplayNames.prototype.of() This method receives a code and returns a string based on the locale and options provided when instantiating Intl.DisplayNames. Intl.DisplayNames.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object. Examples Region Code Display Names To create an Intl.DisplayNames for a locale and get the display name for a region code. // Get display names of region in English let regionNames = new Intl.DisplayNames(['en'], {type: 'region'}); regionNames.of('419'); // "Latin America" regionNames.of('BZ'); // "Be...
Intl.ListFormat() constructor - JavaScript
s project, please clone https://github.com/mdn/interactive-examples and send us 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...
Intl​.List​Format​.prototype​.formatToParts() - JavaScript
ing to a locale. Return value An Array of components which contains the formatted parts 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', 'Pineap...
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. 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 optio...
Intl.Locale - JavaScript
alendar type, clock type, and numbering system type. Traditionally, the Intl API used strings to represent locales, just as Unicode does. This is a simple and lightweight solution that works well. Adding a Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags. Constructor Intl.Locale() Creates a new Locale object. Instance properties Intl.Locale.prototype.baseName Returns basic, core information about the Locale in the form of a substring of the complete data string. Intl.Locale.prototype.calendar Returns the part of the Locale that indicates the Locale's calendar era. Intl.Locale.prototype.caseFirst Returns whether case is taken into account for the locale's collation rules. Intl.Locale.prototype.collation Returns ...
Intl.NumberFormat - JavaScript
ods Intl.NumberFormat.prototype.format() Getter function that formats a number according to the locale and formatting options of this NumberFormat object. Intl.NumberFormat.prototype.formatToParts() Returns an Array of objects representing the number string in parts that can be used for custom locale-aware formatting. Intl.NumberFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and collation options computed during initialization of the object. Examples Basic usage In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var number = 3500; console.log(new Intl.NumberFormat().format(number)); // -> '3,500' if in US English locale Using locales This example shows some of the var...
Intl.PluralRules - JavaScript
lated language rules. Constructor Intl.PluralRules.PluralRules() Creates a new Intl.PluralRules object. Static methods Intl.PluralRules.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.PluralRules.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and collation options computed during initialization of the object. Intl.PluralRules.prototype.select() Returns a String indicating which plural rule to use for locale-aware formatting. Examples Using locales This example shows some of the variations in localized plural rules. In order to get the format of the language used in the user interface of your application, ma...
Intl.RelativeTimeFormat() constructor - JavaScript
The Intl.RelativeTimeFormat() constructor creates Intl.RelativeTimeFormat objects. 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. ...
Intl.RelativeTimeFormat.prototype.formatToParts() - JavaScript
ed. Return value An Array of objects containing the formatted relative time in parts. Description The Intl.RelativeTimeFormat.prototype.formatToParts method is a version of the format method which it returns an array of objects which represent "parts" of the object, separating the formatted number into its consituent parts and separating it from other surrounding text. These objects have two properties: type a NumberFormat formatToParts type, and value, which is the String which is the component of the output. If a "part" came from NumberFormat, it will have a unit property which indicates the unit being formatted; literals which are part of the larger frame will not have this property. Examples Using formatToParts const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); // Forma...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
The Intl.RelativeTimeFormat.prototype.resolvedOptions() method returns a new object with properties reflecting 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. 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 Uni...
Intl.RelativeTimeFormat - JavaScript
.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 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 ...
JSON.parse() - JavaScript
es Using JSON.parse() JSON.parse('{}'); // {} JSON.parse('true'); // true JSON.parse('"foo"'); // "foo" JSON.parse('[1, 5, "false"]'); // [1, 5, "false"] JSON.parse('null'); // null Using the reviver parameter If a reviver is specified, the value computed by parsing is transformed before being returned. Specifically, the computed value and all its properties (beginning with the most nested properties and proceeding to the original value itself) are individually run through the reviver. Then it is called, with the object containing the property being processed as this, and with the property name as a string, and the property value as arguments. If the reviver function returns undefined (or returns no value, for example, if execution falls off the end ...
Object.prototype.constructor - JavaScript
Child = Object.assign(ParentWithStatic) // Notice that we assign it before we create(...) a prototype below Child.prototype = Object.create(ParentWithStatic.prototype) ... or assign parent constructor identifier to a separate property on the Child constructor function and access it via that property: ... Child.parentConstructor = ParentWithStatic Child.prototype =...
Object.fromEntries() - JavaScript
e for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax 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 iterator object, that produces a two element array-like object, whose first element is a value that will ...
Object.getOwnPropertyDescriptor() - JavaScript
s no getter (accessor descriptors only). set A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). 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. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. Examples Using Object.getOwnPropertyDescriptor var o, d; o = { get foo() { return 17; } }; d = Object.getOwnPropertyDescriptor(o, 'foo'); // d is { // configurable: true, // enumerable: true, // get: /*the getter function*/, // set: undefined // } o = { bar: 42 }; d = Object.getOwnPropertyDescriptor(o, 'bar'); // d is { // configurable: true, // enum...
Object.getPrototypeOf() - 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 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.getPrototypeOf('foo'); // TypeError: "foo" is not an object (ES5 code) Object.getProt...
Object.isExtensible() - JavaScript
The Object.isExtensible() method determines if 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(). ...
Object.isFrozen() - 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 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({}); // === false // An empty object which is not extensible // is vacuously frozen. var vacuouslyFrozen = Object.preventExtensions({}); Ob...
Object.prototype.isPrototypeOf() - JavaScript
For example, check if baz object descends from Foo.prototype: if (Foo.prototype.isPrototypeOf(baz)) { // do something safe } Specifications Specification ECMAScript (ECMA-262)The definition of 'Object.prototype.isPrototypeOf' in that specification. ...
handler.defineProperty() - JavaScript
w Proxy({}, { defineProperty: function(target, prop, descriptor) { console.log('called: ' + prop); 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 ...
handler.ownKeys() - JavaScript
rap 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 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']; } }); cons...
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 thro...
RangeError - JavaScript
ing a value that is not one of the allowed string values to String.prototype.normalize(), or when attempting to create an array of an illegal length with the Array constructor, or when passing bad values to the numeric methods Number.prototype.toExponential(), Number.prototype.toFixed() or Number.prototype.toPrecision(). Constructor RangeError() Creates a new RangeError object. Instance properties RangeError.prototype.message Error message. Although ECMA-262 specifies that RangeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. RangeError.prototype.name Error name. Inherited from Error. RangeError.prototype.fileName Path to file that raised this error. Inherited from Error. RangeError.prototype.lineNumber Line number in file that ...
ReferenceError - JavaScript
Although ECMA-262 specifies that ReferenceError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. ReferenceError.prototype.name Error name. Inherited from Error. ReferenceError.prototype.fileName Path to file that raised this error. Inherited from Error. ReferenceError.prototype.lineNumber Line number in file that raised this error. ...
Reflect.deleteProperty() - JavaScript
It is like the delete operator as a 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 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. ...
Reflect.getPrototypeOf() - 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.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.getProto...
RegExp.prototype.exec() - JavaScript
his interactive example is stored in a GitHub repository. If you'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. Description Consider the following example: // Match "quick brown" followed by "jumps"...
Set - JavaScript
is strictly equal to -0) and -0 were different values. However, this was changed in the ECMAScript 2015 specification. See "Key equality for -0 and 0" in the browser compatibility table for details. NaN and undefined can also be stored in a Set. All NaN values are equated (i.e. NaN is considered the same as NaN, even though NaN !== NaN). Constructor Set() Creates a new Set object. Static properties get Set[@@species] The constructor function that is used to create derived objects. Instance properties Set.prototype.size Returns the number of values in the Set object. Instance methods Set.prototype.add(value) Appends value to the Set object. Returns the Set object. Set.prototype.clear() Removes all elements from the Set object. Set.prototype.delete(value) Removes the eleme...
SharedArrayBuffer - JavaScript
ors 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 builtin SharedArrayBuffer constructor // without new is forbidden var sab = new SharedArrayBuffer(1024); Constructor SharedArrayBuffer() Creates a new SharedArrayBuffer object. Instance properties SharedArrayBuffer.prototype.byteLength The size, in bytes, of the array. This is established when the array is constructed and cannot be changed. Read only. Instance methods SharedArrayBuffer.prototype.slice(begin, end) Returns a new SharedArrayBuffer whose contents are a copy of this SharedArrayBuffer's bytes from begin, inclusive, up to end, exclusive. If either begin or end is negati...
String.prototype.big() - JavaScript
Syntax str.big() Return value A string containing a <big> HTML element. Description The big() method embeds a string in a <big> tag: "<big>str</big>". ...
String.prototype.fontcolor() - JavaScript
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. ...
String.prototype.fontsize() - JavaScript
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. ...
String.prototype.match() - JavaScript
n 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 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. ...
Symbol.isConcatSpreadable - JavaScript
Array-like objects For array-like objects, the default is to not spread. Symbol.isConcatSpreadable needs to be set to true in order to get a flattened array: let x = [1, 2, 3] let fakeArray = { [Symbol.isConcatSpreadable]: true, length: 2, 0: 'hello', 1: 'world' } x.concat(fakeArray) // [1, 2, 3, "hello", "world"] Note: The length property is used to control the number of object properties to be added. In the above example, length:2 indicates two properties has to be added. Specifications Specification ECMAScript (ECMA-262)The definition of 'Symbol.isconcatspreadable' in that specification. ...
SyntaxError - JavaScript
The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or token order that does not conform to the syntax of the language when parsing code. Constructor SyntaxError() Creates a new SyntaxError object. Instance properties SyntaxError.prototype.message Error message. Although ECMA-262 specifies that SyntaxError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. SyntaxError.prototype.name Error name. Inherited from Error. SyntaxError.prototype.fileName Path to file that raised this error. Inherited from Error. SyntaxError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. SyntaxError.prototype.columnNumber ...
TypeError() constructor - JavaScript
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. ...
URIError - JavaScript
Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. URIError.prototype.name Error name. Inherited from Error. URIError.prototype.fileName Path to file that raised this error. Inherited from Error. URIError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. ...
WebAssembly.CompileError - JavaScript
Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.CompileError.prototype.name Error name. Inherited from Error. WebAssembly.CompileError.prototype.fileName Path to file that raised this error. Inherited from Error. ...
WebAssembly.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. 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...
WebAssembly.Global - JavaScript
le instance, accessible from both JavaScript and importable/exportable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules. Constructor WebAssembly.Global() 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'...
WebAssembly.Instance - JavaScript
Read-only. ...
WebAssembly.LinkError - JavaScript
Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.LinkError.prototype.name Error name. Inherited from Error. WebAssembly.LinkError.prototype.fileName Path to file that raised this error. ...
WebAssembly.Memory - JavaScript
The WebAssembly.Memory object is a resizable ArrayBuffer or SharedArrayBuffer that holds the raw bytes of memory accessed by a WebAssembly Instance. A memory created by JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript and WebAssembly. Constructor WebAssembly.Memory() Creates a new Memory object. Instance properties Memory.prototype.buffer An accessor property that returns the buffer contained in the memory. Instance methods Memory.prototype.grow() Increases the size of the memory instance by a specified number of WebAssembly pages (each one is 64KB in size). Examples Creating a new Memory object There are two ways to get a WebAssembly.Memory object. The first way is to construct it from JavaScript. The following example creates a new WebAss...
WebAssembly.Module - JavaScript
A WebAssembly.Module object contains stateless WebAssembly code that has already been compiled by the browser -- this can be efficiently shared with Workers, and instantiated multiple times. Constructor WebAssembly.Module() Creates a new Module object. Static properties WebAssembly.Module.customSections() Given a Module and string, returns a copy of the contents of all custom sections in the module with the given string name. WebAssembly.Module.exports() Given a Module, returns an array containing descriptions of all the declared exports. WebAssembly.Module.imports() Given a Module, returns an array containing descriptions of all the declared imports. Examples Sending a compiled module to a worker The following example (see our index-compile.html demo on GitHub, and view it live...
WebAssembly.RuntimeError - JavaScript
Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.RuntimeError.prototype.name Error name. Inherited from Error. WebAssembly.RuntimeError.prototype.fileName Path to file that raised this error. ...
WebAssembly.Table - JavaScript
an array-like structure representing a WebAssembly Table, which stores function references. A table created by JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript and WebAssembly. Note: Tables can currently only store function references, but this will likely be expanded in the future. Constructor WebAssembly.Table() Creates a new Table object. Instance properties Table.prototype.length Returns the length of the table, i.e. the number of elements. Instance methods Table.prototype.get() Accessor function -- gets the element stored at a given index. Table.prototype.grow() Increases the size of the Table instance by a specified number of elements. Table.prototype.set() Sets an element stored at a given index to a given value. Examples Creatin...
WebAssembly - JavaScript
mary uses for the WebAssembly object are: Loading WebAssembly code, using the WebAssembly.instantiate() function. Creating new memory and table instances via the WebAssembly.Memory()/WebAssembly.Table() constructors. Providing facilities to handle errors that occur in WebAssembly via the WebAssembly.CompileError()/WebAssembly.LinkError()/WebAssembly.RuntimeError() constructors. Constructor properties WebAssembly.CompileError() Indicates an error during WebAssembly decoding or validation. WebAssembly.Global() Represents 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. WebAssembly.Instance() Is a stateful, executable instance of a WebAssembly.Module Web...
globalThis - JavaScript
n 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. HTML and the WindowProxy In many engines globalThis will be a reference to the act...
instanceof - JavaScript
a different context, you can use myNode instanceof myNode.ownerDocument.defaultView.SVGElement. Note for Mozilla developers: In code using XPCOM, instanceof has special effect: obj instanceof xpcomInterface (e.g. Components.interfaces.nsIFile) calls obj.QueryInterface(xpcomInterface) and returns true if QueryInterface succeeded. A side effect of such call is that you can use xpcomInterface's properties on obj after a successful instanceof test. Unlike standard JavaScript globals, the test obj instanceof xpcomInterface works as expected, even if obj is from a different scope. Examples Demonstrating that String and Date are of type Object and exceptional cases The following code uses instanceof to demonstrate that String and Date objects are also of type Object (they are derived from Object).
yield - JavaScript
ssion following 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...
Expressions and operators - JavaScript
t. -= Subtraction assignment <<= Left shift assignment. >>= Right shift assignment. >>>= Unsigned right shift assignment. &= Bitwise AND assignment. ^= Bitwise XOR assignment. |= Bitwise OR assignment. &&= Logical AND assignment. ||= Logical OR assignment. ??= Logical nullish assignment. [a, b] = [1, 2] {a, b} = {a:1, b:2} Destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals. Comma operator , The comma operator allows multiple expressions to be evaluated in a single statement and returns the result of the last expression. Specifications Specification ECMAScript (ECMA-262)The definition of 'ECMAScript Language: Expressions' in that specification.
for await...of - JavaScript
ject. 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 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...
function declaration - JavaScript
ion name([param[, param,[..., param]]]) { [statements] } name The function name. param Optional The name of an argument to be passed to the function. Maximum number of arguments varies in different engines. statements Optional The statements which comprise the body of the function. Description A function created with a function declaration is a Function object and has all the properties, methods and behavior of Function objects. See Function for detailed information on functions. A function can also be created using an expression (see function 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...
import.meta - JavaScript
module, like the module's URL. Syntax import.meta Description The syntax consists of the keyword import, a dot, and the identifier meta. Normally the left-hand side of the dot is the object on which property access is performed, but here import is not really an object. The import.meta object is created by the ECMAScript implementation, with a null prototype. The object is extensible, and its properties are writable, configurable, and enumerable. Examples Using import.meta Given a module my-module.js <script type="module" src="my-module.js"></script> you can access meta information about the module using the import.meta object. console.log(import.meta); // { url: "file:///home/user/my-module.js" } It returns an object with a url property indicating the base URL of the module. This will e...
let - JavaScript
to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope. The other difference between var and let is that the latter is initialized to a value only when a parser evaluates it (see below). 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. Examples Scoping rules Variables declared by let have their scope in the block for which they are defined, as well as in any contained sub-blocks. In this way, let works very much like var. The main difference is that the scope of a var variable is the entire...
throw - JavaScript
ption 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 object You can specify an object when you throw an exception. You can then reference the object's properties in the catch block. The following example creates an object of type UserException and uses it in a throw statement. function UserException(message) { this.message = message; this.name = 'UserException'; } function getMonthName(mo) { mo = mo - 1; // Adjust month number for array index (1 = Jan, 12 = Dec) var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'...
with - JavaScript
ad of this scope chain during the evaluation of its statement body. If an unqualified name used in the body matches a property in the scope chain, then the name is bound to the property and the object containing the property. Otherwise a ReferenceError is thrown. Using with is not recommended, and is forbidden in ECMAScript 5 strict mode. The recommended alternative is to assign the object whose properties you want to access to a temporary variable. Performance pro & contra Pro: The with statement can help reduce file size by reducing the need to repeat a lengthy object reference without performance penalty. The scope chain change required by 'with' is not computationally expensive. Use of 'with' will relieve the interpreter of parsing repeated object references. Note, however, that in many cases...
Statements and declarations - JavaScript
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 executed for the value of each ...
Transitioning to strict mode - JavaScript
l = this; // in the top-level context, "this" always // refers to the global object function f(x) { 'use strict'; var a = 12; global.b = a + x * 35; } f(42); Trying to delete a non-configurable property 'use strict'; delete Object.prototype; // error! In non-strict, this would silently fail, in contradiction with the user expectation. Poisoned arguments and function properties Accessing arguments.callee, arguments.caller, anyFunction.caller, or anyFunction.arguments throws an error in strict mode. The only legitimate use case would be to reuse a function as in: // example taken from vanillajs: http://vanilla-js.com/ var s = document.getElementById('thing').style; s.opacity = 1; (function() { if ((s.opacity-=.1) < 0) s.display = 'none'; else setTimeout(arg...
Trailing commas - JavaScript
If you want to add a new property, you can simply add a new line without modifying the previously last line if that line already uses a trailing comma. This makes version-control diffs cleaner and editing code might be less troublesome. JavaScript has allowed trailing commas in array literals since the beginning, and later added them to object literals (ECMAScript 5) and most recently (ECMAScript 2017) to function parameters. JSON, however, disallows trailing commas. ...
Web app manifests
propriate extensions like .json (Content-Type: application/json). Note: If the manifest requires credentials to fetch - the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page. Splash screens In Chrome 47 and later, a splash screen is displayed for sites launched from a homescreen. This splashscreen is auto-generated from properties in the web app manifest, specifically: name background_color The icon in the icons array that is closest to 128dpi for the device. Specifications Specification Status Comment Web App Manifest Working Draft Initial definition. ...
<mo> - MathML
Web › MathML › Element › mo
ovided 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, 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. (...
Web audio codec guide - Web media technologies
ners typically support a specific subset of the available codecs. What kind of audio content will the codec be handling? Certain codecs are specifically designed for voice-only content (they take advantage of the reduced frequency range needed for human speech). Others may have an algorithmic tendency to perform worse when encoding specific genres of music. What bit rates and other configurable properties does each codec have that may make it a good (or poor) choice? To what extent, if at all, does latency matter for your needs? If you need sound that is very precisely timed, the lower the latency the better. How much compression do you need to achieve? Let's consider a few common scenarios to get a feel for the decision-making process. Example: Music for streaming For streaming music, you w...
Digital audio concepts - Web media technologies
entation for the encoding software you use to determine which options are available, which will depend on the codec and the encoding software itself. Some codecs have a number of values you can adjust (some of which may require a deep understanding of both psychoacoustics and of the codec's algorithms), and others offer a simple "quality" parameter you can set, which automatically adjusts various properties of the algorithm. Bit rate There are two mutually-exclusive ways to control the quality of the compressed audio using the bit rate. The first involves targeting an average bit rate for the encoded data, while the second involves specifying a constant quality value to target while allowing the bit rate to vary. Average bit rate The first method for controlling the quality of the output file...
Image file type and format guide - Web media technologies
Group 4 (and, for older fax systems, Group 3) compression systems used for by fax software, as well as LZW and lossy JPEG compression. Every value in a TIFF file is specified using its tag (indicating what kind of information it is, such as the width of the image) and its type (indicating the format the data is stored in), followed by the length of the array of values to assign to that tag (all properties are stored in arrays, even for single values). This allows different data types to be used for the same properties. For example, the width of an image, ImageWidth, is stored using tag 0x0100, and is a one-entry array. By specifying type 3 (SHORT), the value of ImageWidth is stored as a 16-bit value: Tag Type Size Value 0x0100 (ImageWidth) 0x0003 (SHORT) ...
Web video codec guide - Web media technologies
e a bit rate of no more than 800 Mbps shared between the video and audio tracks. You will likely need to adjust these values depending on hardware performance, your requirements, and the specific codecs you choose to use. This bit rate is obviously not realistic for network transmission and would likely only be used locally. Breaking down the value of the codecs parameter into its dot-delineated properties, we see the following: Value Desccription av01 The four-character code (4CC) designation identifying the AV1 codec. 2 The profile. A value of 2 indicates the Professional profile. A value of 1 is the High profile, while a value of 0 would specify the Main profile. 19H The level and tier. This value comes from the table in section A.3 of the AV1...
Using images in HTML - Web media technologies
Web › Media › images
HTML <img> The HTML <img> element is used to embed an image in a webpage. ...
CSS and JavaScript animation performance - Web Performance
witched to requestAnimationFrame() by clicking the toggle button. Try running them both now, comparing the FPS for each (the first purple box.) You should see that the performance of CSS animations and requestAnimationFrame() are very close. Off main thread animation Even given the test results above, we'd argue that CSS animations are the better choice. But how? The key is that as long as the properties we want to animate do not trigger reflow/repaint (read CSS triggers for more information), we can move those sampling operations out of the main thread. The most common property 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 OffMainThreadCompos...
Critical rendering path - Web Performance
g to jank if required during scrolling or other animations. While a 20ms delay on load or orientation change may be fine, it will lead to jank on animation or scroll. Any time the render tree is modified, such as by added nodes, altered content, or updated box model styles on a node, layout occurs. To reduce the frequency and duration of layout events, batch updates and avoid animating box model properties. Paint The last step is painting the pixels to the screen. Once the render tree is created and layout occurs, the pixels can be painted to the screen. Onload, the entire screen is painted. After that, only impacted areas of the screen will be repainted, as browsers are optimized to repaint the minimum area required. Paint time depends on what kind of updates are being applied to the render tree...
Performance fundamentals - Web Performance
y applications use transitions or animations through "pages", or "panels". For example, the user taps a "Settings" button to transition into an application configuration screen, or a settings menu "pops up". Firefox is highly optimized to transition and animate scenes that: use pages/panels approximately the size of the device screen or smaller transition/animate the CSS transform and opacity properties Transitions and animations that adhere to these guidelines can be offloaded to the system compositor and run maximally efficiently. Memory and power usage Improving memory and power usage is a similar problem to speeding up startup: don't do unneeded work or lazily load uncommonly-used UI resources. Do use efficient data structures and ensure resources like images are optimized well. Modern ...
Introduction to progressive web apps - Progressive web apps (PWAs)
colors in a JSON-formatted manifest file. This is for use in contexts such as app listings and device home screens. Installability A core part of the web app experience is for users to have app icons on their home screen, and be able to tap to open apps into their own native container that feels nicely integrated with the underlying platform. Modern web apps can have this native app feel via properties set inside the Web app manifest, and via a feature available in modern smartphone browsers called web app installation. Linkability One of the most powerful features of the web is the ability to link to an app at a specific URL without the need for an app store or complex installation process. This is how it has always been. Network independence Modern web apps can work when the network i...
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
Note: References to SVG in external files must be to the same origin as the referencing document. Using embedded SVG To apply an SVG effect using CSS styles, you first need to create the CSS style that references the SVG to apply. ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. alignment-baseline baseline-shift clip clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering cursor direction display dominant-baseline enable-background fill fill-opacity fill-rule filter flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering solid-color solid-opacity stop-color stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-linecap ...
attributeType - SVG: Scalable Vector Graphics
buteName 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 implementation should match the attributeName to an attribute for the target element. User agents first search through the list of CSS properties for a matching property name, and if none is found, search the default XML namespace for the element. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'attributeType' in that specification. Recommendation Initial definition ...
direction - SVG: Scalable Vector Graphics
It also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. ...
fill - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fill
...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
manner may contain ligatures or other glyph combining and reordering common to the language and script. (This presentation form does not disable auto-ligature formation or similar context-driven variations.) The determination of which characters should be auto-rotated may vary across user agents. The determination is based on a complex interaction between country, language, script, character properties, font, and character context. <angle> The value of the angle is restricted to 0, 90, 180, and 270 degrees. If another angle is specified, it is rounded to the closest of the permitted values. A value of 0deg indicates that 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 ref...
href - SVG: Scalable Vector Graphics
Web › SVG › Attribute › href
the target of the given animation element. If the URL points to multiple target elements, if the given target element is not capable of being a target of the given animation element, or if the given target element is not part of the current document, then the animation element will not affect any target element. However, the animation element will still operate normally with regard to its timing 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 ...
maskUnits - SVG: Scalable Vector Graphics
The maskUnits attribute indicates which coordinate system to use for the geometry properties of the <mask> element. Only one element is using this attribute: <mask> html,body,svg { height:100% } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <mask id="myMask1" maskUnits="userSpaceOnUse" x="20%" y="20%" width="60%" height="60%"> <rect fill="black" x="0" y="0" width="100%" height="100%" /> <circle fill="white" cx="50" cy="50" r="35" /> </mask> <mask id="myMask2" maskUnits="objectBoundingBox" x="20%" y="20%" width="60%" height="60%"> <rect fill="black" x="0" y="0" width="100%" height="100%" /> <circle fill="white" cx="50" cy="50" r="35" /> </mask> <!-- Some reference rect to materialized the mask --> <rect id="r1" x="0" y="0" w...
requiredFeatures - SVG: Scalable Vector Graphics
ed features are supported by the browser. See Feature strings below for a list of allowed values. Feature strings The following are the feature strings for the requiredFeatures attribute. These same feature strings apply to the hasFeature method call that is part of the SVG DOM's support for the DOMImplementation interface. In some cases the feature strings map directly to a set of attributes, properties or elements, in others they represent some functionality of the browser. Note that the format and naming for feature strings changed from SVG 1.0 to SVG 1.1. The SVG 1.0 feature strings are not listed here but can be found in the SVG Specification. Some browser support SVG 1.0 Feature strings for compatibility reasons. However, the SVG 1.0 feature strings are considered deprecated. http://www.
stroke - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stroke
...
writing-mode - SVG: Scalable Vector Graphics
whether the initial inline-progression-direction for a <text> element shall be left-to-right, right-to-left, or top-to-bottom. The writing-mode attribute applies only to <text> elements; the attribute is ignored for <tspan>, <tref>, <altGlyph> and <textPath> sub-elements. (Note that the inline-progression-direction can change within a <text> element due to the Unicode bidirectional 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 V...
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
tes id, lang, tabindex, xml:base, xml:lang, xml:space Style Attributes class, style Conditional Processing Attributes externalResourcesRequired, requiredExtensions, requiredFeatures, systemLanguage. XLink Attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate Presentation Attributes Note that all SVG presentation attributes can be used as CSS properties. alignment-baseline, baseline-shift, clip, clip-path, clip-rule, color, color-interpolation, color-interpolation-filters, color-profile, color-rendering, cursor, direction, display, dominant-baseline, enable-background, fill, fill-opacity, fill-rule, filter, flood-color, flood-opacity, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight, glyph-orientatio...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
th>|<percentage> ; Default value: 0; Animatable: yes r The radius of the circle. A value lower or equal to zero disables rendering of the circle. Value type: <length> ; Default value: 0; Animatable: yes pathLength The total length for the circle's circumference, in user units. Value type: <number> ; Default value: none; Animatable: yes Note: Starting with SVG2, cx, cy, and r are Geometry Properties, meaning those attributes can also be used as CSS properties for that element. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, c...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
: auto|<length>|<percentage> ; Default value: auto; Animatable: yes ry The radius of the ellipse on the y axis. Value type: auto|<length>|<percentage> ; Default value: auto; Animatable: yes pathLength This attribute lets specify the total length for the path, in user units. Value type: <number> ; Default value: none; Animatable: yes Note: Starting with SVG2 cx, cy, rx and ry are Geometry Properties, meaning those attributes can also be used as CSS properties for that element. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, c...
<font-face> - SVG: Scalable Vector Graphics
Web › SVG › Element › font-face
Usage context CategoriesFont elementPermitted contentAny number of descriptive elements >> and at most one <font-face> element, in any order. ...
<foreignObject> - SVG: Scalable Vector Graphics
The width of the foreignObject. Value type: <length>|<percentage> ; Default value: auto; Animatable: yes x The x coordinate of the foreignObject. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes y The y coordinate of the foreignObject. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes Note: Starting with SVG2, x, y, width, and height are Geometry Properties, meaning those attributes can also be used as CSS properties for that element. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes, Document event attributes, Document element event attributes ...
<hatch> - SVG: Scalable Vector Graphics
Web › SVG › Element › hatch
Paths are defined by <hatchpath> elements. ...
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
The <marker> element defines the graphic that is to be used for drawing arrowheads or polymarkers on a given <path>, <line>, <polyline> or <polygon> element. Markers are attached to shapes using the marker-start, marker-mid, and marker-end properties. html,body,svg { height:100% } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <defs> <!-- arrowhead marker definition --> <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> <!-- simple dot marker definition --> <marker id="dot" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="5" markerHeight="5"> <circle cx="5" cy="5" r="5" fill="red" /> </marker> </defs...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
lt value: auto; Animatable: yes ry The vertical corner radius of the rect. Defaults to rx if it is specified. Value type: auto|<length>|<percentage> ; Default value: auto; Animatable: yes pathLength The total length of the rectangle's perimeter, in user units. Value type: <number> ; Default value: none; Animatable: yes Note: Starting with SVG2, x, y, width, height, rx and ry are Geometry Properties, meaning those attributes can also be used as CSS properties for that element. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, c...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
atable: yes x The displayed x coordinate of the svg container. No effect on outermost svg elements. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes y The displayed y coordinate of the svg container. No effect on outermost svg elements. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes Note: Starting with SVG2, x, y, width, and height are Geometry Properties, meaning these attributes can also be used as CSS properties. Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes, Document event attributes, Document element event attributes Presentation Attr...
<switch> - SVG: Scalable Vector Graphics
Web › SVG › Element › switch
requiredFeatures, requiredExtensions and systemLanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true. Other direct children will be bypassed and therefore not rendered. If a child element is a container element, like <g>, then its subtree is also processed/rendered or bypassed/not rendered. The display and visibility properties have no effect on <switch> element processing. In particular, setting display:none on a child has no effect on the true/false testing for <switch> processing. Usage context CategoriesContainer elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elements<a>, <foreignObject>, <g>, <image>, <svg>, <switch>, <text>, <use> Attribut...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
, a reference to a <symbol> by a <use> element) are rendered. That means that some browsers could refuse to directly display a <symbol> element even if the CSS display property tells otherwise. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of '<symbol>' in that specification. Candidate Recommendation Allowed geometry properties to be specified on a symbol Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<symbol>' in that specification. Recommendation Initial definition ...
Basic shapes - SVG: Scalable Vector Graphics
<< PreviousNext >> There are several basic shapes used for most SVG drawing. The purpose of these shapes is fairly obvious from their names. Some of the parameters that determine their position and size are given, but an element reference would probably contain more accurate and complete descriptions along with other properties that won't be covered in here. However, since they're used in most SVG documents, it's necessary to give them some sort of introduction. Basic shapes To insert a shape, you create an element in the document. Different elements correspond to different shapes and take different parameters to describe the size and position of those shapes. Some are slightly redundant in that they can be created by other shapes, but they're all there for your convenience and to ...
Basic Transformations - SVG: Scalable Vector Graphics
Actually, that's its only purpose. An example: <svg width="30" height="10"> <g fill="red"> <rect x="0" y="0" width="10" height="10" /> <rect x="20" y="0" width="10" height="10" /> </g> </svg> All following transformations are summed up in an element's transform attribute. Transformations can be chained simply by concatenating them, separated by whitespace. ...
Getting started - SVG: Scalable Vector Graphics
nward from the top left corner). The text "SVG" is drawn. The interior of each letter is filled in with white. The text is positioned by setting an anchor where we want the midpoint to be: in this case, the midpoint should correspond to the center of the green circle. Fine adjustments can be made to the font size and vertical position to ensure the final result is aesthetically pleasing. Basic properties of SVG files The first important thing to notice is the order of rendering elements. The globally valid rule for SVG files is, that later elements are rendered atop previous elements. The further down an element is the more it will be visible. SVG files on the web can be displayed directly in the browser or embedded in HTML files via several methods: If the HTML is XHTML and is delivere...
SVG fonts - SVG: Scalable Vector Graphics
ed via a URI (see below). The horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. The value 1000 sets a reasonable value to work with. There are several accompanying attributes that help further define the basic glyph-box layout. The <font-face> element is the SVG equivalent of the CSS @font-face declaration. It defines basic properties of the final font such as weight, style, etc. In the example above the first and most important to be defined is font-family, the value of which can then be referenced in CSS and SVG font-family properties. 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 exampl...
Secure contexts - Web security
er a non-secure context happened to be used to create it. Locally-delivered resources such as those with http://127.0.0.1 URLs, http://localhost URLs (under certain conditions), and file:// URLs are also considered to have been delivered securely. Resources that are not local, to be considered secure, must meet the following criteria: must be served over https:// or wss:// URLs the security properties of the network channel used to deliver the resource must not be considered deprecated Feature detection Pages can use feature detection to check whether they are in a secure context or not by using the isSecureContext boolean, which is exposed on the global scope. if (window.isSecureContext) { // Page is a secure context so service workers are now available navigator.serviceWorker.registe...
Tutorials
ds Design layouts that fluidly resize with the browser window, while still using a typographic grid. CSS Challenges Flex your CSS skills, and see where you need more practice. Advanced level Using CSS transforms Apply rotation, skewing, scaling, and translation using CSS. CSS transitions CSS transitions, part of the draft CSS3 specification, provide a way to animate changes to CSS properties, instead of having the changes take effect instantly. Quick Guide to Implement Web Fonts (with @font-face) The @font-face feature from CSS3 allows you to use custom typefaces on the web in an accessible, manipulatable, and scalable way. Starting to Write CSS An introduction to tools and methodologies to write more succinct, maintainable, and scalable CSS. Canvas tutorial Learn...
Using custom elements - Web Components
e to inform us when the element is either removed from the DOM, or moved to a different page: disconnectedCallback() { 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. 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 th...
Introduction to using XPath in JavaScript - XPath
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). 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. numberValue stringValue booleanValue Example The following uses the XPath expression count(//p) to obtain the number of <p> elements in an HTML document: var paragraphCount = document.evaluate( 'count(//p)', document, null, XPathResult.ANY_TYPE, null ); alert( 'This document contains ' + paragraphCount.numberValue + ' paragraph elements' ); Alth...
XPath
used to test addressed nodes within a document to determine whether they match a pattern or not. XPath is mainly used in XSLT, but can also be used as a much more powerful way of navigating through the DOM of any XML-like language 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 t...
An Overview - XSLT: Extensible Stylesheet Language Transformations
his representation, called the tree, is what is actually manipulated by the processor. The tree is an abstract datatype, a conceptual model which can be implemented in various ways depending on the parser and the processor. :Netscape's uses a structure similar to the W3C DOM as its tree structure, but others are possible. The only requirements concern the disposition of objects in the tree, their properties, and their relationships. The tree consists of a hierarchical framework of nodes. It can be made up of seven different types of nodes: the single root node, element nodes, text nodes, attribute nodes, comment nodes, processing instruction nodes, and namespace nodes. At the top of the tree is the root node. The root node does not correspond to any individual part of the XML document: it repres...
Understanding WebAssembly text format - WebAssembly
s: they have a signature that WebAssembly validation checks statically, and they are given an index and can be named and called. JavaScript functions have no notion of signature, so any JavaScript function can be passed, regardless of the import's declared signature. Once a module declares an import, the caller of WebAssembly.instantiate() must pass in an import object that has the corresponding properties. For the above, we need an object (let's call it importObject) such that importObject.console.log is a JavaScript function. This would look like the following: var importObject = { console: { log: function(arg) { console.log(arg); } } }; WebAssembly.instantiateStreaming(fetch('logger.wasm'), importObject) .then(obj => { obj.instance.exports.logIt(); }); Note: You c...
Using the WebAssembly JavaScript API - WebAssembly
one or more WebAssembly.Module instances. This is very useful, as it allows dynamic linking of multiple modules. To create a WebAssembly global instance from inside your JavaScript, you use the WebAssembly.Global() constructor, which looks like this: const global = new WebAssembly.Global({value:'i32', mutable:true}, 0); You can see that this takes two parameters: An object that contains two properties describing the global variable: value: its data type, which can be any data type accepted within WebAssembly modules -- i32, i64, f32, or f64. mutable: a boolean defining whether the value is mutable or not. A value containing the variable's actual value. This can be any value, as long as its type matches the specified data type. So how do we use this? In the following example we...