Search completed in 0.95 seconds.
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 worker
globalscope for web workers.
globaleventhandlers.onabort is an eventhandler representing the code to be called when the abort event is raised. ...
...rties 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 worker
globalscope for web workers.
globaleventhandlers.onabort is an eventhandler representing the code to be called when the abort event is raised.
globaleventhandlers.onanimationcancel an eventhandler called when an animationcancel event is sent, indicating that a running css animation has been canceled. ...
...nthandlers mixin, and implemented by htmlelement, document, window, as well as by worker
globalscope for web workers.
globaleventhandlers.onabort is an eventhandler representing the code to be called when the abort event is raised.
globaleventhandlers.onanimationcancel an eventhandler called when an animationcancel event is sent, indicating that a running css animation has been canceled.
globaleventhandlers.onanimationend an eventhandler called when an animationend event is sent, indicating that a css animation has stopped playing. ...
...And 41 more matches
WebAssembly.Global() constructor - JavaScript
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. ...
...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. ...
...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. ...
...And 14 more matches
WorkerGlobalScope - Web APIs
the worker
globalscope interface of the web workers api is an interface representing the scope of any worker. workers have no browsing context; this scope contains the information usually conveyed by window objects — in this case event handlers, the console or the associated workernavigator object. each worker
globalscope has its own event loop. this interface is usually specialized by each worker type: dedicatedworker
globalscope for dedicated workers, sharedworker
globalscope for shared workers, and serviceworker
globalscope for serviceworker. the self property returns the specialized scope for each context. properties this interface inherits properties from the eventtarget interface and windoworworker
globalscope and windoweventhandlers mixins. ...
...d by each worker type: dedicatedworker
globalscope for dedicated workers, sharedworker
globalscope for shared workers, and serviceworker
globalscope for serviceworker. the self property returns the specialized scope for each context. properties this interface inherits properties from the eventtarget interface and windoworworker
globalscope and windoweventhandlers mixins. standard properties worker
globalscope.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. worker
globalscope.self read only returns a reference to the worker
globalscope itself. ...
...thandlers mixins. standard properties worker
globalscope.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. worker
globalscope.self read only returns a reference to the worker
globalscope itself. most of the time it is a specific scope like dedicatedworker
globalscope, sharedworker
globalscope or serviceworker
globalscope. worker
globalscope.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 worker
globalscope.performance read only returns the performance associated with the worker. it is a ...
...And 13 more matches
globalThis - JavaScript
the
global globalthis property contains the
global this value, which is akin to the
global 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. property attributes of
globalthis writable yes enumerable no configurable yes description historically, accessing the
global object has required different syntax in different javascript environments. on the web you can use window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use
global. the this keyword could be ...
...orkers only self will work. in node.js none of these work, and you must instead use
global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('return this')(), but environments that disable eval(), like csp in browsers, prevent use of function in this way. the
globalthis property provides a standard way of accessing the
global this value (and hence the
global object itself) across environments. unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. ...
...('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. ...
...And 13 more matches
WebAssembly.Global - JavaScript
a webassembly.
global object 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. 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". ...
...from the
global() constructor's prototype object — this can be modified to affect all
global instances. instance properties
global.prototype.constructor returns the function that created this object's instance. by default this is the webassembly.
global() constructor.
global.prototype[@@tostringtag] the initial value of the @@tostringtag property is the string value "webassembly.
global".
global.prototype.value the value contained inside the
global variable — this can be used to directly set and get the
global's value. instance methods
global.prototype.valueof() old-style method that returns the value contained inside the
global variable. ...
...e[@@tostringtag] the initial value of the @@tostringtag property is the string value "webassembly.
global".
global.prototype.value the value contained inside the
global variable — this can be used to directly set and get the
global's value. instance methods
global.prototype.valueof() old-style method that returns the value contained inside the
global variable. examples creating a new
global instance the following example shows a new
global instance being created using the webassembly.
global() constructor. it is being defined as a mutable i32 type, with a value of 0. ...
...And 12 more matches
ServiceWorkerGlobalScope - Web APIs
additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used. ...
... additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used. ...
... mind that the serviceworker state is not persisted across the termination/restart cycle, so each event handler should assume it's being invoked with a bare, default
global state. once successfully registered, a service worker can and will be terminated when idle to conserve memory and processor power. an active service worker is automatically restarted to respond to events, such as serviceworker
globalscope.onfetch or serviceworker
globalscope.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. ...
...And 11 more matches
JS_NewGlobalObject
this article covers features introduced in spidermonkey 17 create a new javascript object for use as a
global object. syntax jsobject * js_new
globalobject(jscontext *cx, const jsclass *clasp, jsprincipals *principals, js::onnew
globalhookoption hookoption, const js::compartmentoptions &options = js::compartmentoptions()); name type description cx jscontext * the context in which to create the new
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp jsclass * the class to use for the new
global object. clasp->flags must have the jsclass_
global_flags bits set. the caller must ensure that the jsclass remains alive thro...
... caller must be in a request on this jscontext. clasp jsclass * the class to use for the new
global object. clasp->flags must have the jsclass_
global_flags bits set. 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. principals jsprincipals * the security information to associate with this compartment. ...
... the new object has no parent. ...
...And 10 more matches
Shell global objects
note: this list overlaps with "built-in functions" in introduction to the javascript shell and is probably not complete. see js/src/shell/js.cpp (around shell_functions) for more. this page lists variables and functions available on spidermonkey 53. there may be some difference between each versions. you can get the list of functions by help() function in js shell. variables scriptargs an array that contains arguments passed to js shell. scriptpath a string that is a path of script. console an object that has following property: log evaluate and print expressions to stdout. ...
...if the property is omitted ...
...if the property is omitted or v is n...
...And 9 more matches
DedicatedWorkerGlobalScope - Web APIs
the dedicatedworker
globalscope 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 worker
globalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. dedicatedworker
globalscope.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. ...
...s properties from the worker
globalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. dedicatedworker
globalscope.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 worker
globalscope worker
globalscope.self returns an object reference to the dedicatedworker
globalscope object itself. worker
globalscope.console read only returns the console associated with the worker. worker
globalscope.location read only returns the workerlocation associated with the worker. workerlocation is a specific location object, mostly a subset of the location for browsing scopes, but adapt...
...cope.self returns an object reference to the dedicatedworker
globalscope object itself. worker
globalscope.console read only returns the console associated with the worker. worker
globalscope.location read only returns the workerlocation associated with the worker. workerlocation is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. worker
globalscope.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. ...
...And 9 more matches
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_get
globalobject(jscontext *cx); name type description cx jscontext * the context from which to retrieve the
global object. description this function is obsolete: use js_get
globalforobject or js_get
globalforscopechain instead. the concept of a
global object belonging to a context will likely be phased out in future versions of spidermonkey. js_get
globalobject retrieves the
global object for a specified jscontext *, cx. this returns ...
...text * the context from which to retrieve the
global object. description this function is obsolete: use js_get
globalforobject or js_get
globalforscopechain instead. the concept of a
global object belonging to a context will likely be phased out in future versions of spidermonkey. js_get
globalobject retrieves the
global object for a specified jscontext *, cx. this returns null if cx has no
global object. spidermonkey supports applications that have multiple
global objects, such as the various window objects in a web browser. the object returned by js_get
globalobject is not necessarily the same thing as the
global object seen by any javascript code that runs in cx! if a function is executing, the
global object used by that function is determined when the function is created. furthermore, s...
..., such as the various window objects in a web browser. the object returned by js_get
globalobject is not necessarily the same thing as the
global object seen by any javascript code that runs in cx! if a function is executing, the
global object used by that function is determined when the function is created. furthermore, some jsapi functions, such as js_executescript, allow the caller to specify a
global object in which the script executes. in either case, the
global function used by the function or script may differ from the context's
global object. the context's
global object field serves two purposes. first, it is a convenient place for the application to stash the
global object, where it is automatically protected from garbage collection and the application can easily access it. second, the c...
...And 7 more matches
Components.utils.getGlobalForObject
this method is used to determine the
global object with which an object is associated. this is the
global object in place at the time the object was created, which is to say the
global object used when executing the script that created the object. ...
... this method is used to determine the
global object with which an object is associated. this is the
global object in place at the time the object was created, which is to say the
global object used when executing the script that created the object. ...
... this method is used to determine the
global object with which an object is associated. this is the
global object in place at the time the object was created, which is to say the
global object used when executing the script that created the object. ...
...And 7 more matches
SharedWorkerGlobalScope - Web APIs
the sharedworker
globalscope 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 worker
globalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. sharedworker
globalscope.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. ...
...face inherits properties from the worker
globalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. sharedworker
globalscope.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. sharedworker
globalscope.applicationcache read only this property returns the applicationcache object for the worker (see using the application cache). properties inherited from worker
globalscope worker
globalscope.self returns an object reference to the dedicatedworker
globalscope object itself. ...
...ed using the sharedworker() constructor. this is mainly useful for debugging purposes. sharedworker
globalscope.applicationcache read only this property returns the applicationcache object for the worker (see using the application cache). properties inherited from worker
globalscope worker
globalscope.self returns an object reference to the dedicatedworker
globalscope object itself. worker
globalscope.console read only returns the console associated with the worker. worker
globalscope.location read only returns the workerlocation associated with the worker. workerlocation is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. worker
globalscope.navigator read only returns the workernavigator associated with the worker. workernavig...
...And 6 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
the setinterval() method, offered on the window and worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call. it returns an interval id which uniquely identifies the interval, so you can remove it later by calling clearinterval(). this method is defined by the windoworworker
globalscope mixin. syntax var intervalid = scope.setinterval(func, [delay, arg1, arg2, ...]); var intervalid = scope.setinterval(function[, delay]); var intervalid = scope.setinterval(code, [delay]); parameters func a function to be executed every delay milliseconds. the function is not passed any arguments, and no return value is expected. code an optional syntax allows you to include a string instead of a function, which is compiled and executed every de...
...tional arguments to setinterval() in the first syntax does not work in internet explorer 9 and earlier. if you want to enable this functionality on that browser, you must use a polyfill (see the callback arguments section). return value the returned intervalid is a numeric, non-zero value which identifies the timer created by the call to setinterval(); this value can be passed to windoworworker
globalscope.clearinterval() to cancel the timeout. it may be helpful to be aware that setinterval() and settimeout() share the same pool of ids, and that clearinterval() and cleartimeout() can technically be used interchangeably. for clarity, however, you should try to always match them to avoid confusion when maintaining your code. note: the delay argument is converted to a signed 32-bit integer. thi...
... the "this" problem when you pass a method to setinterval() or any other function, it is invoked with the wrong this value. this problem is explained in detail in the javascript reference. explanation code executed by setinterval() runs in a separate execution context than the function from which it was called. as a consequence, the this keyword for the called function is set to the window (or
global) object, it is not the same as the this value for the function that called settimeout. see the following example (which uses settimeout() instead of setinterval() – the problem, in fact, is the same for both timers): myarray = ['zero', 'one', 'two']; myarray.mymethod = function (sproperty) { alert(arguments.length > 0 ? this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,...
...And 6 more matches
nsIGlobalHistory2
note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...And 4 more matches
WindowOrWorkerGlobalScope - Web APIs
the windoworworker
globalscope mixin describes several features common to the window and worker
globalscope interfaces. each of these interfaces can, of course, add more features in addition to the ones listed below. note: windoworworker
globalscope is a mixin and not an interface; you can't actually create an object of type windoworworker
globalscope. properties these properties are defined on the windoworworker
globalscope mixin, and implemented by window and worker
globalscope. windoworworker
globalscope.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. ...
...ker
globalscope. properties these properties are defined on the windoworworker
globalscope mixin, and implemented by window and worker
globalscope. windoworworker
globalscope.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. windoworworker
globalscope.crossoriginisolated read only returns a boolean value that indicates whether a sharedarraybuffer can be sent via a window.postmessage() call. windoworworker
globalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. ...
...rating custom responses to requests. windoworworker
globalscope.crossoriginisolated read only returns a boolean value that indicates whether a sharedarraybuffer can be sent via a window.postmessage() call. windoworworker
globalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. windoworworker
globalscope.issecurecontext read only returns a boolean indicating whether the current context is secure (true) or not (false). windoworworker
globalscope.origin read only returns the origin of the
global scope, serialized as a string. ...
...And 4 more matches
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
a
global object is an object that always exists in the
global scope. in javascript, there's always a
global object defined. in a web browser, when scripts create
global variables, they're created as members of the
global object. (in node.js this is not the case.) the
global object's interface depends on the execution context in which the script is running. for example: in a web browser, any code which the script doesn't specifically start up as a background 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 worker
globalscope object as its
global object. scripts running under node.js have an object called
global as their
global object. ...
...b browser, any code which the script doesn't specifically start up as a background 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 worker
globalscope 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. ...
...his is the vast majority of javascript code on the web. code running in a worker has a worker
globalscope 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. ...
...And 3 more matches
nsIGlobalHistory3
docshell/base/nsi
globalhistory3.idlscriptable this interface provides information about
global history to gecko. 1.0 66 introduced gecko 1.8 obsolete gecko 9.0 inherits from: nsi
globalhistory2 last changed in gecko 1.9 (firefox 3) this interface was originally created as part of nsi
globalhistory2, but was split off during the transition to places. method overview void adddocumentredirect(in nsichannel aoldchannel, in nsichannel anewchannel, in print32 aflags, in boolean atoplevel); unsigned long geturigeckoflags(in nsiuri auri); void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchannel r...
... void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. ...
...uri auri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. this function is preferred if nsi
globalhistory3 is available. ...
...And 3 more matches
Global attributes - HTML: Hypertext Markup Language
global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements.
global attributes may be specified on all html elements, even those not specified in the standard. that means that any non-standard elements must still permit these attributes, even though using those elements means that the document is no longer html5-compliant. for example, html5-compliant browsers hide content marked as <foo hidden>...</foo>, even though <foo> is not a valid html element. in addition to the basic html
global attributes, the following
global attributes also exist: xml:lang and xml:base — these are inherited from the xhtml specifications and deprecated, but kept for compatibility purposes. the multiple aria-* attributes, used ...
...nkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting. list of
global attributes accesskey provides a hint for generating a keyboard shortcut for the current element. this attribute consists of a space-separated list of characters. the browser should use the first one that exists on the computer keyboard layout. autocapitalize controls whether and how text input is automatically capitalized as it is entered/edited by the user. it can have the following values...
...e when editing this element or its contents. used primarily 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 el...
...And 3 more matches
JS_GetGlobalForCompartmentOrNull
this article covers features introduced in spidermonkey 17 return the
global object for the specified compartment. syntax jsobject * js_get
globalforcompartmentornull(jscontext *cx, jscompartment *c); name type description cx jscontext * the context for which to return the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. c jscompartment * the compartment for which to return the
global object. description js_get
globalforcompartmentornull() returns the
global object for the context and the compartment. ...
...text * the context for which to return the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. c jscompartment * the compartment for which to return the
global object. description js_get
globalforcompartmentornull() returns the
global object for the context and the compartment. this may return null if c never had a
global (e.g., the atoms compartment), or if c's
global has been collected. ...
...ler must be in a request on this jscontext. c jscompartment * the compartment for which to return the
global object. description js_get
globalforcompartmentornull() returns the
global object for the context and the compartment. this may return null if c never had a
global (e.g., the atoms compartment), or if c's
global has been collected. ...
...And 2 more matches
AudioWorkletGlobalScope - Web APIs
properties currentframe read only returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. ...
... properties currentframe read only returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. ...
... properties currentframe read only returns an integer that represents the ever-increasing current sample-frame of the audio block being processed. ...
...And 2 more matches
CanvasRenderingContext2D.globalAlpha - Web APIs
the canvasrenderingcontext2d.
globalalpha property of the canvas 2d api specifies the alpha (transparency) value that is applied to shapes and images before they are drawn onto the canvas. see also the chapter applying styles and color in the canvas tutorial. syntax ctx.
globalalpha = value; options value a number between 0.0 (fully transparent) and 1.0 (fully opaque), inclusive. the default value is 1.0. values outside that range, including infinity and nan, will not be set, and
globalalpha will retain its previous value. examples drawing translucent shapes this example uses the
globalalpha property to draw two semi-transparent rectangles. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.
...alue is 1.0. values outside that range, including infinity and nan, will not be set, and
globalalpha will retain its previous value. examples drawing translucent shapes this example uses the
globalalpha property to draw two semi-transparent rectangles. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.
globalalpha = 0.5; ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); ctx.fillstyle = 'red'; ctx.fillrect(50, 50, 100, 100); result overlaying transparent shapes this example illustrates the effect of overlaying multiple transparent shapes on top of each other. ...
...after that, we use a for loop to draw a series of circles with increasing radii. with each new circle, the opacity of the previous circles underneath is effectively increased. ...
...And 2 more matches
DedicatedWorkerGlobalScope.onmessage - Web APIs
when a message is sent to the worker using the worker.postmessage method. syntax self.onmessage = function() { ... }; example the following code snippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. a worker.onmessage handler is also present, to deal with messages are passed back from the worker. ...
...s also present, to deal with messages are passed back from the worker. ...
... living standard ...
...And 2 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
syntax var timeoutid = scope.settimeout(function[, delay, arg1, arg2, ...]); var timeoutid = scope.settimeout(function[, delay]); var timeoutid = scope.settimeout(code[, delay]); parameters function a function to be executed after the timer expires. code an alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires. this syntax is not recommended for the same reasons that make using eval() a security risk. ...
... differ from your expectation. this issue is explained in detail in the javascript reference. explanation code executed by settimeout() is called from an execution context separate from the function from which settimeout was called. the usual rules for setting the this keyword for the called function apply, and if you have not set this in the call or with bind, it will default to the window (or
global) object. it will not be the same as the this value for the function that called settimeout. see the following example: myarray = ['zero', 'one', 'two']; myarray.mymethod = function (sproperty) { alert(arguments.length > 0 ? this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" the above works because when mymethod is called, its this i...
...*/) { var othis = this, aargs = array.prototype.slice.cal...
...And 2 more matches
WorkerGlobalScope.self - Web APIs
the self read-only property of the worker
globalscope interface returns a reference to the worker
globalscope itself. most of the time it is a specific scope like dedicatedworker
globalscope, sharedworker
globalscope, or serviceworker
globalscope. syntax var selfref = self; value a
global scope object (differs depending on the type of worker you are dealing with, as indicated above). ...
...a reference to the worker
globalscope itself. most of the time it is a specific scope like dedicatedworker
globalscope, sharedworker
globalscope, or serviceworker
globalscope. syntax var selfref = self; value a
global scope object (differs depending on the type of worker you are dealing with, as indicated above). ...
...worker
globalscope, or serviceworker
globalscope. syntax var selfref = self; value a
global scope object (differs depending on the type of worker you are dealing with, as indicated above). ...
...And 2 more matches
RegExp.prototype.global - JavaScript
the "g" flag indicates that the regular expression should be tested against all possible matches in a string. ...
...ag is used with the regular expression.
global is a read-only property of an individual regular expression instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of regexp.prototype.
global writable no enumerable no configurable yes description the value of
global is a boolean and true if the "g" flag was used; otherwise, false. the "g" flag indicates that the regular expression should be tested against all possible matches in a string. ...
...s of regexp.prototype.
global writable no enumerable no configurable yes description the value of
global is a boolean and true if the "g" flag was used; otherwise, false. the "g" flag indicates that the regular expression should be tested against all possible matches in a string. a regular expression defined as both
global ("g") and sticky ("y") will ignore the
global flag and perform sticky matches. you cannot change this property directly. ...
...And 2 more matches
JS::CurrentGlobalOrNull
this article covers features introduced in spidermonkey 31 return the
global object for the active function on the context. syntax jsobject * js::current
globalornull(jscontext *cx); name type description cx jscontext * the context for which to return the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js::current
globalornull() 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. ...
...urn the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js::current
globalornull() 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. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
...lornull() 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. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
...e
global object for whatever function is currently running on the context. in other words, it returns the
global object on the current scope chain. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
JS_GetGlobalForScopeChain
obsolete since jsapi 25this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 returns the
global object for the active function on the context. renamed to js::current
globalornull. syntax jsobject * js_get
globalforscopechain(jscontext *cx); name type description cx jscontext * the context for which to return the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js_get
globalforscopechain() returns the
global object for whatever function is currently running on the context. in other words, it returns the globa...
...turn the
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description js_get
globalforscopechain() 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. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
...ription js_get
globalforscopechain() 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. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
...chain() 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. if there is no javascript running on the context, this returns the context's
global, i.e., js_get
globalobject(cx). note that js_get
globalobject() and context
globals are becoming obsolete. ...
JS_NewCompartmentAndGlobalObject
obsolete since jsapi 16this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.1 js_newcompartmentand
globalobject has been removed in bug 755186. use js_new
globalobject instead. create a new
global object in a new compartment. syntax jsobject * js_newcompartmentand
globalobject(jscontext *cx, jsclass *clasp, jsprincipals *principals); name type description cx jscontext * the context in which to create the new
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp jsclass * ...
...compartmentand
globalobject(jscontext *cx, jsclass *clasp, jsprincipals *principals); name type description cx jscontext * the context in which to create the new
global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. clasp jsclass * the class to use for the new
global object. clasp->flags must have the jsclass_
global_flags bits set. 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. principals jsprincipals * the security information to associate with this compartme...
...ass_
global_flags bits set. 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. principals jsprincipals * the security information to associate with this compartment. description js_newcompartmentand
globalobject creates a new compartment, and then creates a new
global object as the first object in that compartment. on success, js_newcompartmentand
globalobject returns a pointer to the new
global object. otherwise it returns null. ...
... principals jsprincipals * the security information to associate with this compartment. description js_newcompartmentand
globalobject creates a new compartment, and then creates a new
global object as the first object in that compartment. ...
JS_SetGlobalObject
obsolete since jsapi 25this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. set a context's
global object. syntax void js_set
globalobject(jscontext *cx, jsobject *obj); name type description cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * pointer to the object to set as the
global object, or null. ...
...yntax void js_set
globalobject(jscontext *cx, jsobject *obj); name type description cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * pointer to the object to set as the
global object, or null. description this function is obsolete; see also js_get
globalobject. js_set
globalobject 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...
...s 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. ...
...ot 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. ...
Components.utils.importGlobalProperties
imports 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 want
globalproperties 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 ...
...ider 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. ...
... exactly known since when it was available, however it is guranteed available from firefox 28 and up. syntax void components.utils.import
globalproperties([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.import
globalproperties(["atob", "btoa"]); var encoded = btoa("hello"); console.log(encoded); // "sgvsbg8=" console.log(atob(encoded)); // "hello" alternative methods if import
globalproperties 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 modul...
...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 suspected this works up till firefox 35. this imports blob, file, along with the regular services. the reason this works is because js code modules actually have blob and file. cu.import() will return the full
global of a code module. knowing that, we can just get a valid blob by importing a known module that has the objects, such as services.jsm const {blob, file, services} = cu.import("resource://gre/modules/services.jsm", {}); reference: stackoverflow :: use blob on firefox add-on hiddendomwindow the hidden domwindow has all of these objects automatically imported. the downside of using hiddendomwindow...
GetGlobalMemoryService
remarks this function returns the same value as the ns_getmemorymanager function. ...
... remarks this function returns the same value as the ns_getmemorymanager function. ...
... remarks this function returns the same value as the ns_getmemorymanager function. ...
... remarks this function returns the same value as the ns_getmemorymanager function. ...
ServiceWorkerGlobalScope: install event - Web APIs
the install event of the serviceworker
globalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.installing worker. ...
... the install event of the serviceworker
globalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.installing worker. ...
...}; specifications specification status comment service workersthe definition of 'install' in that specification. working draft ...
...}; specifications specification status comment service workersthe definition of 'install' in that specification. working draft ...
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
} self.addeventlistener('pushsubscriptionchange', function() { ... ...
...} self.addeventlistener('pushsubscriptionchange', function() { ... ...
...hen browser refresh the push subscription. previously, it was defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so). this offers an opportunity to resubscribe in order to continue receiving push messages, if desired. this might happen if, for example, the push service sets an expiration time a subscription. syntax serviceworker
globalscope.onpushsubscriptionchange = function() { ... } self.addeventlistener('pushsubscriptionchange', function() { ... }) example self.addeventlistener('pushsubscriptionchange', function() { // do something, usually resubscribe to push and // send the new subscription details back to the // server via xhr or fetch }); specifications specification status comment pus...
...// do something, usually resubscribe to push and // send the new subscription details back to the // server via xhr or fetch }); specifications specification status comment push apithe definition of 'onpushsubscriptionchange' in that specification. working draft initial definition (note: this event is specified in the push api, but accessed through serviceworker
globalscope.) ...
WindowOrWorkerGlobalScope.fetch() - Web APIs
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 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.). ...
...f fetching a resource from the network, returning a promise which is fulfilled once the response is available. the promise resolves to the response object representing the response to your request. the promise does not reject on http errors — it only rejects on network errors. you must use then handlers to check for http errors. windoworworker
globalscope is implemented by both window and worker
globalscope, 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 p...
... use an object literal as headers in init. const myinit = { method: 'get', headers: { 'content-type': 'image/jpeg' }, mode: 'cors', cache: 'default' }; let myrequest = new request('flowers.jpg', myinit); specifications specification status comment fetchthe definition of 'fetch()' in that specification. living standard defined in a windoworworker
globalscope partial in the newest spec. fetchthe definition of 'fetch()' in that specification. living standard initial definition credential management level 1 working draft adds federatedcredential or passwordcredential instance as a possible value for init.credentials. ...
JS_IsGlobalObject
this article covers features introduced in spidermonkey 24 determine if given object is a
global object. syntax bool js_is
globalobject(jsobject *obj); name type description obj jsobject * the object to examine. description js_is
globalobject returns true if obj is a
global object, false otherwise. ...
... this article covers features introduced in spidermonkey 24 determine if given object is a
global object. syntax bool js_is
globalobject(jsobject *obj); name type description obj jsobject * the object to examine. description js_is
globalobject returns true if obj is a
global object, false otherwise. ...
...this article covers features introduced in spidermonkey 24 determine if given object is a
global object. syntax bool js_is
globalobject(jsobject *obj); name type description obj jsobject * the object to examine. description js_is
globalobject returns true if obj is a
global object, false otherwise. ...
AudioWorkletGlobalScope.registerProcessor - Web APIs
the name is to be referred to when creating an audioworkletnode based on the registered processor. a new processor by the given name is internally created and associated with the new node. ...
...the name is to be referred to when creating an audioworkletnode based on the registered processor. a new processor by the given name is internally created and associated with the new node. ...
...the name is to be referred to when creating an audioworkletnode based on the registered processor. a new processor by the given name is internally created and associated with the new node. ...
Cross-global fetch usage - Web APIs
this article explains an edge case that occurs with fetch (and potentially other apis exhibiting the same kind of resource retrieval behavior). when a cross-origin fetch involving a relative url is initiated from an <iframe>, the relative url used to be resolved against the current
global location, rather than the iframe's location. the edge case many sites will never comes up against this edge case. ...
...h involving a relative url is initiated from an <iframe>, the relative url used to be resolved against the current
global location, rather than the iframe's location. the edge case many sites will never comes up against this edge case. to see it: you need a same-origin iframe that same-origin iframe needs to have a location with a different base url you have to use the fetch function cross-
global, e.g. frame.contentwindow.fetch() the url passed to fetch needs to be relative the problem in the past we would resolve the relative url against the current
global, for example: let absolute = new url(relative, window.location.href) this is not a problem as such. it is just that different apis that exhibit this kind of behavior were doing it inconsistently with the behavior defined in the s...
... against the current
global, for example: let absolute = new url(relative, window.location.href) this is not a problem as such. it is just that different apis that exhibit this kind of behavior were doing it inconsistently with the behavior defined in the spec, which could lead to problems further down the line. the solution in firefox 60 onwards, mozilla resolves the relative url against the
global that owns the fetch() function being used (see bug 1432272). so in the case described above, it is resolved against the iframe's location: let absolute = new url(relative, frame.contentwindow.location.href) there is a lot of discussion in progress about getting new specs to align with this behavior change, to mitigate potential problems going forward. ...
ServiceWorkerGlobalScope: activate event - Web APIs
the activate event of the serviceworker
globalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.active worker. bubbles no cancelable no interface extendableevent event handler property serviceworker
globalscope.onactivate examples the following snippet shows how you could use an activate event handler to upgrade a cache. ...
...rviceworker
globalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.active worker. bubbles no cancelable no interface extendableevent event handler property serviceworker
globalscope.onactivate examples the following snippet shows how you could use an activate event handler to upgrade a cache. ...
... you could use an activate event handler to upgrade a cache.
globalscope.addeventlistener('activate', function(event) { var cachewhitelist = ['v2']; event.waituntil( caches.foreach(function(cache, cachename) { if (cachewhitelist.indexof(cachename) == -1) { return caches.delete(cachename); } }) ); }); you can also set up the event handler using the serviceworker
globalscope.onactivate property:
globalscope.onactivate = function(event) { ... }; specifications specification status comment service workersthe definition of 'activate' in that specification. working draft ...
ServiceWorkerGlobalScope.onpush - Web APIs
} self.addeventlistener('push', function(pushevent) { ... }) example the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
...} self.addeventlistener('push', function(pushevent) { ... }) example the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
... ...
ServiceWorkerGlobalScope.onsync - Web APIs
} self.addeventlistener('sync', function(syncevent) { ... ...
...} self.addeventlistener('sync', function(syncevent) { ... ...
...} self.addeventlistener('sync', function(syncevent) { ... ...
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
syntax scope.cleartimeout(timeoutid) parameters timeoutid the identifier of the timeout you want to cancel. this id was returned by the corresponding call to settimeout(). it's worth noting that the pool of ids used by settimeout() and setinterval() are shared, which means you can technically use cleartimeout() and clearinterval() interchangeably. however, for clarity, you should avoid doing so. example run the script below in the context of a web page and click on the page once. you'll see a message popping up in a second. if you click the page multiple times in one second, the alert only appears once. ...
... html living standardthe definition of 'cleartimeout()' in that specification. living standard ...
...is.timeoutid); } }; window.onclick = function() { alarm.setup(); }; notes passing an invalid id to cleartimeout() silently does nothing; no exception is thrown. specifications specification status comment html living standardthe definition of 'windoworworker
globalscope.cleartimeout()' in that specification. living standard method moved to the windoworworker
globalscope mixin in the latest spec. html living standardthe definition of 'cleartimeout()' in that specification. living standard ...
WorkerGlobalScope.performance - Web APIs
the performance read-only property of the worker
globalscope interface returns a performance object to be used on the worker. not all performance properties and methods are available to web workers. this property is read only . syntax var perfobj = self.performance; return value a performance object. ...
...mance properties and methods are available to web workers. this property is read only . syntax var perfobj = self.performance; return value a performance object. ...
... ...
Global variable - MDN Web Docs Glossary: Definitions of Web-related terms
a
global variable is a variable that is declared in the
global scope in other words, a variable that is visible from all other scopes. in javascript it is a property of the
global object. ...
... a
global variable is a variable that is declared in the
global scope in other words, a variable that is visible from all other scopes. in javascript it is a property of the
global object. ...
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. ...
...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. ...
JS_GetGlobalForObject
returns the
global object for the given object. syntax jsobject * js_get
globalforobject(jscontext *cx, jsobject *obj); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * a non-null jsobject. description js_get
globalforobject returns the last non-null object on the parent chain of the input object. for function object inputs, the result is "the
global object" as referred to in the ecmascript specification. for example, if the function refers to a
global variable foo, then foo is a property of the object returned by js_get
globalforobject. ...
...object. description js_get
globalforobject returns the last non-null object on the parent chain of the input object. for function object inputs, the result is "the
global object" as referred to in the ecmascript specification. for example, if the function refers to a
global variable foo, then foo is a property of the object returned by js_get
globalforobject. ...
nsIDOMGlobalPropertyInitializer
dom/interfaces/base/nsidom
globalpropertyinitializer.idlscriptable an initializer for
global properties that lets them know about the window they're being attached to. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an xpcom component implementing this interface can be exposed to web content as a property on the window. see custom window properties are a snap in firefox blog post for details. an alternative way to expose an object to the web content is to add the property in response to the content-document-
global-created notification. method overview jsval init(in nsidomwindow window); methods init() jsval init( in nsidomwindow window ); parameters window th...
...ndow. see custom window properties are a snap in firefox blog post for details. an alternative way to expose an object to the web content is to add the property in response to the content-document-
global-created notification. method overview jsval init(in nsidomwindow window); methods init() jsval init( in nsidomwindow window ); parameters window the window to which the
global property is being attached. return value the initialized
global property. ensure that you never return any internal xpcom objects to untrusted code. it is also recommended to use __exposedprops__ to control which members are exposed. ...
CanvasRenderingContext2D.globalCompositeOperation - Web APIs
the canvasrenderingcontext2d.
globalcompositeoperation property of the canvas 2d api sets the type of compositing operation to apply when drawing new shapes. see also compositing and clipping in the canvas tutorial. syntax ctx.
globalcompositeoperation = type; type is a string identifying which of the compositing or blending mode operations to use. types examples changing the composite operation this example uses the
globalcompositeoperation property to draw two rectangles that exclude themselves where they overlap. ...
...string identifying which of the compositing or blending mode operations to use. types examples changing the composite operation this example uses the
globalcompositeoperation property to draw two rectangles that exclude themselves where they overlap. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.
globalcompositeoperation = 'xor'; ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); ctx.fillstyle = 'red'; ctx.fillrect(50, 50, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.
globalcompositeoperation' in that specification. living standard compositing and blending level 1 ...
DedicatedWorkerGlobalScope.postMessage() - Web APIs
this accepts a single parameter, which is the data to send to the worker. the data may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. the main scope that spawned the worker can send back information to the thread that spawned it using the worker.postmessage method. syntax postmessage(amessage, transferlist); parameters amessage the object to deliver to the main thread; this will be in the data field in the event delivered to the worker.onmessage handler. ...
...sult); onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } in the main script, onmessage would have to be called on a worker object, whereas inside the worker script you just need onmessage because the worker is effectively the
global scope (dedicatedworker
globalscope). for a full example, see ourbasic dedicated worker example (run dedicated worker). note: postmessage() can only send a single object at once. as seen above, if you want to pass multiple values you can send an array. specifications specification status comment html living standardthe definition of 'dedicatedworker
globalscope.postmess...
GlobalEventHandlers.onanimationiteration - Web APIs
the animationiteration event is sent when a css animation reaches the end of an iteration. an iteration ends when a single pass through the sequence of animation instructions is completed by executing the last animation step. syntax var animiterationhandler = target.onanimationiteration; target.onanimationiteration = function value a function to be called when an animationiteration event occurs indicating that a css animation has reached the end of an iteration while running on the target, where the target object is an html element (htmlelement), document (document), or window (window). ...
...t some javascript code will need to be written to handle the click on the button to start the next iteration. let's have a look. var box = document.getelementbyid("box"); var iterationcounter = 0; box.onanimationiteration = function(event) { box.style.animationplaystate = "paused"; document.getelementbyid("play").innerhtml = "start iteration #" + (iterationcounter+1); }; this sets up two
global variables: box, which references the "box" element that we're animating, and iterationcounter, which is initially zero, which indicates how many iterations of the animation have occurred. the onanimationiteration event handler is then set up. it simply sets the box's animation-play-state to "paused", then updates the text displayed in the button to indicate that clicking the button will start pl...
GlobalEventHandlers.ondrag - Web APIs
a
global event handler for the drag event. syntax var draghandler = targetelement.ondrag; return value draghandler the drag event handler for element targetelement. example this example includes the use of the ondrag attribute handler to set an element's drag event handler. ...
... a
global event handler for the drag event. syntax var draghandler = targetelement.ondrag; return value draghandler the drag event handler for element targetelement. example this example includes the use of the ondrag attribute handler to set an element's drag event handler. ...
GlobalEventHandlers.ondragend - Web APIs
a
global event handler for the dragend event. syntax var dragendhandler = targetelement.ondragend; return value dragendhandler the dragend event handler for element targetelement. example this example shows two ways to use the ondragend attribute handler to set an element's dragend event handler. ...
... a
global event handler for the dragend event. syntax var dragendhandler = targetelement.ondragend; return value dragendhandler the dragend event handler for element targetelement. example this example shows two ways to use the ondragend attribute handler to set an element's dragend event handler. ...
GlobalEventHandlers.ondragenter - Web APIs
a
global event handler for the dragenter event. syntax var dragenterhandler = targetelement.ondragenter; return value dragenterhandler the dragenter event handler for element targetelement. example this example demonstrates using the ondragenter attribute handler to set an element's dragenter event handler. ...
... a
global event handler for the dragenter event. syntax var dragenterhandler = targetelement.ondragenter; return value dragenterhandler the dragenter event handler for element targetelement. example this example demonstrates using the ondragenter attribute handler to set an element's dragenter event handler. ...
GlobalEventHandlers.ondragexit - Web APIs
the
globaleventhandler.ondragexit property is an event handler for the dragexit event. the ondragexit event is a gecko specific event listener. if you are building a drag-and-drop feature for a website please see the ondragleave event listener instead. syntax var dragexithandler = targetelement.ondragexit; return value dragexithandler the dragexit event handler for element targetelement. example this example demonstrates using the ondragexit attribute handler to set an element's dragexit event handler. ...
...website please see the ondragleave event listener instead. syntax var dragexithandler = targetelement.ondragexit; return value dragexithandler the dragexit event handler for element targetelement. example this example demonstrates using the ondragexit attribute handler to set an element's dragexit event handler. ...
GlobalEventHandlers.ondragleave - Web APIs
a
global event handler for the dragleave event. syntax var dragleavehandler = targetelement.ondragleave; return value dragleavehandler the dragleave event handler for element targetelement. example this example demonstrates using the ondragleave attribute handler to set an element's dragleave event handler. ...
... a
global event handler for the dragleave event. syntax var dragleavehandler = targetelement.ondragleave; return value dragleavehandler the dragleave event handler for element targetelement. example this example demonstrates using the ondragleave attribute handler to set an element's dragleave event handler. ...
GlobalEventHandlers.ondragover - Web APIs
a
global event handler for the dragover event. syntax var dragoverhandler = targetelement.ondragover; return value dragoverhandler the dragover event handler for element targetelement. example this example demonstrates using the ondragover attribute handler to set an element's dragover event handler. ...
... a
global event handler for the dragover event. syntax var dragoverhandler = targetelement.ondragover; return value dragoverhandler the dragover event handler for element targetelement. example this example demonstrates using the ondragover attribute handler to set an element's dragover event handler. ...
GlobalEventHandlers.ondragstart - Web APIs
a
global event handler for the dragstart event. syntax var dragstarthandler = targetelement.ondragstart; return value dragstarthandler the dragstart event handler for element targetelement. example this example demonstrates using the ondragstart attribute handler to set an element's dragstart event handler. ...
... a
global event handler for the dragstart event. syntax var dragstarthandler = targetelement.ondragstart; return value dragstarthandler the dragstart event handler for element targetelement. example this example demonstrates using the ondragstart attribute handler to set an element's dragstart event handler. ...
GlobalEventHandlers.ondrop - Web APIs
a
global event handler for the drop event. syntax var drophandler = targetelement.ondrop; return value drophandler the drop event handler for element targetelement. example this example demonstrates the use of the ondrop attribute to define an element's drop event handler. ...
... a
global event handler for the drop event. syntax var drophandler = targetelement.ondrop; return value drophandler the drop event handler for element targetelement. example this example demonstrates the use of the ondrop attribute to define an element's drop event handler. ...
GlobalEventHandlers.onerror - Web APIs
error events are fired at various targets for different kinds of errors: when a javascript runtime error (including syntax errors and exceptions thrown within handlers) occurs, an error event using interface errorevent is fired at window and window.onerror() is invoked (as well as handlers attached by window.addeventlistener (not only capturing)). when a resource (such as an <img> or <script>) fails to load, an error event using interface event is fired at the element that initiated the load, and the onerror() handler on the element is invoked. ...
... (not only capturing)). when a resource (such as an <img> or <script>) fails to load, an error event using interface event is fired at the element that initiated the load, and the onerror() handler on the element is invoked. these error events do not bubble up to window, but (at least in firefox) can be handled with a window.addeventlistener configured with usecapture set to true. installing a
global error event handler is useful for automated collection of error reports. syntax for historical reasons, different arguments are passed to window.onerror and element.onerror handlers (as well as on error-type window.addeventlistener handlers). window.onerror window.onerror = function(message, source, lineno, colno, error) { ... }; function parameters: message: error message (string). avai...
ServiceWorkerGlobalScope: contentdelete event - Web APIs
the contentdelete event of the serviceworker
globalscope interface is fired when an item is removed from the indexed content via the user agent. bubbles no cancelable no interface contentindexevent event handler property oncontentdelete examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item. ...
...delete event handler to remove cached content related to the deleted index item. self.addeventlistener('contentdelete', event => { event.waituntil( caches.open('cache-name').then(cache => { return promise.all([ cache.delete(`/icon/${event.id}`), cache.delete(`/content/${event.id}`) ]) }) ); }); you can also set up the event handler using the serviceworker
globalscope.ondelete property: self.oncontentdelete = (event) => { ... }; specifications specification status comment unknownthe definition of 'contentdelete' in that specification. unknown initial definition. ...
ServiceWorkerGlobalScope.onactivate - Web APIs
}; examples the following snippet shows how you could use an activate event handler to upgrade a cache. ...
...}; examples the following snippet shows how you could use an activate event handler to upgrade a cache. ...
ServiceWorkerGlobalScope.oncontentdelete - Web APIs
}; examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item. ...
...}; examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item. ...
ServiceWorkerGlobalScope.onfetch - Web APIs
when fired, the code returns a promise that resolves to the first matching request in the cache object. if no match is found, the code fetches a response from the network. the code also handles exceptions thrown from the fetch() operation. note that an http error response (e.g., 404) will not trigger an exception. ...
...when fired, the code returns a promise that resolves to the first matching request in the cache object. if no match is found, the code fetches a response from the network. the code also handles exceptions thrown from the fetch() operation. note that an http error response (e.g., 404) will not trigger an exception. ...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
the serviceworker
globalscope.onnotificationclick property is an event handler called whenever the notificationclick event is dispatched on the serviceworker
globalscope object, that is when a user clicks on a displayed notification spawned by serviceworkerregistration.shownotification(). notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a click event on the notification object itself. note: trying to create a notification inside the serviceworker
globalscope using the notification() constructor will throw an error. syntax serviceworker
globalscope.onnotificationclick = function(notificationevent) { ... }; example self.onnotificationclick = function(event) { console.log('on notification click: ', ...
... ...
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
example while self.skipwaiting() can be called at any point during the service worker's execution, it will only have an effect if there's a newly installed service worker that might otherwise remain in the waiting state. ...
... example while self.skipwaiting() can be called at any point during the service worker's execution, it will only have an effect if there's a newly installed service worker that might otherwise remain in the waiting state. ...
WindowOrWorkerGlobalScope.atob() - Web APIs
you can use the btoa() method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the atob() method to decode the data again. for example, you can encode, transmit, and decode control characters such as ascii values 0 through 31. for use with unicode or utf-8 strings, see the note on "unicode strings" in the page for btoa(). syntax var decodeddata = scope.atob(encodeddata); parameters encodeddata a binary string contains an base64 encoded data. return value an ascii string containing decoded data from encodeddata. ...
... const encodeddata = window.btoa('hello, world'); // encode a string const decodeddata = window.atob(encodeddata); // decode the string polyfill you can use a polifill from https://github.com/maxart2501/base64-js/blob/master/base64.js for browsers that don't support it. specifications specification status comment html living standardthe definition of 'windoworworker
globalscope.atob()' in that specification. living standard method moved to the windoworworker
globalscope 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 s...
WindowOrWorkerGlobalScope.btoa() - Web APIs
you can use this method to encode data which may otherwise cause communication problems, transmit it, then use the atob() method to decode the data again. for example, you can encode control characters such as ascii values 0 through 31. syntax var encodeddata = scope.btoa(stringtoencode); parameters stringtoencode the binary string to encode. return value an ascii string containing the base64 representation of stringtoencode. exceptions invalidcharactererror the string contained a character that did not fit in a single byte. ...
...} const decoded = atob(encoded); const original = frombinary(decoded); console.log(original); // ☸☹☺☻☼☾☿ polyfill you can use a polifill from https://github.com/maxart2501/base64-js/blob/master/base64.js for browsers that don't support it. specifications specification status comment html living standardthe definition of 'windoworworker
globalscope.btoa()' in that specification. living standard method moved to the windoworworker
globalscope 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 s...
WindowOrWorkerGlobalScope.caches - Web APIs
this object enables functionality such as storing assets for offline use, and generating custom responses to requests. syntax var mycachestorage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. ...
... service workers working draft initial definition. ...
WindowOrWorkerGlobalScope.clearInterval() - Web APIs
the clearinterval() method of the windoworworker
globalscope mixin cancels a timed, repeating action which was previously established by a call to setinterval(). syntax scope.clearinterval(intervalid) parameters intervalid the identifier of the repeated action you want to cancel. this id was returned by the corresponding call to setinterval(). it's worth noting that the pool of ids used by setinterval() and settimeout() are shared, which means you can technically use clearinterval() and cleartimeout() interchangeably. however, for clarity, you should avoid doing so. return value undefined example see the setinterval() examples. ...
... that the pool of ids used by setinterval() and settimeout() are shared, which means you can technically use clearinterval() and cleartimeout() interchangeably. however, for clarity, you should avoid doing so. return value undefined example see the setinterval() examples. specifications specification status comment html living standardthe definition of 'windoworworker
globalscope.clearinterval()' in that specification. living standard method moved to the windoworworker
globalscope mixin in the latest spec. html living standardthe definition of 'clearinterval()' in that specification. living standard ...
WindowOrWorkerGlobalScope.indexedDB - Web APIs
the indexeddb read-only property of the windoworworker
globalscope mixin provides a mechanism for applications to asynchronously access the capabilities of indexed databases. syntax var idbfactory = self.indexeddb; value an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification. ...
... indexed database api 2.0the definition of 'indexeddb' in that specification. recommendation initial definition. ...
WorkerGlobalScope.console - Web APIs
the console read-only property of the worker
globalscope interface returns a console object providing access to the browser console for the worker. syntax var consoleobj = self.console; value a console object. example this property allows you to have access to a browser console for debugging purposes, inside a worker. so for example you could call console.log('test'); inside a worker (which would basically be the equivalent of self.console.log('test');, as these are being called on the worker scope, which can be referenced with worker
globalscope.self), to return a test message out to the browser console. if you are calling console.log() from a dedicatedworker
globalscope or other worker scope that acts on a single loaded window, that tab's web console will receive the logs. however, if...
...g('test');, as these are being called on the worker scope, which can be referenced with worker
globalscope.self), to return a test message out to the browser console. if you are calling console.log() from a dedicatedworker
globalscope or other worker scope that acts on a single loaded window, that tab's web console will receive the logs. however, if you are calling console.log() from a sharedworker
globalscope, the
global browser console will receive the logs. specifications not yet part of any specification. ...
WorkerGlobalScope.location - Web APIs
the location read-only property of the worker
globalscope interface returns the workerlocation associated with the worker. it is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. syntax var locationobj = self.location; value a workerlocation object. ...
...n for browsing scopes, but adapted to workers. syntax var locationobj = self.location; value a workerlocation object. ...
WorkerGlobalScope.navigator - Web APIs
the navigator read-only property of the worker
globalscope interface returns the workernavigator associated with the worker. it is a specific navigator object, mostly a subset of the navigator for browsing scopes, but adapted to workers. syntax var navigatorobj = self.navigator; value a workernavigator object. ...
...ect, mostly a subset of the navigator for browsing scopes, but adapted to workers. syntax var navigatorobj = self.navigator; value a workernavigator object. ...
The global XML object - Archive of obsolete content
the xml object has several properties that allow you to customize parsing and serialization of e4x. 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. to add a method to xml.prototype, define xml.prototype.function::methodname or xml.prototype.function::[methodnamestring]. ...
ServiceWorkerGlobalScope.onmessage - Web APIs
the onmessage property of the serviceworker
globalscope interface is an event handler fired whenever a message event occurs — when incoming messages are received. note: service workers define the extendable event to allow extending the lifetime of the event. for the message event, service workers use the extendablemessageevent interface which extends the extendableevent interface. note: messages received from service worker contexts (e.g. as the event object of onmessage) are represented by messageevent objects in modern browsers, for consistency with other web messaging features. (they used to be represented by serviceworkermessageevent objects, which have now been deprecated.) syntax serviceworker
globalscope.onmessage = function(extendablemessageevent) { ... }; example self.addeven...
ServiceWorkerGlobalScope: push event - Web APIs
bubbles no cancelable no interface pushevent event handler property onpush example this example sets up a handler for push events that takes json data, parses it, and dispatches the message for handling based on information contained within the message. ...
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
this may occur if the subscription was refreshed by the browser, but it may also happen if the subscription has been revoked or lost. bubbles no cancelable no interface pushsubscriptionchangeevent event handler property onpushsubscriptionchange usage notes although examples demonstrating how to share subscription related information with the application server tend to use fetch(), this is not necessarily the best choice for real-world use, since it will not work if the app is offline, for example. ...
ServiceWorkerGlobalScope.registration - Web APIs
the registration read-only property of the serviceworker
globalscope interface returns a reference to the serviceworkerregistration object, which represents the service worker's registration. syntax serviceworkerregistration = self.registration value a serviceworkerregistration object. specifications specification status comment service workersthe definition of 'serviceworker
globalscope.registration' in that specification. working draft initial definition. ...
SharedWorkerGlobalScope.applicationCache - Web APIs
important: application cache is deprecated as of firefox 44, and is no longer available in insecure contexts from firefox 60 onwards (bug 1354175, currently nightly/beta only). don't use it to make offline websites — consider using service workers instead. the applicationcache read-only property of the sharedworker
globalscope interface returns the applicationcache object for the worker (see using the application cache). syntax var nameobj = self.applicationcache; value an applicationcache. example if a shared worker has an appcache associated with it, you can return a reference to the cache using self.applicationcache from inside the shared worker. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data...
SharedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. note: there is also a way to stop the worker from the main thread: the worker.terminate method. ...
SharedWorkerGlobalScope.name - Web APIs
the name read-only property of the sharedworker
globalscope interface returns the name that the sharedworker was (optionally) given when it was created. this is the name that the sharedworker() constructor can pass to get a reference to the sharedworker
globalscope. syntax var nameobj = self.name; value a domstring. example if a shared worker is created using a constructor with a name option: var myworker = new sharedworker("worker.js", { name : "mysharedworker" }); the sharedworker
globalscope will now have a name of "mysharedworker", returnable by running self.name from inside the shared worker. specifications specification status comment html living standardthe definition of 'name' in that specification. living standard ...
SharedWorkerGlobalScope.onconnect - Web APIs
syntax onconnect = function() { ... }; examples this example shows a shared worker file — when a connection to the worker occurs from a main thread via a messageport, the onconnect event handler fires. the event object is a messageevent. ...
WindowOrWorkerGlobalScope.isSecureContext - Web APIs
the issecurecontext read-only property of the windoworworker
globalscope interface returns a boolean indicating whether the current context is secure (true) or not (false). syntax var isitsecure = self.issecurecontext; // or just issecurecontext value a boolean. specifications specification status comment secure contextsthe definition of 'windoworworker
globalscope.issecurecontext' in that specification. candidate recommendation initial definition. ...
WindowOrWorkerGlobalScope.origin - Web APIs
the origin read-only property of the windoworworker
globalscope interface returns the origin of the
global scope, serialized as a string. syntax var myorigin = self.origin; // or just origin value a usvstring. examples executed from inside a worker script, the following snippet will log the worker's
global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e. via file:// url), origin will return the string "null". specifications specification status comment html living standardthe definition of 'windoworworker
globalscope.origin' in that specification. living standard initial definition. ...
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
do so in our microtask guide. the importance of microtasks comes in its ability to perform tasks asynchronously but in a specific order. see using microtasks in javascript with queuemicrotask() for more details. microtasks are especially useful for libraries and frameworks that need to perform final cleanup or other just-before-rendering tasks. queuemicrotask() is exposed on the windoworworker
globalscope mixin. syntax scope.queuemicrotask(function); parameters function a function to be executed when the browser engine determines it is safe to call your code. enqueued microtasks are executed after all pending tasks have completed but before yielding control to the browser's event loop. return value undefined. examples self.queuemicrotask(() => { // function contents here }) ta...
WorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you wanted to close your worker instance from inside the worker itself, you could call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. ...
WorkerGlobalScope.dump() - Web APIs
in your terminal, in firefox only. this is the same as firefox's window.dump, but for workers. syntax dump('my message\n'); parameters a domstring containing the message you want to send. returns void. example to write an output from your worker to your computer's terminal, you first have to run an instance of firefox started from your command line/terminal. for example, on mac os x you'd run it using something like this (assuming you are inside the applications folder): ./firefox.app/contents/macos/firefox-bin -profile /tmp -no-remote now go into about:config and enable the browser.dom.window.dump.enabled pref. ...
WorkerGlobalScope.importScripts() - Web APIs
syntax self.importscripts('foo.js'); self.importscripts('foo.js', 'bar.js', ...); parameters a comma-separated list of domstring objects representing the scripts to be imported. these paths are relative to html document base url. return value none. exceptions networkerror imported scripts were not served with a valid javascript mime type (i.e. text/javascript). ...
WorkerGlobalScope: languagechange event - Web APIs
the languagechange event is fired at the
global scope object when the user's preferred language changes. bubbles no cancelable no interface event event handler onlanguagechange examples you can use the languagechange event in an addeventlistener method: worker.addeventlistener('languagechange', function() { console.log('languagechange event detected!'); }); or use the onlanguagechange event handler property: worker.onlanguagechange = function(event) { console.log('languagechange event detected!'); }; specification specification status html living standardthe definition of 'languagechange' in that specification. living standard ...
WorkerGlobalScope.onclose - Web APIs
this non-standard event handler was only implemented by a few browsers and has been removed from all or nearly all of them. syntax self.onclose = function() { ... ...
WorkerGlobalScope.onerror - Web APIs
the onerror property of the worker
globalscope interface represents an eventhandler to be called when the error event occurs and bubbles through the worker. syntax self.onerror = function() { ... }; example the following code snippet shows an onerror handler set inside a worker: self.onerror = function() { console.log('there is an error inside your worker!'); } specifications specification status comment html living standardthe definition of 'worker
globalscope.onerror' in that specification. living standard ...
WorkerGlobalScope.onlanguagechange - Web APIs
the onlanguagechange property of the worker
globalscope interface represents an eventhandler to be called when the languagechange event occurs and bubbles through the worker. syntax self.onlanguagechange = function() { ... }; example the following code snippet shows an onlanguagechange handler set inside a worker: self.onlanguagechange = function() { console.log('your preferred language settings have been changed'); } specifications specification status comment html living standardthe definition of 'worker
globalscope.onlanguagechange' in that specification. living standard ...
WorkerGlobalScope.onoffline - Web APIs
the onoffline property of the worker
globalscope interface represents an eventhandler to be called when the offline event occurs and bubbles through the worker. syntax self.onoffline = function() { ... }; example the following code snippet shows an onoffline handler set inside a worker: self.onoffline = function() { console.log('your worker is now offline'); } specifications specification status comment html living standardthe definition of 'worker
globalscope.onoffline' in that specification. living standard ...
WorkerGlobalScope.ononline - Web APIs
the ononline property of the worker
globalscope interface represents an eventhandler to be called when the online event occurs and bubbles through the worker. syntax self.ononline = function() { ... }; example the following code snippet shows an ononline handler set inside a worker: self.ononline = function() { console.log('your worker is now online'); } specifications specification status comment html living standardthe definition of 'worker
globalscope.ononline' in that specification. living standard ...
Index - Web APIs
audiotracklist: removetrack event event the removetrack event is fired when a track is removed from an audiotracklist. 202 audioworklet api, audio, audioworklet, experimental, interface, reference, web audio api, worklet the audioworklet interface of the web audio api is used to supply custom audio processing scripts. ...
...cklist: removetrack event event the removetrack event is fired when a track is removed from an audiotracklist. 202 audioworklet api, audio, audioworklet, experimental, interface, reference, web audio api, worklet the audioworklet interface of the web audio api is used to supply custom audio processing scripts. ...
...io, audioworklet, experimental, interface, reference, web audio api, worklet the audioworklet interface of the web audio api is used to supply custom audio processing scripts. user-supplied code is run in the audioworklet
globalscope
global execution context in a separate web audio rendering thread along with other nodes, allowing for zero-latency audio processing. 203 audioworklet
globalscope api, audioworklet
globalscope, experimental, interface, reference, web audio api the audioworklet
globalscope interface of the web audio api represents a
global execution context for user-supplied code, which defines custom audioworkletprocessor-derived classes. each baseaudiocontext has a single audioworklet available under the audioworklet property, which runs its code in a single ...
...And 187 more matches
How to embed the JavaScript engine
shows how to embed spidermonkey and run a simple javascript script. see the instructions for building and running the sample below the code. the code differs for each spidermonkey version, please choose right version for your spidermonkey. ...
...nd run a simple javascript script. see the instructions for building and running the sample below the code. the code differs for each spidermonkey version, please choose right version for your spidermonkey. spidermonkey 24 // following code might be needed in some case // #define __stdc_limit_macros // #include <stdint.h> #include "jsapi.h" /* the class of the
global object. ...
...ript script. see the instructions for building and running the sample below the code. the code differs for each spidermonkey version, please choose right version for your spidermonkey. spidermonkey 24 // following code might be needed in some case // #define __stdc_limit_macros // #include <stdint.h> #include "jsapi.h" /* the class of the
global object. ...
...And 42 more matches
Document - Web APIs
the document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the dom tree. the dom tree includes elements such as <body> and <table>, among many others. it provides functionality
globally to the document, like how to obtain the page's url and create new elements in the document. <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="2p...
...t. document.onreadystatechange represents the event handling code for the readystatechange event. document.onselectionchange is an eventhandler representing the code to be called when the selectionchange event is raised. document.onvisibilitychange is an eventhandler representing the code to be called when the visibilitychange event is raised. ...
... represents the event handling code for the readystatechange event. document.onselectionchange is an eventhandler representing the code to be called when the selectionchange event is raised. document.onvisibilitychange is an eventhandler representing the code to be called when the visibilitychange event is raised. ...
...And 40 more matches
Window - Web APIs
the window interface represents a window containing a dom document; the document property points to the dom document loaded in that window. a window for a given document can be obtained using the document.defaultview property. a
global variable, window, representing the window in which the script is running, is exposed to javascript code. the window interface is home to a variety of functions, namespaces, objects, and constructors which are not necessarily directly associated with the concept of a user interface window. ...
...property. a
global variable, window, representing the window in which the script is running, is exposed to javascript code. the window interface is home to a variety of functions, namespaces, objects, and constructors which are not necessarily directly associated with the concept of a user interface window. however, the window interface 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 conta...
...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 windoworworker
globalscope 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. window.console read only returns a reference to the console object which provides access to the browser's debugging consol...
...And 28 more matches
Debugger - Firefox Developer Tools
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. ...
...therwise. this property is initially true in a freshly created debugger instance. this property gives debugger code a single point of control for disentangling itself from the debuggee, regardless of what sort of events or handlers or “points” we add to the interface. allowunobservedasmjs a boolean value indicating whether asm.js code running inside this debugger instance’s debuggee
globals is invisible to debugger api handlers and breakpoints. setting this to false inhibits the ahead-of-time asm.js compiler and forces asm.js code to run as normal javascript. this is an accessor property with a getter and setter. it is initially false in a freshly created debugger instance. setting this flag to true is intended for uses of subsystems of the debugger api (e.g, debugger.source) for...
...ee’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 loaded in the scope of the debuggees. this method’s return value is ignored. onnewpromise(promise) a new promise object, referenced by the debugger.object instance promise, has been allocated in the scope of the debuggees. the promise’s allocation stack can be obtained using the promiseallocationstack accessor p...
...And 25 more matches
JSAPI User Guide
age. build it from source instead. your program will be easier to debug. c++ code accesses spidermonkey via the jsapi, by including the header "jsapi.h". an overview of jsapi functionality follows. for more details, see the jsapi reference. the spidermonkey universe in order to run any javascript code in spidermonkey, an application must have three key elements: a jsruntime, a jscontext, and a
global object. this section describes what these things are. the next section explains how to set them up, using jsapi functions. runtimes. a jsruntime, or runtime, is the space in which the javascript variables, objects, scripts, and contexts used by your application are allocated. every jscontext and every object in an application lives within a jsruntime. they cannot travel to other runtimes or be s...
...t, 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 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 o...
...
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 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 ...
...And 24 more matches
Extending a Protocol
arent process. now let's implement the method in ./dom/base/navigator.cpp - we add a little bit of error boilerplate stuff, as is customary: already_addrefed<promise> navigator::echo(const nsastring& astring, errorresult& arv) { if (!mwindow || !mwindow->getdocshell()) { arv.throw(ns_error_unexpected); return nullptr; } refptr<promise> echopromise = promise::create(mwindow->as
global(), arv); if (ns_warn_if(arv.failed())) { return nullptr; } // message passing magic will happen here! return echopromise.forget(); } ok, let's ./mach build and make sure everything is compiling ok. once it's compiled, ./mach run and you should be able to spin up the developer console and type: navigator.echo("hi!"); that will return a pending promise that never settles. our g...
...t to notify all its children of something. so communication can go in both directions. in this tutorial, we are just going to cover a child talking to a parent, and the parent responding with some data. in order to manage parent-child relationships, ipdl uses a tree herirachy to manage the creation of children. as dom apis have access to the window object, we generally want to use the "pwindow
global" protocol to manage things for us: this protocol is convinient because we can easily access it from the window object... so as long as we can get a hold of a window object, we can get it to do useful things for us (as we shall soon see!). in our case, our protocol, which we will call pecho.ipdl, will send a message to a parent, and the parent will respond with the message we sent. as a heirarchy...
...nvinient because we can easily access it from the window object... so as long as we can get a hold of a window object, we can get it to do useful things for us (as we shall soon see!). in our case, our protocol, which we will call pecho.ipdl, will send a message to a parent, and the parent will respond with the message we sent. as a heirarchy, this will look like this: this means that, pwindow
global.ipdl: manages: meaning that pwindow
global.ipdl is responsible managing the creation of instances of pecho children and the parent. and the inverse is also true, as you will soon see: pecho.idpl will need explicitly state that pwindow
global.ipdl is managing it. includes: this is kinda like "#includes" in c++, except it's not a preprocessor directive. it just includes the defintion and makes...
...And 23 more matches
Index
t count for a function call. 30 js::clonefunctionobject jsapi reference, reference, référence(2), spidermonkey js::clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj. if scopechain is supplied, it uses scopechain as its enclosing scope. if scopechain is omitted, it creates a new function object in cx's
global. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created
global object. 31 js::compile jsapi reference, reference, référence(2), spidermonkey js::compile compiles a script, srcbuf, chars, bytes, or file, for execution. 32 js::compilefunction jsapi reference, reference, référence(2), spidermonkey ...
...s return the instance itself to allow method chain. 35 js::construct jsapi reference, reference, référence(2), spidermonkey js::construct calls a specified function as a constructor, fun. 36 js::createerror jsapi reference, reference, référence(2), spidermonkey js::createerror creates an error object with specified properties. 37 js::current
globalornull jsapi reference, reference, référence(2), spidermonkey js::current
globalornull() returns the
global object for whatever function is currently running on the context. in other words, it returns the
global object on the current scope chain. 38 js::deflatestringtoutf8buffer jsapi reference, refere, spidermonkey js::deflatestringtoutf8buffer encodes src as utf8.
... jsextendedclass.wrappedobject callback to get the wrapped object. most classes do not implement wrappedobject. 104 jsfun_bound_method jsapi reference, obsolete, spidermonkey this macro exists only for backward compatibility with existing applications. its use is deprecated. future versions of the javascript engine may not support or recognize this macro. 105 jsfun_
global_parent jsapi reference, obsolete, spidermonkey no summary! 106 jsfastnative jsapi reference, obsolete, spidermonkey the callback should use the following macros to access the fields of vp: 107 jsfinalizeop jsapi reference, reference, référence(2), spidermonkey the jsfinalizeop is analogous to java finalizers or c++ destructors. the garbage col...
...And 23 more matches
JSAPI Cookbook
but in a jsnative the correct way to do this is: /* jsapi */ bool mynative(jscontext *cx, unsigned argc, js::value *vp) { js::callargs args = js::callarg...
...or: v = js::int32value(0); v.setdouble(0.5); // or: v = js::doublevalue(0.5); v.setstring(somestring); // or: v = js::stringvalue(somestring); v.setnull(); // or: v = js::nullvalue(); v.setundefined(); // or: v = js::undefinedvalue(); v.setboolean(false); // or: v = js::booleanvalue(false); finding the
global object many of these recipes require finding the current
global object first. ...
....5); // or: v = js::doublevalue(0.5); v.setstring(somestring); // or: v = js::stringvalue(somestring); v.setnull(); // or: v = js::nullvalue(); v.setundefined(); // or: v = js::undefinedvalue(); v.setboolean(false); // or: v = js::booleanvalue(false); finding the
global object many of these recipes require finding the current
global object first. // javascript var
global = this; there is a function, js_get
globalforscopechain(cx), that makes a best guess, and sometimes that is the best that can be done. but in a jsnative the correct way to do this is: /* jsapi */ bool mynative(jscontext *cx, unsigned argc, js::value *vp) { js::callargs args = js::callargsfromvp(argc, vp); jsobject *
global = js_get
globalforobject(cx, &args.callee()); ... } defining...
...And 21 more matches
Index
onnect determines whether a given xpcom return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively. 25 components.lastresult xpcom:language bindings, xpconnect no summary! 26 components.manager xpcom:language bindings, xpconnect components.manager is a convenience reflection of the
global native component manager service. the scriptable methods on the 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 o...
...m doesn't account for any native (c++) xpcom objects hanging off javascript objects though. in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable. in this case it can be important to be able to force a garbage collection cycle from javascript. 38 components.utils.get
globalforobject add-ons, developing mozilla, extensions, javascript, xpcom:language bindings, xpconnect this method is used to determine the
global object with which an object is associated. this is the
global object in place at the time the object was created, which is to say the
global object used when executing the script that created the object. 39 components.utils.getweakrefere...
...sulting 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.import
globalproperties 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. f...
...And 21 more matches
Appendix D: Loading Scripts - Archive of obsolete content
runtime provides a number of means to dynamically load and execute javascript files. each of these means has its own advantages and disadvantages, as well as its own quirks which may trap the unwary. below is an overview of the more common means of loading scripts, along with some of their primary advantages, disadvantages, quirks, and use cases. the examples below which make use of the services
global assume that you're previously imported the services.jsm module. as this module only exists on firefox 4 and other gecko 2-based platforms, the services in question will have to be manually loaded on other platforms. <script> tags xul script tags are traditionally the primary means of loading scripts for extension developers. these tags are generally inserted into xul overlay files or other ...
...), which means they don't necessarily need to read as source and compiled with each restart. flexibility: script tags provide a means to specify the character set and javascript version of the scripts to be loaded, which many other methods do not. debuggable: development tools support debugging javascript loaded by script tags disadvantages scoping: scripts loaded via script tags share the
global scope with all other scripts loaded into the same window. these tags provide no means to load scripts into a private or otherwise specific scope. speed: even if these scripts are loaded from a cache, only read and compile time are reduced. the scripts still need to execute all of their initialization code and allocate and initialize all of their data structures each time the script is loaded. l...
...ethod may be used to load arbitrary code into components.utils.sandbox objects. javascript files or urls may be loaded in this manner by first retrieving their contents into memory using an xmlhttprequest. this is the method used by jetpack's securable module system to load nearly all executable code. advantages namespacing: since scripts executed via evalinsandbox run in a defined namespace,
global namespace contamination and the resultant extension compatibility issues are not usually a problem. flexibility: the evalinsandbox method accepts several parameters, including the url, line number, and javascript version of the file from which the code being evaluated was extracted. this information is invaluable for debugging, and the flexibility with which it can be specified makes this method...
...And 19 more matches
HTML documentation index - HTML: Hypertext Markup Language
over http (dash) is an adaptive streaming protocol. 6 date and time formats used in html date, element, format, html, iso 8601, input, reference, string, time, week, datetime, datetime-local, del, ins, month, month-year, week-year certain html elements use date and/or time values. the formats of the strings that specify these values are described in this article. 7
global attributes attribute, html, reference, web
global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements. 8 accesskey
global attributes, html, reference, accesskey the accesskey
global attribute provides a hint for generating a keyboard shortcut for the current element. the attribute v...
...some elements. 8 accesskey
global attributes, html, reference, accesskey the accesskey
global attribute provides a hint for generating a keyboard shortcut for the current element. the attribute value must consist of a single printable character (which includes accented and other characters that can be generated by the keyboard). 9 autocapitalize autocapitalize,
global attributes, html, reference the autocapitalize
global attribute is an enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. 10 class
global attributes, html, reference the class
global attribute is a space-separated list of the case-sensitive classes of the element. classes allow css and javascrip...
...is entered/edited by the user. 10 class
global attributes, html, reference the class
global attribute is a space-separated list of the case-sensitive classes of the element. classes allow css and javascript to select and access specific elements via the class selectors or functions like the dom method document.getelementsbyclassname. 11 contenteditable editing,
global attributes, html, reference, text editing, contenteditable, text entry, text input the contenteditable
global attribute is an enumerated attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. ...
...And 18 more matches
ui/button/toggle - Archive of obsolete content
experimental add a toggle button to the firefox user interface. with this module you can create buttons that function like a check box, representing an on/off choice. toggle buttons have all the same features as action buttons: they can display icons and respond to click events. like action buttons, you can control their state on a per-window or per-tab basis as well as
globally. toggle buttons have two extra features: they emit a change event when clicked, as well as a click event. they have an extra attribute checked that is automatically toggled when the button is clicked. when a button is checked it gets a "pressed" look in the user interface (note that the "pressed" look currently does not work in mac os x). usage creating buttons to create a button you must give it an id, an i...
...ng 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. ...
...y defining a tree of potential states. at the root is the
global state, then there's a state you can set for each window, then a state you can set for each tab. more-specific states override less-specific states. for example, suppose the browser has two windows (w1 and w2), and each window has two tabs. ...
...And 17 more matches
Bytecode Descriptions
operator. infallible. the result is always a string that depends on the type of val. jsop::typeof and jsop::typeofexpr are the same except that--amazingly--jsop::typeof affects the behavior of an immediately preceding jsop::getname or jsop::getgname instruction! this is how we implement typeof step 2, making typeof nonexistingvariable return "undefined" instead of throwing a referenceerror. in a
global scope: typeof x compiles to getgname "x"; typeof. typeof (0, x) compiles to getgname "x"; typeofexpr. emitting the same bytecode for these two expressions would be a bug. per spec, the latter throws a referenceerror if x doesn't exist. format: jof_ic pos stack: val ⇒ (+val) the unary + operator. +val doesn't do any actual math. it just calls tonumber(val). the conversion can call .tostring...
...nd --. surprisingly, it's not possible to get the right behavior using jsop::add and jsop::sub alone. for one thing, jsop::add sometimes does string concatenation, while ++ always does numeric addition. more fundamentally, the result of evaluating x-- is tonumeric(old value of x), a value that the sequence getlocal "x"; one; sub; setlocal "x" does not give us. format: jof_ic other expressions
globalthis stack: ⇒ this push the
global this value. not to be confused with the
globalthis property on the
global. this must be used only in scopes where this refers to the
global this. newtarget stack: ⇒ new.target push the value of new.target. the result is a constructor or undefined. this must be used only in scripts where new.target is allowed: non-arrow function scripts and other scripts t...
...t just reuse the shape--it actually pushes the preconstructed object script->getobject(objectindex) right onto the stack. the object must be a singleton plainobject or arrayobject. the spec requires that an objectliteral or arrayliteral creates a new object every time it's evaluated, so this instruction must not be used anywhere it might be executed more than once. there's a shell-only option, new
global({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...
...And 17 more matches
WebIDL bindings
ed to a parentobject instance by the compiler via one of that class's non-explicit constructors.) if many instances of myinterface are expected to be created quicky, the return value of getparentobject should itself inherit from nswrappercache for optimal performance. returning null from getparentobject is allowed in situations in which it's ok to associate the resulting object with a random
global object for security purposes; this is not usually ok for things that are exposed to web content. again, if you do not need wrapper caching you don't need to do this. the actual type returned from getparentobject must be defined in a header included from your implementation header, so that this type's definition is visible to the binding code. add the webidl for myinterface in dom/webidl and to ...
...all on the underlying c++ object. the return type and argument types are determined as described below. in addition to those, all methods that are allowed to throw will get an errorresult& argument appended to their argument list. non-static methods that use certain webidl types like any or object will get a jscontext* argument prepended to the argument list. static methods will be passed a const
globalobject& for the relevant
global and can get a jscontext* by calling context() on it. the name of the c++ method is simply the name of the webidl operation with the first letter converted to uppercase. webidl overloads are turned into c++ overloads: they simply call c++ methods with the same name and different signatures. for example, this webidl: interface myinterface { void dosomething(long...
...a readonly attribute only has a getter and no setter. the getter's name is the name of the attribute with the first letter converted to uppercase. this has get prepended to it if any of these conditions h...
...And 15 more matches
Skinning XUL Files by Hand - Archive of obsolete content
style. in xul, skins are created with cascading style sheets and images. to skin a xul file means to change the overall look of that file by changing its style information. in the very near future, it will be possible to skin xul files dynamically and completely -- by pressing a button, selecting a skin from a menu, or by accepting a skin from over the web. when this day comes, skins defined in a
global skin file will be applied to a whole application -- like the mozilla browser -- so that all the various windows and parts will look consistent. in the meantime, however, skinning a file requires some manual interaction. this article can help you get started understanding skins and creating skins for xul. it presumes you have at least basic understanding of xul and the application object model tha...
...end of an application. much of what makes xul look (and act!) the way it does comes from the css for each xul element. css2, for example, gives you control over the absolute positioning of any element within its parent element. also, most of the behavior that buttons exhibit comes from styles and an event model based on javascript that dynamically switches between these styles. mozilla's current
global skin defines this basic behavior for several classes of button. a button is styled by the
global skin when its class attribute is set to a class which is defined in the
global skin. for example, when a button is defined as follows: <button class="plain" label="push me" /> then the following very simple style definition applies to that button. button.plain { border: 0px !important; } the glo...
... a button is defined as follows: <button class="plain" label="push me" /> then the following very simple style definition applies to that button. button.plain { border: 0px !important; } the
global skin, in which styles for these several button classes and dozens of other elements are defined, is described in the following section. if you want to use the classes already defined in mozilla's
global skin to style your elements, you may do so. but you may also want to define new classes of buttons particular to your xul file, in which case the style information will be wholly defined within your custom css file. reading the
global skin it's very important to familiarize yourself with the basic style definitions in the
global skin before you set out creating your own stylesheet. css can quic...
...And 14 more matches
this - JavaScript
functions which don't provide their own this binding (it retains the this value of the enclosing lexical context). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...teractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax this value a property of an execution context (
global, function or eval) that, in non–strict mode, is always a reference to an object and in strict mode can be any value. description
global context in the
global execution context (outside of any function), this refers to the
global object whether in strict mode or not. ...
...ll request. syntax this value a property of an execution context (
global, function or eval) that, in non–strict mode, is always a reference to an object and in strict mode can be any value. description
global context in the
global execution context (outside of any function), this refers to the
global object whether in strict mode or not. // in web browsers, the window object is also the
global object: console.log(this === window); // true a = 37; console.log(window.a); // 37 this.b = "mdn"; console.log(window.b) // "mdn" console.log(b) // "mdn" note: you can always easily get the
global object using the
global globalthis property, regardless of the current context in which your code is running. function context inside a function, the value of this depends on how the fu...
...And 13 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
.identity.id1.draft_folder", "imap://" + env_user + "@imap-int.int-evry.fr/drafts"); lockpref("mail.identity.id1.drafts_folder_picker_mode", "0"); lockpref("mail.identity.id1.fcc_folder", "imap://" + env_user + "@imap-int.int-evry.fr/sent"); lockpref("mail.identity.id1.fcc_folder_picker_mode", "0"); lockpref("mail.identity.id1.organization", "int evry france"); lockpref("mail.identity.id1.override
global_pref", true); lockpref("mail.identity.id1.reply_to", ""); //imap lockpref("mail.server.server2.hostname", "imap-int.int-evry.fr"); lockpref("mail.server.server2.issecure", true); lockpref("mail.server.server2.login_at_startup", true); lockpref("mail.server.server2.max_cached_connections", 5); //lockpref("mail.server.server2.name", "jehan.procaccia@int-evry.fr"); lockpref("mail.server.server2.typ...
...lockpref("mail.i...
... var env_mozdebug= getenv("mozilla_debug"); if (env_mozdebug)...
...And 11 more matches
var - 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 var varname1 [= value1] [, varname2 [= value2] ... [, varnamen [= valuen]]]; varnamen variable name. it can be any legal identifier. valuen optional initial value of the variable. it can be any legal expression. default value is undefined. description var declarations, wherever they occur, are processed before any code is executed. this is called hoisting, and is discussed further below. ...
...fault value is undefined. description var declarations, wherever they occur, are processed before any code is executed. this is called hoisting, and is discussed further below. the scope of a variable declared with var is its current execution context and closures thereof, which is either the enclosing function and functions declared within it, or, for variables declared outside any function,
global. duplicate variable declarations using var will not trigger an error, even in strict mode, and the variable will not lose its value, unless another assignment is performed. 'use strict'; function foo() { var x = 1; function bar() { var y = 2; console.log(x); // 1 (function `bar` closes over `x`) console.log(y); // 2 (`y` is in scope) } bar(); console.log(x); // 1 (`x` is in...
...oped to `bar` } foo(); variables declared using var are created before any code is executed in a process known as hoisting. their initial value is undefined. 'use strict'; console.log(x); // undefined (note: not referenceerror) console.log('still going...'); // still going... var x = 1; console.log(x); // 1 console.log('still going...'); // still going... in the
global context, a variable declared using var is added as a non-configurable property 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]] enab...
...And 11 more matches
Debugger.Object - Firefox Developer Tools
debugger.object instances protect their referents from the garbage collector; as long as the debugger.object instance is live, the referent remains live. this means that garbage collection has no visible effect on debugger.object instances. accessor properties of the debugger.object prototype a debugger.object instance inherits the following accessor properties from its prototype: proto ...
...whose handler object was allocated by debuggee code, this is null. proxyconstructtrap if the referent is a function proxy whose handler object was allocated by debuggee code, its construction trap function—the function called when the function proxy is called via a new expression. if the referent is not a function proxy whose handler object was allocated by debuggee code, this is null.
global a debugger.object instance referring to the
global object in whose scope the referent was allocated. this does not unwrap cross-compartment wrappers: if the referent is a wrapper, the result refers to the wrapper's
global, not the wrapped object's
global. the result refers to the
global directly, not via a wrapper. hostannotations a javascript object providing further metadata about the ...
...ject instance. a typical javascript embedding provides "host objects" to expose application-specific functionality to scripts. the hostannotations accessor consults the embedding for additional information about the referent that might be of interest to the debugger. the returned object's properties' meanings are up to the embedding. for example, a web browser might provide host annotations for
global objects to distinguish top-level windows, iframes, and internal javascript scopes. by convention, host annotation objects have a string-valued "type" property that, taken together with the object's class, indicate what sort of thing the referent is. the host annotation object's other properties provide further details, as appropriate for the type. for example, in firefox, a metadata object for ...
...And 10 more matches
HTML attribute reference - HTML: Hypertext Markup Language
attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want. attribute list attribute name elements description accept <form>, <input> list of types the server accepts, typically a file type. accept-charset <form> list of supported charsets. accesskey
global attribute keyboard shortcut to activate or add focus to the element. action <form> the uri of a program that processes the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> specifies the horizontal alignment of the element. allow <iframe> spe...
...>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> specifies the horizontal alignment of the element. allow <iframe> specifies a feature-policy for the iframe. alt <applet>, <area>, <img>, <input> alternative text in case an image can't be displayed. async <script> executes the script asynchronously. autocapitalize
global attribute sets whether input is automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> indicates whether controls in this form can by default have their values automatically completed by the browser. autofocus <button>, <input>, <keygen>, <select>, <textarea> the element should be automatically focused after the page load...
... a challenge string that is submitted along with the public key. charset <meta>, <script> declares the character encoding of the page or script. checked <command>, <input> indicates whether the element should be checked on page load. cite <blockquote>, <del>, <ins>, <q> contains a uri which points to the source of the quote or change. class
global attribute often used with css to style elements with common 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> ...
...And 10 more matches
Using the WebAssembly JavaScript API - WebAssembly
)()); // 42 this code accesses each function reference stored in the table in turn, and instantiates them to print the values they hold to the console — note how each function reference is retrieved with a table.prototype.get() call, then we add an extra set of parentheses on the end to actually invoke the function. note: you can find our complete demo at table.html (see it live also). ...
...on reference stored in the table in turn, and instantiates them to print the values they hold to the console — note how each function reference is retrieved with a table.prototype.get() call, then we add an extra set of parentheses on the end to actually invoke the function. note: you can find our complete demo at table.html (see it live also). ...
...ses on the end to actually invoke the function. note: you can find our complete demo at table.html (see it live also).
globals webassembly has the ability to create
global variable instances, accessible from both javascript and importable/exportable across one or more webassembly.module instances. this is very useful, as it allows dynamic linking of multiple modules. ...
...And 10 more matches
Modules - Archive of obsolete content
t 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. to improve encapsulation, each module should be defined in the scope of its own
global object. this is made possible by the use of sandboxes. each sandbox lives in its own compartment. a compartment is a separate memory space. each compartment has a set of privileges that determines what scripts running in that compartment can and cannot do. we will show how sandboxes and compartments can be used to improve security in our module system. the module system used by the sdk is based ...
...avascript project reaches a certain size, it becomes necessary to split it up into multiple files. unfortunately, javascript does not provide any means to load scripts from other locations: we have to rely on the host application to provide us with this functionality. applications such as firefox and thunderbird are based on xulrunner. xulrunner adds a built-in object, known as components, to the
global scope. this object forms the central access point for all functionality provided by the host application. a complete explanation of how to use components is out of scope for this document. however, the following example shows how it can be used to load scripts from other locations: const { classes: cc interfaces: ci } = components; var instance = cc["@mozilla.org/moz/jssubscript-loader;...
.... however, the following example shows how it can be used to load scripts from other locations: const { classes: cc interfaces: ci } = components; var instance = cc["@mozilla.org/moz/jssubscript-loader;1"]; var loader = instance.getservice(ci.mozijssubscriptloader); function loadscript(url) { loader.loadsubscript(url); } when a script is loaded, it is evaluated in the scope of the
global object of the script that loaded it. any property defined on the
global object will be accessible from both scripts: // index.js: loadscript("www.foo.com/a.js"); foo; // => 3 // a.js: foo = 3; exporting names the script loader we obtained from the components object allows us load scripts from other locations, but its api is rather limited. for instance, it does not know how to handle relative...
...And 9 more matches
Message manager overview
ually the sort of message manager to use. process message managers: these correspond to process boundaries, and enable code running in the parent (chrome) process to communicate with code running in the child (content) process. from firefox 38 onwards, they also enable code running in the parent process to load process scripts into the child process. these are like frame scripts, except they are
global to the child process. process scripts are most likely to be useful when an extension wants to run some code only once in the content process, to access some
global service: for example, to register an observer or a content policy. frame message managers in multiprocess firefox, when chrome code needs to interact with web content, it needs to: factor the code that needs direct access to cont...
...process. these scripts are called "frame scripts". communicate with frame scripts using message-passing apis there are various types of frame message managers, as depicted in this diagram: this diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open. ...
...ng message-passing apis there are various types of frame message managers, as depicted in this diagram: this diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open. chrome process in the chrome process, there's a hierarchy of frame message managers: the
global frame message manager, window message managers, and browser message managers. ...
...And 9 more matches
Debugger.Object - Firefox Developer Tools
debugger.object instances protect their referents from the garbage collector; as long as the debugger.object instance is live, the referent remains live. this means that garbage collection has no visible effect on debugger.object instances. accessor properties of the debugger.object prototype a debugger.object instance inherits the following accessor properties from its prototype: proto ...
...a promise, this is the number of milliseconds elapsed since the promise was created. if the referent is not a promise, throw a typeerror exception. promisetimetoresolution if the referent is a promise, this is the number of milliseconds elapsed between when the promise was created and when it was resolved. if the referent hasn’t been resolved or is not a promise, throw a typeerror exception.
global a debugger.object instance referring to the
global object in whose scope the referent was allocated. this does not unwrap cross-compartment wrappers: if the referent is a wrapper, the result refers to the wrapper’s
global, not the wrapped object’s
global. the result refers to the
global directly, not via a wrapper. allocationsite if object allocation site tracking was enabled when this deb...
...ect if omitted. getownpropertydescriptor(name) return a property descriptor for the property namedname of the referent. if the referent has no such property, return undefined. (this function behaves like the standard object.getownpropertydescriptor function, except that the object being inspected is implicit; the property descriptor returned is allocated as if by code scoped to the debugger’s
global object (and is thus in the debugger’s compartment); and its value, get, and set properties, if present, are debuggee values.) getownpropertynames() return an array of strings naming all the referent’s own properties, as if object.getownpropertynames(referent) had been called in the debuggee, and the result copied in the scope of the debugger’s
global object. getownpropertysymbols() retu...
...And 9 more matches
TextEncoder.prototype.encodeInto() - Web APIs
e, but it is well worth the length because of the gains in performance. ...
...ains in performance. ...
...ow){ "use strict"; var log = math.log; var ln2 = math.ln2; var clz32 = math.clz32 || function(x) {return 31 - log(x >>> 0) / ln2 | 0}; var fromcharcode = string.fromcharcode; var patchedu8array = window.uint8array || array; var textencoderprototype = textencoder["prototype"]; var
globaltextencoder = window["textencoder"]; var
globaltextencoderprototype; var
globaltextencoderinstance; ////////////////////////////////////////////////////////////////////////////////////// function encoderreplacer(nonasciichars){ // make the utf string into a binary utf-8 encoded string var point = nonasciichars.charcodeat(0)|0; if (0xd800 <= point && point <= 0xdbff) { var nextcode = nonasciichars.charcodeat(1)|0; // defaults to 0 w...
...And 9 more matches
ui/button/action - Archive of obsolete content
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 properties are the same across all open windows and tabs, and updating them updates the button's state across 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 cu...
...he 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 human-readable label. when the button is in the toolbar, thi...
... = require('sdk/ui/button/action'); var button = actionbutton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: function(state) { console.log("you clicked '" + state.label + "'"); } }); button.click(); state() get or set the button's state for a specific window or tab. by default, a button's properties are
global, meaning that they are the same across all open windows and tabs, and that if you update these properties, then they are updated across all windows and tabs. but sometimes you want a button attached to one window (or tab) to have a different state to a button attached to a different window (or tab). that's what state() is for. to set a button's properties for a specific window or tab, call state...
...And 8 more matches
JavaScript Daemons Management - Archive of obsolete content
emons manager. |*| |*| https://developer.mozilla.org/docs/javascript/timers/daemons |*| https://developer.mozilla.org/user:fusionchess |*| |*| this framework is released under the gnu public license, version 3 or later. ...
...*/ daemon.prototype; 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...
...-1 : 1; var bbreak = odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false, bend = odmn.isatend(), binvert = odmn.reversals > 0; if (bend && !binvert || bbreak) { odmn.pause(); return false; } if (bend && binvert) { odmn.backw = !odmn.backw...
...And 8 more matches
Theme changes in Firefox 2 - Archive of obsolete content
splayed when it's located at the right end of the search bar. browser/search-provider-bkgnd-rtl.png new file; the background drawn behind the search provider icon when it's located at the left end of the search bar. browser/search-provider-bkgnd.png new file; the background drawn behind the search provider icon when it's located at the right end of the search bar. ...
...earch-provider-bkgnd-rtl.png new file; the background drawn behind the search provider icon when it's located at the left end of the search bar. browser/search-provider-bkgnd.png new file; the background drawn behind the search provider icon when it's located at the right end of the search bar.
global/about.css new file; css used in the application's about box. ...
...e search bar. browser/search-provider-bkgnd.png new file; the background drawn behind the search provider icon when it's located at the right end of the search bar.
global/about.css new file; css used in the application's about box.
global/alltabs-box-bkgnd.png new file; the background for the "all tabs" drop-down menu at the right side of the tab bar.
global/alltabs-box-overflow-bkgnd.png new file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling. ...
...And 8 more matches
XPCOM changes in Gecko 2.0
ust insert the following line to your chrome.manifest: category profile-after-change mycomponent @foobar/mycomponent;1 important: formerly, the contract id of the category entry was prefixed with "service," if the component was implemented as a service. this prefix needs to be dropped when migrating to chrome.manifest. ...
...if the component was implemented as a service. this prefix needs to be dropped when migrating to chrome.manifest. changed category names the xpcom category manager is used to register certain
global helper objects. because chrome.manifest is a space-delimited format, category names with spaces cannot be registered. ...
...ed as a service. this prefix needs to be dropped when migrating to chrome.manifest. changed category names the xpcom category manager is used to register certain
global helper objects. because chrome.manifest is a space-delimited format, category names with spaces cannot be registered. ...
...And 8 more matches
nsIContentPrefService2
he preference within its domain, and a value. (see nsicontentpref below.) for example, if you want to remember the user's preference for a certain zoom level on www.mozilla.org pages, you might store a preference whose domain is "www.mozilla.org", whose name is "zoomlevel", and whose value is the numeric zoom level. a preference need not have a domain, and in that case the preference is called a "
global" preference. this interface doesn't impart any special significance to
global preferences; they're simply name-value pairs that aren't associated with any particular domain. as a consumer of this interface, you might choose to let a
global preference override all non-
global preferences of the same name, for example, for whatever definition of "override" is appropriate for your use case. domain p...
...xt context, in nsicontentprefcallback2 callback); nsicontentpref getcachedbydomainandname(in astring domain, in astring name, in nsiloadcontext context); void getcachedbysubdomainandname(in astring domain, in astring name, in nsiloadcontext context, out unsigned long len, [retval,array,size_is(len)] out nsicontentpref prefs); nsicontentpref getcached
global(in astring name, in nsiloadcontext context); void get
global(in astring name, in nsiloadcontext context, in nsicontentprefcallback2 callback); void removealldomains(in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void removeall
globals(in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); ...
...ame, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void removebysubdomain(in astring domain, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void removebysubdomainandname(in astring domain, in astring name, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void remove
global(in astring name, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void removeobserverforname(in astring name, in nsicontentprefobserver observer); void set(in astring domain, in astring name, in nsivariant value, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void set
global(in astring name, in ...
...And 8 more matches
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, dedicatedworker
globalscope, different from the current window. by default, methods and properties of window are not available to them, but dedicatedworker
globalscope, like window, implements windowtimers and windowbase64. ...
... current window. by default, methods and properties of window are not available to them, but dedicatedworker
globalscope, like window, implements windowtimers and windowbase64. ...
...methods and properties of window are not available to them, but dedicatedworker
globalscope, like window, implements windowtimers and windowbase64. ...
...And 8 more matches
Index - Archive of obsolete content
self provides: 23 contributor's guide no summary! 24 classes and inheritance add-on sdk no summary! 25 content processes add-on sdk no summary! 26 getting started add-on sdk learn how to contribute to the add-on sdk. 27 modules add-ons, extensions a module is a self-contai...
... system overview gecko style sheets & rules ↓ rule tree ↓ style context interface 461 using microformats firefox 3, microformats microformats allow web sites to provide semantic data to the browser in order to make it possible to present summaries of the information on a page without having to know how to parse the document itself. firefox 3 implements a
global microformats object that provides access to microformats. this object and its api make finding and reading microformats easy to do. 472 firefox sync sync sync refers to a family of related components and services which provide synchronization of data between mozilla application instances. these components and services include: 473 code snippets this page...
...fox extensions add-ons, extensions, java if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these
globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the
global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., 492 javascript os.shared module os.shared contains tools to interact with the operating system (and, more generally...
...And 7 more matches
Message manager overview
ually the sort of message manager to use. process message managers: these correspond to process boundaries, and enable code running in the parent (chrome) process to communicate with code running in the child (content) process. from firefox 38 onwards, they also enable code running in the parent process to load process scripts into the child process. these are like frame scripts, except they are
global to the child process. process scripts are most likely to be useful when chrome code wants to run some code only once in the content process, to access some
global service: for example, to register an observer or a content policy. frame message managers in multiprocess firefox, when chrome code needs to interact with web content, it needs to: factor the code that needs direct access to conte...
...ss use the frame message manager api to communicate with the frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts", but this usage is deprecated because the add-on sdk uses "content script" to refer to a similar but different kind of script. there are three different subtypes of frame message manager: the
global message manager, the window message manager, and the browser message manager. all three enable chrome code to: load a script into a frame in the content the content process using a loadframescript() function. these scripts are called "frame scripts". communicate with frame scripts using addmessagelistener() and broadcastasyncmessage() or sendasyncmessage() functions. note that in this con...
...t process using a loadframescript() function. these scripts are called "frame scripts". communicate with frame scripts using addmessagelistener() and broadcastasyncmessage() or sendasyncmessage() functions. note that in this context, "browser" refers to the xul <browser> object, which is a frame that hosts a single web document. it does not refer to the more general sense of a web browser.
global message manager the
global message manager operates on every <browser> (that is, every open content tab). loadframescript() loads the given script into every <browser> in every browser window. broadcastasyncmessage() sends the message to every <browser> in every browser window. it's a chromemessagebroadcaster object, which implements the following interfaces: nsiframescriptloader nsi...
...And 7 more matches
Standard built-in objects - JavaScript
the host objects available in browser contexts are documented in the api reference. ...
...the host objects available in browser contexts are documented in the api reference. ...
...the host objects available in browser contexts are documented in the api reference. ...
...And 7 more matches
Writing Skinnable XUL and CSS - Archive of obsolete content
the following document outlines rules that one must abide by when writing a skin. mozilla can have any number of installed ui packages, from navigator to sidebar to editor. each package has its own skin, css files and images that determine the appearance of that package. in our particular mozilla skin, there is a special package called
global. this package contains a special skin called the
global skin. if you wish for your package to blend in with the other packages, then the skin for your package should inherit information from the
global skin in order to reduce the amount of duplication across packages and in order to make the ui as a whole easier to skin. writing css files for a package learn css! this may seem obvious, but many of the nastiest problems we're seeing are being caused by p...
... the spec! study a book! know it! love it! make it a part of you! each skin has a master skin file. the skin for a package should always have a master skin file whose name corresponds to the name of the package. for example, the skin for the navigator package should contain a file called navigator.css that determines the default look of all xul windows posed from this package. if inheriting the
global skin, a skin file must import the
global skin explicitly. if your skin file wishes to inherit the
global skin, then it should import the
global skin explicitly. this is done using an @import directive placed at the top of the file. @import url(chrome://
global/skin/) ... rest of skin file ... css files for a skin fall into two categories: base skin files and derived skin files. css files tha...
... another component's skin are also considered derived skin files, since they are implicitly importing information from the other component's skin. these sorts of files are typically used with reusable overlayable widgets (e.g., the sidebar). your css file should never import another skin file if your file is loaded by a xul overlay. css files that are used by xul overlays should never import the
global skin (or any other skin for that matter). they are already derived skins and therefore should not inherit from
global. they should instead rely on the context in which they will appear for color, font, and border information. for example, the sidebar should not import the
global skin, since it could appear in messenger and in navigator (which could have two completely different color schemes). if...
...And 6 more matches
JavaScript-DOM Prototypes in Mozilla
every image in this document have a callable foo property (i.e. a foo() method). alternatively, one can access and modify the prototype of an htmlimageelement through the prototype property of the constructor: htmlimageelement.prototype.foo = bar; modifying the prototype of a host object is not guaranteed by ecmascript specification. moreover, no specification guarantees that there will be a
globally available htmlimageelement, or that such object will be the constructor for any arbitrary image's [[prototype]]. a third way through which one can access the prototype of an object is through the constructor property of the object, which itself points (initially) to the constructor: document.images[0].constructor.prototype.foo = bar; note though, the above may or may not work in mozilla. s...
...if such objects are provided, they are not guaranteed by any specification to have any effect on the environment. results in other browsers is not guaranteed. so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinfo.{cpp,h} in the dom code. during startup, the nsdomclassinf...
... objects nor their associated prototypes. if such objects are provided, they are not guaranteed by any specification to have any effect on the environment. results in other browsers is not guaranteed. so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinfo.{cpp,h} in the dom code. during startup, the nsdomclassinfo code registers two different types of "
global names", these are names of properties of the
global object with special meaning to the dom code. the two types of "
global names" are class constructor names and class prototype names. what's the difference? class constructor names are names of real classes, and class prototype names are names of "classes" that are inherited by real classes, but are not real classes. a few examples of class constr...
...And 6 more matches
NSS API Guidelines
special debug macros. these macros only define code when debug is turned on, providing a way for systems to register, deregister, and check valid pointers. secport_decl_ptr_class(classname, size) - declare a class of pointers (labelled classname) this object file needs to check. this class is local only to this object file. size is the expected number of pointers of type classname. secport_decl_
global_ptr_class(classname, size) - same as above except classname can be used in other object files. secport_add_pointer(classname, pointer) - add pointer as a valid pointer for classclassname. this is usually called by a create function. secport_verify_pointer(classname, pointer, secerror, returnvalue)- check if a given pointer really belongs to the requested class. if it doesn't set the error secer...
...d an documented when debug is turned on. interfaces for these are in nspr. thread safety code developed using the nss apis needs to make use of thread safety features. first to examine is object creation and deletion. object creation is usually not a problem. no other threads have access to allocated memory just created. exceptions to this include objects which are created on the fly, or as
global objects. deletion, on the other hand, may be trickier. threads may be referencing the object at the same time a another thread tries to delete it. the semantics depend on the way the application uses the object, also how and when the application wants to destroy it. for some data structures, this problem can be removed by protected reference counting. the object does not disappear until all user...
...d, may be trickier. threads may be referencing the object at the same time a another thread tries to delete it. the semantics depend on the way the application uses the object, also how and when the application wants to destroy it. for some data structures, this problem can be removed by protected reference counting. the object does not disappear until all users have released it. ...
...And 6 more matches
JS_InitStandardClasses
ripts. syntax bool js_initstandardclasses(jscontext *cx, js::handle<jsobject*> obj); name type description cx jscontext * pointer to the executable script context 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. ...
...bj); name type description cx jscontext * pointer to the executable script context 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<jsobject*> the
global object to initialize. this object must be of a jsclass that has the jsclass_
global_flags bits set. ...
...ript context 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<jsobject*> 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. ...
...And 6 more matches
Understanding WebAssembly text format - WebAssembly
ortobject.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 can find this example on github as logger.html (see it live also). ...
...ok 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 can find this example on github as logger.html (see it live also). ...
...this example on github as logger.html (see it live also). declaring
globals in webassembly webassembly has the ability to create
global variable instances, accessible from both javascript and importable/exportable across one or more webassembly.module instances. this is very useful, as it allows dynamic linking of multiple modules. ...
...And 6 more matches
/loader - Archive of obsolete content
anything loaded into it. instantiation the loader module provides a loader() function that may be used to instantiate new loader instances: let loader = loader(options); configuration loader() may be provided with a set of configuration options: paths: describes where the loader should find the modules it is asked to load. mandatory. modules: provides a set of module exports. optional.
globals: provides a set of
globals shared across modules loaded via this loader. optional. resolve: provide customized module resolution logic. optional. id: provide add-on id to attach to loaded modules. optional. paths the loader needs to be provided with a set of locations to indicate where to find modules loaded using require(). this is provided by a mandatory options.paths hash that represents...
...es: { // overlay `toolkit/loader` so that `require('toolkit/loader')` // will return our `loadermodule`. 'toolkit/loader': loadermodule } }); use this feature with a great care though. while reuse may sound like a compelling idea it comes with the side effect of shared state, which can cause problems. for example, unload of a loader won't trigger unload hooks on pseudo-modules. ...
...mpelling idea it comes with the side effect of shared state, which can cause problems. for example, unload of a loader won't trigger unload hooks on pseudo-modules.
globals each module loaded via the loader instance is secured in own js sandbox. these modules don't share scope and get their own set of built-ins (object, array, string ...). but sometimes it's convenient to define a set of common
globals that will be shared across modules. this can be done using the optional
globals option. ...
...And 5 more matches
Enhanced Extension Installation - Archive of obsolete content
background there are several flaws with extension1 installation in firefox2 1.0, including: it is very difficult for a third party application with its own managed install process to install an extension into firefox. first it must locate the firefox executable, then run it with the -install-
global-extension command line flag, which installs from a xpi into the firefox application directory. aside from the work of locating the firefox executable in the first place (which varies from platform to platform), this is very limiting because: it forces the third party application to package its firefox integration hooks as a xpi. it forces it to have write access to the firefox directory in order to be installed, which may not always be the case. it forces its items to be located in di...
...ge its firefox integration hooks as a xpi. it forces it to have write access to the firefox directory in order to be installed, which may not always be the case. it forces its items to be located in different places on the user's disk - some vendors wish to keep all of their installed content within c:\program files\foo\ for example. there is no clean uninstall procedure, as the -install-
global-extension flag was designed only as a means to install items for all user profiles, not as a means for third party installers to register their components. the system for installation, upgrade and uninstall is not robust enough. when a newer version fo an existing extension is installed, files for the newer version are copied into the folder used by the older version, and obsolete files are...
... }; tracking install locations since there are only two locations, the installed location of an extension is expressed throughout the code using a boolean value, often referred to as isprofile - true if the item is installed in the profile directory's extensions folder. this ...
...And 5 more matches
Updating Commands - Archive of obsolete content
l docommand without checking if the command was enabled or not, although we probably shouldn't do that. the code above is generic enough that it can be a function that takes a command as an argument and executes that command. this function could then be reused for all commands. in fact, this is common enough that mozilla includes a library which does just that. ...
...hout checking if the command was enabled or not, although we probably shouldn't do that. the code above is generic enough that it can be a function that takes a command as an argument and executes that command. this function could then be reused for all commands. in fact, this is common enough that mozilla includes a library which does just that. ...
...it is attached to the command which will invoke the command on the necessary controller when called. ...
...And 5 more matches
JSAPI reference
obsolete since jsapi 27 enum jsversion jsversion_ecma_3 jsversion_1_6 jsversion_1_7 jsversion_1_8 jsversion_ecma_5 jsversion_default jsversion_unknown jsversion_latest js_getimplementationversion js_getversion js_setversionforcompartment added in spidermonkey 31 js_stringtoversion js_versiontostring js_setversion obsolete since jsapi 25 js::current
globalornull added in spidermonkey 31 js_get
globalforscopechain obsolete since jsapi 25 js_get
globalobject obsolete since jsapi 24 js_set
globalobject obsolete since jsapi 25 js_initclass js_initstandardclasses js_resolvestandardclass js_enumeratestandardclasses js_enumerateresolvedstandardclasses obsolete since jsapi 24 js_isrunning js_saveframechain js_restoreframechain js_is...
...teresolvedstandardclasses obsolete since jsapi 24 js_isrunning js_saveframechain js_restoreframechain js_isassigning obsolete since javascript 1.8.5 js_isconstructing obsolete since jsapi 26 js_isconstructing_possiblywithgiventhisobject obsolete since jsapi 17 js_getscopechain obsolete since javascript 1.8.7 compartments: class jsautocompartment added in spidermonkey 24 js_new
globalobject added in spidermonkey 17 js_entercompartment added in spidermonkey 24 js_leavecompartment added in spidermonkey 24 js_getcompartmentprivate added in spidermonkey 1.8.5 js_setcompartmentprivate added in spidermonkey 1.8.5 js_get
globalforcompartmentornull added in spidermonkey 17 js_iteratecompartments added in spidermonkey 17 js_setdestroycompartmentcallback added in spidermonkey 17 ...
...js_leavecompartment added in spidermonkey 24 js_getcompartmentprivate added in spidermonkey 1.8.5 js_setcompartmentprivate added in spidermonkey 1.8.5 js_get
globalforcompartmentornull added in spidermonkey 17 js_iteratecompartments added in spidermonkey 17 js_setdestroycompartmentcallback added in spidermonkey 17 js_setcompartmentnamecallback added in spidermonkey 17 js_newcompartmentand
globalobject added in spidermonkey 1.8.1 obsolete since jsapi 16 js_entercrosscompartmentcall added in spidermonkey 1.8.1 obsolete since jsapi 18 js_leavecrosscompartmentcall added in spidermonkey 1.8.1 obsolete since jsapi 18 locale callbacks: struct jslocalecallbacks js_getlocalecallbacks js_setlocalecallbacks locale callback types: jslocaletouppercase jslocaletolowercase jslocalecompa...
...And 5 more matches
Using Web Workers - Web APIs
es to the javascript code that created it by posting messages to an event handler specified by that code (and vice versa). this article provides a detailed introduction to using web workers. web workers api a worker is an object created using a constructor (e.g. worker()) that runs a named javascript file — this file contains the code that will run in the worker thread; workers run in another
global context that is different from the current window. thus, using the window shortcut to get the current
global scope (instead of self) within a worker will return an error. the worker context is represented by a dedicatedworker
globalscope object in the case of dedicated workers (standard workers that are utilized by a single script; shared workers use sharedworker
globalscope). a dedicated worker i...
...('message received from worker'); } here we grab the message event data and set it as the textcontent of the result paragraph, so the user can see the result of the calculation. note: notice that onmessage and postmessage() need to be hung off the worker object when used in the main script thread, but not when used in the worker. this is because, inside the worker, the worker is effectively the
global scope. note: when a message is passed between the main thread and worker, it is copied or "transferred" (moved), not shared. read transferring data to and from workers: further details for a much more thorough explanation. terminating a worker if you need to immediately terminate a running worker from the main thread, you can do so by calling the worker's terminate method: myworker.terminate(...
...orkers workers may spawn more workers if they wish. so-called sub-workers must be hosted within the same origin as the parent page. also, the uris for subworkers are resolved relative to the parent worker's location rather than that of the owning page. this makes it easier for workers to keep track of where their dependencies are. importing scripts and libraries worker threads have access to a
global function, importscripts(), which lets them import scripts. it accepts zero or more uris as parameters to resources to import; all of the following examples are valid: importscripts(); /* imports nothing */ importscripts('foo.js'); /* imports just "foo.js" */ importscripts('foo.js', 'bar.js'); /* imports two scripts */ importscripts('//example.com/hel...
...And 5 more matches
Functions - JavaScript
ts of one statement that says to return the parameter of the function (that is, number) multiplied by itself. the statement return specifies the value returned by the function: return 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. a non-primitive value, such as array or a user-defined object) as a parameter and the function changes the object's properties, that change is visible outside the function, as shown in the following example: function myfunc(theobject) { theobject.make = 'toyota'; } var mycar = {make: 'honda', model: 'accord', year: 1998}; var x, y; x...
...ect.) one of these, the apply() method, can be used to achieve this goal. function scope variables defined inside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function. however, a function can access all variables and functions defined inside the scope in which it is defined. ...
...o achieve this goal. function scope variables defined inside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function. however, a function can access all variables and functions defined inside the scope in which it is defined. in other words, a function defined in the
global scope can access all variables defined in the
global scope. ...
...And 5 more matches
Symbol.for() - JavaScript
the symbol.for(key) method searches for existing symbols in a runtime-wide symbol registry with the given key and returns it if found. otherwise a new symbol gets created in the
global symbol registry with this key. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.for(key); parameters key string, required. the key for the symbol (and also used for the description of the symbol). ...
...dn/interactive-examples and send us a pull request. syntax symbol.for(key); parameters key string, required. the key for the symbol (and also used for the description of the symbol). return value an existing symbol with the given key if found; otherwise, a new symbol is created and returned. ...
...ed. description in contrast to symbol(), the symbol.for() function creates a symbol available in a
global symbol registry list. symbol.for() does also not necessarily create a new symbol on every call, but checks first if a symbol with the given key is already present in the registry. in that case, that symbol is returned. if no symbol with the given key is found, symbol.for() will create a new
global symbol.
global symbol registry the
global symbol registry is a list with the following record structure and it is initialized empty: a record in the
global symbol registry field name value [[key]] a string key used to identify a symbol. ...
...And 5 more matches
Strict mode - JavaScript
errors. javascript was designed to be easy for novice developers, and sometimes it gives operations which should be errors non-error semantics. sometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. strict mode treats these mistakes as errors so that they're discovered and promptly fixed. ...
...should be errors non-error semantics. sometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. strict mode treats these mistakes as errors so that they're discovered and promptly fixed. first, strict mode makes it impossible to accidentally create
global variables. in normal javascript mistyping a variable in an assignment creates a new property on the
global object and continues to "work" (although future failure is possible: likely, in modern javascript). ...
...reats these mistakes as errors so that they're discovered and promptly fixed. first, strict mode makes it impossible to accidentally create
global variables. in normal javascript mistyping a variable in an assignment creates a new property on the
global object and continues to "work" (although future failure is possible: likely, in modern javascript). assignments, which would accidentally create
global variables, instead throw an error in strict mode: 'use strict'; // assuming no
global variable mistypedvariable exists mistypevariable = 17; // this line throws a referenceerror due to the // misspelling of variable second, strict mode makes assignments which would otherwise silently fail to throw an exception. for example, nan is a non-writable g...
...And 5 more matches
Scrollbar - Archive of obsolete content
this example shows how to style the scrollbars in your xul application. scrollbars inside browser elements will be styled to. tested on windows xp. ...
... this example shows how to style the scrollbars in your xul application. scrollbars inside browser elements will be styled to. tested on windows xp. ...
... this example shows how to style the scrollbars in your xul application. scrollbars inside browser elements will be styled to. tested on windows xp. ...
...And 4 more matches
Creating a Skin - Archive of obsolete content
how to create a simple skin. for simplicity, we'll only apply it to the find files dialog. a simple skin the image below shows the current find files dialog. let's create a skin that we can apply to it. normally, a skin would apply to the entire application, but we'll focus on just the find files dialog to make it easier. for this reason, we'll modify only the file findfile.css rather than the
global.css file. this section assumes that you are starting with the classic skin. you may wish to make a copy of the files used by the find files dialog before editing. you need to create a file 'findfile.css' in a custom skin. or, you can temporarily place it in the content directory and refer to it using a stylesheet directive. you can modify the existing findfile.css directly to see what it looks...
...rties. 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://
global/skin/checkbox/images/cbox-check.jpg"); font-weight: bold; } #cancel-button { list-style-image: url("chrome://
global/skin/icons/images/close-button.jpg"); } button:hover { color: #000066; } we add some images to the buttons and make the find button have bold text to indicate that it is the default button. the last rule applies to buttons when the mouse is hovering over them. we set the...
...ox { margin: 4px; } toolbarbutton { margin-left: 3px; margin-right: 3px; } after those changes, the find files dialog now looks like the image. as you can see, some simple changes to the style rules has resulted in quite a different appearance to the find files dialog. we could continue by changing the menus, the grippies on the toolbar and the input and checkbox elements. creating a
global skin the skin created above is simple and only applies to the find files dialog. some of the changes made to the skin could be placed in the
global style sheets (those in the
global directory of the skin) to be applied to all applications. for example, having different images for the check boxes in the find files dialog as other windows looks a little odd. this change should really be moved into...
...And 4 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
git is a free, open-source, distributed source code management (scm) system. it facilitates handling code bases with distributed development teams. what sets it apart from previous scm systems is the ability to do common operations (branching, committing, etc.) on your local development machine, without having to change the master repository or even having write access to it. ...
...nt (scm) system. it facilitates handling code bases with distributed development teams. what sets it apart from previous scm systems is the ability to do common operations (branching, committing, etc.) on your local development machine, without having to change the master repository or even having write access to it. 172
global object codingscripting, glossary, needscontent a
global object is an object that always exists in the
global scope. ...
...eams. what sets it apart from previous scm systems is the ability to do common operations (branching, committing, etc.) on your local development machine, without having to change the master repository or even having write access to it. 172
global object codingscripting, glossary, needscontent a
global object is an object that always exists in the
global scope. 173
global scope codingscripting, glossary, needscontent in a programming environment, the
global scope is the scope that contains, and is visible in, all other scopes. 174
global variable codingscripting, glossary a
global variable is a variable that is declared in the
global scope in other words, a variable that is visible from all other scopes. 175 glyph glos...
...And 4 more matches
Command line crash course - Learn web development
ghtly more complex example let’s go through something a bit more complicated. we will first try to fetch the contents of mdn's "fetch" page using the curl command (which can be used to request content from urls), from /docs/web/api/fetch. however, this url is the old location of the page. if you enter it in a new browser tab, you’ll (eventually) get redirected to /docs/web/api/windoworworker
globalscope/fetch. therefore, if you use curl to request /docs/web/api/fetch, you won’t get an output. try it now: curl /docs/web/api/fetch we need to explicitly tell curl to follow redirects using the -l flag. let's also look at the headers that developer.mozilla.org returns using curl's -i flag, and print all the location redirects it sends to the terminal, by piping the output of curl into grep...
...grep to return all the lines that contain the word "location"). try running the following, and you’ll see that in fact there are three redirects happening before we reach the final page: curl /docs/web/api/fetch -l -i | grep location your output should look something like this (curl will first output some download counters and suchlike): location: /docs/web/api/fetch location: /docs/web/api/
globalfetch/
globalfetch.fetch() location: /docs/web/api/
globalfetch/fetch location: /docs/web/api/windoworworker
globalscope/fetch although contrived, we could take this result a little further and transform the location: line contents, adding the base origin to the start of each one so that we get complete urls printed out. for that, we'll add awk to the mix (which is a programming language akin to jav...
...to the start of each one so that we get complete urls printed out. for that, we'll add awk to the mix (which is a programming language akin to javascript or ruby or python, just a lot older!). try running this: curl /docs/web/api/fetch -l -i | grep location | awk '{ print "https://developer.mozilla.org" $2 }' your final output should look something like this: /docs/web/api/fetch /docs/web/api/
globalfetch/
globalfetch.fetch() /docs/web/api/
globalfetch/fetch /docs/web/api/windoworworker
globalscope/fetch by combining these commands we've customised the output to show the full urls that the mozilla server is redirecting through when we request the /docs/web/api/fetch url. getting to know your system will prove useful in years to come — learn how these single serving tools work and how they ca...
...And 4 more matches
Overview of Mozilla embedding APIs
ucture necessary to support dynamic registration, instantiation and manipulation of xpcom components. at the heart of xpcom's implementation is the service manager and the component manager. together, these two services provide a centralized point for gaining access to all of the public mozilla interfaces. the service manager exposes all of the available xpcom services - each service represents a
global object which provides some piece of functionality. the component manager allows new instances of registered xpcom components to be instantiated. the embedding layer consists of several components built on top of xpcom and its services. much of the gecko functionality is exposed through a component called the nswebbrowser. embedding applications can leverage this component to easily access many o...
...irst function call made into gecko. ns_termembedding this function shuts down gecko and cleans up any remaining resources... currently, once gecko has been shutdown, it cannot be restarted in the same process space... this should change in the future. nsmemory nsmemory::alloc nsmemory::realloc nsmemory::free this helper class provides static accessors to the
global nsmemory service. ns_get
globalcomponentmanager this function returns an instance of the component manager service. ns_convertasciitoucs2 this is a helper class which converts an ascii string into a ucs2 string. typically, instances of this class are stack allocated, and wrap ascii arguments which must be converted into ucs2. do_queryinterface this is a helper class which works in conj...
... this function simplifies creating new component instances. nscomtypeinfo<interface-type>::getiid() this template helper class allows easy access to an interface's nsiid. typically the ns_get_iid(...) macro is used instead of using the nscomtypeinfo template directly. ns_getweakreference this function creates a weak reference to a component which implements the nsiweakreference interface.
global services nsservicemanager the service manager is the central repository for accessing instances of the various xpcom services. each service is represented by a singleton object which is instantiated the first time it is requested and remains alive until the service manager is shut down, or the service is explicitly unloaded. through the service manager, individual services can be loaded, unloaded...
...And 4 more matches
sslfnc.html
y default) enabled if nonzero, the specified cipher is enabled. if zero, the cipher is disabled. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the cipherprefsetdefault function enables or disables individual cipher suites
globally. you typically call this in response to changes in user-controlled settings. you must call this function once for each cipher you want to enable or disable. to enable or disable cipher suites for an individual socket, use ssl_cipherprefset. the set of available ssl cipher suites may grow from release to release of nss. applications will find it desirable to determine, at run time, what ssl2 c...
...understands them). calling this function permits use of cipher suites listed below (but doesn't necessarily enable them; see ssl export policy functions). policy for these suites is set to ssl_allowed unless otherwise indicated. ssl_restricted means the suite can be used by clients only when they are communicating with domestic server software or with international server software that presents a
global id certificate. for more details on policy settings, see ssl_cipherpolicyset. for ssl 2.0: ssl_en_rc4_128_export40_with_md5 ssl_en_rc2_128_cbc_export40_with_md5 for ssl 3.0: ssl_rsa_with_null_md5 ssl_rsa_with_rc4_128_md5 (ssl_restricted) ssl_rsa_with_3des_ede_cbc_sha (ssl_restricted) ssl_rsa_export_with_rc4_40_md5 ssl_rsa_export_with_rc2_cbc_40_md5 under some circumstanc...
...sha ssl_rsa_export_with_rc4_40_md5 ssl_rsa_export_with_rc2_cbc_40_md5 ssl_fortezza_dms_with_null_sha ssl_rsa_with_null_sha ssl_rsa_with_null_md5 policy one of the following values: ssl_allowed. cipher is always allowed by u.s. government policy. ssl_restricted. cipher is allowed by u.s. government policy for servers with
global id certificates. ssl_not_allowed. cipher is never allowed by u.s. government policy. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. description ssl_cipherpolicyset tells the ssl library that the specified cipher suite is allowed by the application's expor...
...And 4 more matches
JS_NewObject
is jscontext. clasp const jsclass * pointer to the class to use for the new object. if this is null, an ordinary javascript object is created. the jsclass may be used to override low-level object behavior, including such details as the physical memory layout of the object and how property lookups are done. added in spidermonkey 1.8.1 clasp->flags must not have the jsclass_
global_flags bits set (use js_new
globalobject instead). if clasp is non-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<jsobject*> pointer to the prototype object to use for the ...
...s an appropriate prototype for the newly created object if you don't supply one yourself. if the new object's class (here, clasp) is a built-in class, then its associated prototype is used as the new object's prototype. otherwise, object.prototype is used as the new object's prototype. previous behaviour obsolete since jsapi 45 here's how the process works in detail: first, we must identify a
global object. if the parent is non-null, we assume it is part of a scope chain, walk to the end of that chain, and use the
global object we find there. if the parent is null, we use the
global object at the end of the scope chain in which the context is currently executing. in other words, the context's current scope acts as a default parent. if the context is not currently executing any code, we us...
... if the parent is non-null, we assume it is part of a scope chain, walk to the end of that chain, and use the
global object we find there. if the parent is null, we use the
global object at the end of the scope chain in which the context is currently executing. in other words, the context's current scope acts as a default parent. if the context is not currently executing any code, we use js_get
globalobject to find a
global object associated with the context. next, we must find the given class's constructor in that
global object. normally we simply use the class's name as the name of the property of the
global object to fetch. however, although javascript code can freely redefine constructors, the ecmascript standard requires us in certain cases to use the original constructors' prototypes. ...
...And 4 more matches
Using the Places history service
design overview of places. this page provides a map to the external api. history services interface overview the mozilla history service has undergone many revisions. to maintain backwards compatibility, each version has implemented the older interfaces, resulting in functionality spread across many interfaces. the places history service ("navhistory") implements these history interfaces: nsi
globalhistory2: basic add page, is visited functionality used by the docshell when visiting and rendering pages. nsi
globalhistory3: adds extra functions for dealing with redirects and hints for rendering (gecko flags). nsibrowserhistory: adds functions used by the basic browser like marking pages as typed in the url bar, and removing pages as from the history interface. nsinavhistoryservice: complex ...
...grained getters and setters. nsiautocompletesearch: url-bar autocomplete from history from 1.9.1 (firefox3.1) on, don't use any places service on (or after) quit-application has been notified, since the database connection will be closed to allow the last sync, and changes will most likely be lost. use quit-application-granted instead. differences from previous implementations the previous ns
globalhistory service stored one entry for each page in history. this entry contained the url, title, visit count, last visit date, first visit date, host name, last referrer, flags for typed, hidden, and gecko flags (gecko flags is trunk only). the navhistory service has broken this into two tables (see history service design). the main url table stores the information about the page: url, host name, ...
...host name, title, visit count, hidden, and typed. stored separately is the information specific to each visit. this information is called a "visit" in this document and in the code. a visit contains a reference to the url table for the page, the visit date, the transition type (typed, click, redirect, bookmark, etc.), a reference to the referring visit, and the session id. this separation of the
global page information and the visit allows us to store information about each time the page was visited instead of just the last time. using the referrer information in each visit, the browsing path can be reconstructed at any time. the "session id" allows these paths to be reconstructed more easily. when the user starts browsing (for example, by typing in a link or following a bookmark), a new sessi...
...And 4 more matches
Avoiding leaks in JavaScript XPCOM components
wing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common javascript patterns that cause leaks. basics of memory management creating objects that are not a fixed size for the lifetime of the program (
global variables) or a fixed size for the lifetime of a function (stack variables) requires a system for dynamic memory allocation: a system that allocates memory from a space called the heap. the requirements for such a memory allocation system are: memory should be returned to the heap when the program no longer needs it (or soon thereafter) so that the amount of memory consumed by the program does...
...auses of leaks with garbage collection (the next strategy) also apply to reference counting as well. garbage collection garbage collection is generally used to refer to algorithms that (1) determine which objects are still needed by starting from a set of roots and finding all objects reachable from those objects and (2) returning all remaining objects to the heap. the roots include things like
global variables and variables on the current call stack. mozilla's javascript engine uses one of the most common garbage collection algorithms, mark and sweep, in which the garbage collector clears the mark bit on each object, sets the mark bits on all roots and all objects reachable from them, and then finalizes all objects not marked and returns the memory they used to the heap. garbage collection (...
...ap. garbage collection (at least when the term is not used to refer to lesser algorithms like reference counting) is pretty good at freeing memory that should be freed. however, in a fully garbage-collected system the programmer can still create leaks by leaving objects reachable that are no longer needed. for example, if an object's constructor adds the object to a list that is reachable from a
global variable and nothing ever removes it from the list, the object will never be destroyed since it is always reachable from the list. memory management in xpcom and javascript javascript code that uses xpcom through xpconnect uses two different memory management models. javascript uses garbage collection. xpcom uses reference counting. authors of javascript code that uses xpcom objects can't depen...
...And 4 more matches
PointerEvent - Web APIs
itizer. pointerleave this event is fired when a pointing device is moved out of the hit test boundaries of an element. for pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer. gotpointercapture this event is fired when an element receives pointer capture. lostpointercapture this event is fired after pointer capture is released for a pointer. ...
...this event is fired when a pointing device is moved out of the hit test boundaries of an element. for pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer. gotpointercapture this event is fired when an element receives pointer capture. lostpointercapture this event is fired after pointer capture is released for a pointer. ...
...evice is moved out of the hit test boundaries of an element. for pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer. gotpointercapture this event is fired when an element receives pointer capture. lostpointercapture this event is fired after pointer capture is released for a pointer.
globaleventhandlers
globaleventhandlers.onpointerover a
global event handler for the pointerover event. ...
...And 4 more matches
Service Worker API - Web APIs
ilable, the new version is installed in the background, but not yet activated — at this point it is called the worker in waiting. it is only activated when there are no longer any pages loaded that are still using the old service worker. as soon as there are no more pages to be loaded, the new service worker activates (becoming the active worker). activation can happen sooner using serviceworker
globalscope.skipwaiting() and existing pages can be claimed by the active worker using clients.claim(). you can listen for the installevent; a standard action is to prepare your service worker for usage when this fires, for example by creating a cache using the built in storage api, and placing assets inside it that you'll want for running your app offline. there is also an activate event. the point w...
...ervice worker client. a service worker client is either a document in a browser context or a sharedworker, which is controlled by an active worker. clients represents a container for a list of client objects; the main way to access the active service worker clients at the current origin. ...
...ched on the serviceworker
globalscope, as part of the service worker lifecycle. this ensures that any functional events (like fetchevent) are not dispatched to the serviceworker, until it upgrades database schemas, and deletes outdated cache entries, etc. extendablemessageevent the event object of a message event fired on a service worker (when a channel message is received on the serviceworker
globalscope from another context) — extends the lifetime of such events. fetchevent the parameter passed into the serviceworker
globalscope.onfetch handler, fetchevent represents a fetch action that is dispatched on the serviceworker
globalscope of a serviceworker. it contains information about the request and resulting response, and provides the fetchevent.respondwith() method, which allows us to p...
...And 4 more matches
A basic 2D WebGL animation example - Web APIs
on of the vertex is computed by applying the rotation vector, found in the uniform urotationvector, that's been computed by the javascript code. then the final position is computed by multiplying the rotated position by the scaling vector provided by the javascript code in uscalingfactor. the values of z and w are fixed at 0.0 and 1.0, respectively, since we're drawing in 2d. the standard webgl
global gl_position is then set to the transformed and rotated vertex's position. fragment shader next comes the fragment shader. its role is to return the color of each pixel in the shape being rendered. since we're drawing a solid, untextured object with no lighting applied, this is exceptionally simple: <script id="fragment-shader" type="x-shader/x-fragment"> #ifdef gl_es precision highp floa...
...he transformed and rotated vertex's position. fragment shader next comes the fragment shader. its role is to return the color of each pixel in the shape being rendered. since we're drawing a solid, untextured object with no lighting applied, this is exceptionally simple: <script id="fragment-shader" type="x-shader/x-fragment"> #ifdef gl_es precision highp float; #endif uniform vec4 u
globalcolor; void main() { gl_fragcolor = u
globalcolor; } </script> this starts by specifying the precision of the float type, as required. then we set the
global gl_fragcolor to the value of the uniform u
globalcolor, which is set by the javascript code to the color being used to draw the square. html the html consists solely of the <canvas> that we'll obtain a webgl context on. <canvas id=...
...we won't discuss these here; instead, we'll talk about them as they're used in the code to come. ...
...And 4 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
) and its controller (listing 6). we’ve already covered the dialog element in chapter 3. in this case, we only want to display an ok button, so we set the buttons attribute to accept. within the window are a label element and textbox element, wrapped in a hbox element so that they are arranged horizontally. ...
...file. the dtd file is located inside the locale package, and the correct file is picked automatically to match the user’s language preferences. edit clock.xul to match listing 8. add the doctype declaration that references the dtd file, and replace “clock” and “current time” with entity references. ...
...-small.png from the resources website and place them appropriately. fixme: figure 10: directory structure with skin package added add the skin package update chrome.manifest with the contents of listing 10. listing 10: additional content for chrome.manifest skin helloworld classic/1.0 skin/classic/ style chrome://browser/content/browser.xul chrome://helloworld/skin/overlay.css style chrome://
global/content/customizetoolbar.xul chrome://helloworld/skin/overlay.css register skin package (skin instruction) line 1 beginning skin is used to register the skin package; helloworld is the package name; skin/classic/ is the relative path to the folder containing the source files; classic/1.0 indicates that this skin package is meant for the firefox standard theme. cross-package overlays with styl...
...And 3 more matches
Getting Started - Archive of obsolete content
inside classic.jar is one directory, skin. skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\communicator communicator contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\editor editor contains files of composer. skin\classic\
global global contains almost all of the important css files that define the appearance of the suite. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\messenger messenger contains styles of the mail client. skin\classic\messenger-newsblog messenger-newsblog contains the only css file. skin\classic\mozapps mozap...
...e it installable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. copying the necessary files the first step is to move all the files into the right directory structure. so create a new directory called my_theme. create a directory called chrome inside it. into this directory put a zip archive called my_theme.jar containing navigator,
global, communicator, editor, help, messenger, messenger-newsblog and mozapps directories from above. (yes, this means that the structure of your new directory and classic.jar will be slightly different.) creating the install files icon.png and preview.png these are some png images containing the icon and the preview of the theme. chrome.manifest make a copy of chrome.manifest and place it in \my_theme ...
...th the name of your theme. the packages section lists which components of the browser you're modifying. if we also had skins for chatzilla, we would need to add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. ...
...And 3 more matches
Getting Started - Archive of obsolete content
me\installed-chrome.txt in a text editor. you should probably make a backup of this file now, just in case you make a mistake. in the file you'll see a list. do a search for classic.jar</cde>. on every line that references <code>classic.jar we need to make some changes (there are about 5 lines). delete the bolded text: original skin,install,url,jar:resource:/chrome/classic.jar!/skin/classic/
global/ modified skin,install,url,resource:/chrome/classic/skin/classic/
global/ once you have made these modifications, save them and run mozilla. if mozilla runs fine, that means that it worked. if it doesn't appear as you expected, then go back into the installed-chrome.txt file and double check that you modified the lines correctly. changing borders and colours this is the part where knowing cs...
...ng borders and colours this is the part where knowing css comes in handy. to find all of the css files that we're going to be modifying, we must first understand the directory structure. directories in \mozilla\chrome\classic\skin\classic there are a number of different directories which contain the skin information for the default packages that come with mozilla. the most important directory is \
global. the default widgets are defined here, and anything that is modified will change throughout mozilla. if you want to modify how checkboxes, radio buttons, and scrollbars appear, this is the place. the next directory is the \communicator directory. this is a catchall directory which holds all of the images and styles for portions of mozilla that don't merit their own individual directory. you'll be...
...ies are pretty self-explanatory. they contain the images/styles for the browser, email client, or html editor. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, etc. for this next part, let's modify the standard button. go into \mozilla\chrome\classic\skin\classic\
global and open button.css in your favourite text editor. scroll down to button {. this section defines the normal button in its basic state (there is no mouse over it, it's not disabled, and it's not selected). change the background-color: to darkblue and the color: to white. save the file and run mozilla. when the browser pops up, you probably won't be able to see much. open the preferences dialog box...
...And 3 more matches
XUL Structure - Archive of obsolete content
gh the underlying code for mozilla calls them skins and the user interface calls them themes, they're both referring to the same thing. the classic.jar file describes the default theme provided with firefox. the structure is similar to the content packages. for example, examining classic.jar: skin classic browser browser.css -- other browser skin files go here --
global --
global skin files go here -- . . . again, this directory structure isn't necessary and is used for convenience. you can actually put all the files in one directory at the top level and not use subdirectories. however, for larger applications, subdirectories are used to separate the different components. in the example above, a directory exists for theme related files for the browser...
...al skin files go here -- . . . again, this directory structure isn't necessary and is used for convenience. you can actually put all the files in one directory at the top level and not use subdirectories. however, for larger applications, subdirectories are used to separate the different components. ...
... again, this directory structure isn't necessary and is used for convenience. you can actually put all the files in one directory at the top level and not use subdirectories. however, for larger applications, subdirectories are used to separate the different components. in the example above, a directory exists for theme related files for the browser and another for
global theme related files. ...
...And 3 more matches
Using the standard theme - Archive of obsolete content
at the beginning, there is no style when creating a new xul <tt>window</tt> (or a new <tt>dialog</tt>, for that matter) in your extension, and you do not associate a style sheet with it, your widgets will be unstyled. ...
...with it, your widgets will be unstyled. meaning, some internal default will be applied, which does by no means correspond to the standard theme (the theme currently chosen by the user in the theme selector), or even the default theme delivered with your the base application. applying the standard theme in order to use the theme currently chosen by the user of the base application (the so called "
global skin"), you have to add the following line to your xul file: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> this imports the styles found in the <tt>
global/skin</tt> chrome directory and will make the standard xul widgets of your application use the selected chosen theme. you do not have to specify a specific file; mozilla will determine by its own which files in the directory ...
...xul file: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> this imports the styles found in the <tt>
global/skin</tt> chrome directory and will make the standard xul widgets of your application use the selected chosen theme. you do not have to specify a specific file; mozilla will determine by its own which files in the directory it needs to use. if you are only going to use these
global style sheets, you of course do not need a <tt>skin</tt> directory in your extension package, and also do not have to register a style in the <tt>chrome.manifest</tt>. adding custom styles in order to provide custom styling for some of your widgets (apart from the standard
global skin) you can take two different routes. you can either add multiple <tt>xml-stylesheet</tt> processing instructions t...
...And 3 more matches
Reference - Archive of obsolete content
is where the recursion is introduced, 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 ...
...or/feature has a small note telling what version introduced that feature. perhaps a larger footnote if there are backwards-compatibility issues involved in using that feature. <hr> xmlhttprequest xmlhttprequest is a host object provided by the browser, not part of js core language. i reverted the addition of xhr to the reference. we should link to some dom vs. ...
...a host object provided by the browser, not part of js core language. i reverted the addition of xhr to the reference. we should link to some dom vs. js article from the main page and
global objects page at least. --nickolay 09:48, 31 january 2007 (pst) yes, it's not a "core" javascript object. let me try to add the links you suggested ... --davidcary 10:25, 31 january 2007 (pst) why distinguish
global objects from
global properties from
global functions? why do we distinguish
global objects from
global properties from
global functions? it seems like "
global object" and "
global property" are synonyms, and all
global functions are
global objects/properties. is there something i'm missing? ruakh 20:31, 26 february 2007 (pst) this was something that was supposed to be fixed in the reorganizatio...
...And 3 more matches
Functions — reusable blocks of code - Learn web development
pe and conflicts let's talk a bit about scope — a very important concept when dealing with functions. when you create a function, the variables and other things defined inside the function are inside their own separate scope, meaning that they are locked away in their own separate compartments, unreachable from code outside the functions. the top level outside all your functions is called the
global scope. values defined in the
global scope are accessible from everywhere in the code. javascript is set up like this for various reasons — but mainly because of security and organization. sometimes you don't want variables to be accessible from everywhere in the code — external scripts that you call in from elsewhere could start to mess with your code and cause problems because they happen t...
...inside their enclosures — in the same manner as the function scopes. if they were able to get into other enclosures, problems would occur. at best, different animals would feel really uncomfortable inside unfamiliar habitats — a lion or tiger would feel terrible inside the penguins' watery, icy domain. at worst, the lions and tigers might try to eat the penguins! the zoo keeper is like the
global scope — he or she has the keys to access every enclosure, to restock food, tend to sick animals, etc. active learning: playing with scope let's look at a real example to demonstrate scoping. first, make a local copy of our function-scope.html example. this contains two functions called a() and b(), and three variables — x, y, and z — two of which are defined inside the functions, and o...
... he or she has the keys to access every enclosure, to restock food, tend to sick animals, etc. active learning: playing with scope let's look at a real example to demonstrate scoping. first, make a local copy of our function-scope.html example. this contains two functions called a() and b(), and three variables — x, y, and z — two of which are defined inside the functions, and one in the
global scope. it also contains a third function called output(), which takes a single parameter and outputs it in a paragraph on the page. open the example up in a browser and in your text editor. open the javascript console in your browser developer tools. in the javascript console, enter the following command: output(x); you should see the value of variable x output to the screen. now try enter...
...And 3 more matches
Styling Vue components with CSS - Learn web development
of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn about styling vue components. styling vue components with css before we move on to add more advanced features to our app, we should add some basic css to make it look better. vue has three common approaches to styling apps: external css files.
global styles in single file components (.vue files). component-scoped styles in single file components. to help familiarize you with each one, we'll use a combination of all three to give our app a nicer look and feel. styling with external css files you can include external css files and apply them
globally to your app. let's look at how this is done. to start with, create a file called reset.cs...
...; this will cause the file to get picked up during the build step and automatically added to our site. the reset styles should be applied to the app now. the images below show the look of the app before and after the reset is applied. before: after: noticeable changes include the removal of the list bullets, background color changes, and changes to the base button and input styles. adding
global styles to single file components now that we've reset our css to be uniform across browsers, we need to customize the styles a bit more. there are some styles that we want to apply across components in our app. while adding these files directly to the reset.css stylesheet would work, we'll instead add them to the <style> tags in app.vue to demonstrate how this can be used. there are already som...
...stead add them to the <style> tags in app.vue to demonstrate how this can be used. there are already some styles present in the file. let's remove those and replace them with the styles below. these styles do a few things — adding some styling to buttons and inputs, and customizing the #app element and its children. ...
...And 3 more matches
SpiderMonkey 1.8.7
hich accepts pointers to specific types. js_addroot has been replaced by js_addobjectroot, js_addvalueroot and js_addstringroot; similar changes were made for js_addnamedroot and js_removeroot. since jsdoubles are now stored in the jsval, instead of on the heap, we no longer need to define roots for them. compartments spidermonkey 1.8.5 introduces the concept of compartments. a compartment is a
global object, a context, and a set of related objects with no outside references (crosscompartment wrappers excepted). the new garbage collector can perform per-container garbage collection, which can be a significant performance improvement for certain workloads. no compartment may execute js code or call into jsapi on two os threads at the same time. for more information, see spidermonkey compartmen...
...sfastnative has been renamed to jsnative and relevant interfaces have been updated accordingly. embedders converting functions from old-jsnative to new-jsnative (jsfastnative) should study the jsfastnative documentation thoroughly, and pay particular that they do not reference negative indices of argv in spidermonkey 1.8.5; the js_callee, js_this, etc. macros must be used instead. see bug 581263.
global objects
global objects have been specialized, and must be be created with either js_new
globalobject or js_newcompartmentand
globalobject. js_newobject and js_newobjectwithgivenproto remain the correct apis for creating other objects.
global objects must also have the jsclass_
global_flags flag set. merely setting jsclass_is_
global is insufficient. new c apis js_assert_string_is_flat js_addgcthi...
...sion js_executeregexp js_executeregexpnostatics js_executescriptversion js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_get
globalforscopechain js_getinternedstringchars js_getinternedstringcharsandlength js_getownpropertydescriptor js_getpropertyattrsgetterandsetterbyid js_getpropertybyid js_getpropertybyiddefault js_getpropertydefault js_getpropertydescriptorbyid js_getruntimesecuritycallbacks js_getsecuritycallbacks js_getstringcharsandlength js_getstringcharsz js_getstringcharszandlength js_getstringencodin...
...And 3 more matches
Building the WebLock UI
// check to see if locking is on or off weblock.lock(); wlocked = 1; } function wunlock() { // check to see if locking is on or off weblock.unlock(); wlocked = 0; } an important preliminary of these functions is that the weblock component be made available to the javascript in the form of the weblock object being used in the snippets above. as you can see, weblock is initialized as a
global javascript variable, available in the scope of these functions and others: var weblock = components.classes["@dougt/weblock"] .getservice() .queryinterface(components.interfaces.iweblock); in addition to this basic setup, you must also write javascript that uses the addsite method to add new sites to the white list. this is a bit more complicated...
... string directly in from the user interface, or we can do a check on the string and verify that it's a valid url. in this tutorial, focusing as it is on the weblock functionality (rather than the ui), we'll assume the strings we get from the ui itself are urls we actually want to write to the white list: function addthissite() { var tf = document.getelementbyid("dialog.input"); // weblock is
global and declared above weblock.addsite(tf.value); } this javascript function can be called directly from the xul widget, where the input string is retrieved as the value property of the textbox element. you also need to create the function that displays the weblock window itself when the user clicks the weblock icon in the statusbar. that function uses the opendialog method from the window objec...
...e user interface for the dialog and the events that initiate interaction with the web locking are defined. at the top of all xul documents, an xml declaration is followed by the root element for the document, which is usually <window/> but for dialog boxes can also be the element <dialog/>. the "shell" for the xul file, then, looks like this: <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <dialog id="weblock_ui" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="web lock manager" persist="screenx screeny" screenx="24" screeny="24"> </dialog> note that this part of the xul file also contains a stylesheet declaration, which imports css rules and applies them to particular parts of the interface. i...
...And 3 more matches
nsIXPConnect
jsval getxowforobject(in jscontextptr ajscontext, in jsobjectptr aparent, in jsobjectptr awrappedobj); native code only! ...
...arent, in jsobjectptr awrappedobj); native code only! ...
....9 currentjsstack nsistackframe read only. currentnativecallcontext nsaxpcnativecallcontextptr read only. deferreleasesuntilaftergarbagecollection prbool obsolete since gecko 1.9 pendingexception nsiexception constants constant value description init_js_standard_classes 1 << 0 flag_system_
global_object 1 << 1 omit_components_object 1 << 2 xpc_xow_clearscope 1 tells updatexows() to clear the scope of all of the xows it finds. obsolete since gecko 2.0 methods native code only!addjsholder root js objects held by aholder. void addjsholder( in voidptr aholder, in nsscriptobjecttracerptr atracer ); parameters aholder the object that ...
...And 3 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
te in greater detail, along with which input types they are associated with.those that are common to most or all input types are defined in greater detail below. attributes that are unique to particular input types—or attributes which are common to all input types but have special behaviors when used on a given input type—are instead documented on those types' pages. this element includes the
global attributes. those with extra importance as it relates to <input> are highlighted. attributes for the <input> element include
global html attributes and: attribute type or types description accept file hint for expected file type in file upload controls alt image alt attribute for the image type. required for accessibility autocomplete ...
...te valid for the image and submit input types only. see the submit input type for more information. formtarget valid for the image and submit input types only. see the submit input type for more information. height valid for the image input button only, the height is the height of the image file to display to represent the graphical submit button. see the image input type. ...
...values include none, text, tel, url, email, numeric, decimal, and search. list the value given to the list attribute should be. ...
...And 3 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
, last: last }; } function personfullname(person) { return person.first + ' ' + person.last; } function personfullnamereversed(person) { return person.last + ', ' + person.first; } var s = makeperson('simon', 'willison'); personfullname(s); // "simon willison" personfullnamereversed(s); // "willison, simon" this works, but it's pretty ugly. you end up with dozens of functions in your
global namespace. what we really need is a way to attach a function to an object. since functions are objects, this is easy: function makeperson(first, last) { return { first: first, last: last, fullname: function() { return this.first + ' ' + this.last; }, fullnamereversed: function() { return this.last + ', ' + this.first; } }; } var s = makeperson('simon', 'w...
...lname(); // "simon willison" s.fullnamereversed(); // "willison, simon" note on the this keyword. used inside a function, this refers to the current object. what that actually means is specified by the way in which you called that function. if you called it using dot notation or bracket notation on an object, that object becomes this. if dot notation wasn't used for the call, this refers to the
global object. note that this is a frequent cause of mistakes. for example: var s = makeperson('simon', 'willison'); var fullname = s.fullname; fullname(); // undefined undefined when we call fullname() alone, without using s.fullname(), this is bound to the
global object. since there are no
global variables called first or last we get undefined for each one. we can take advantage of the this keywo...
...tion nestedfunc() { var b = 4; // parentfunc can't use this return a + b; } return nestedfunc(); // 5 } this provides a great deal of utility in writing more maintainable code. if a called function relies on one or two other functions that are not useful to any other part of your code, you can nest those utility functions inside it. this keeps the number of functions that are in the
global scope down, which is always a good thing. this is also a great counter to the lure of
global variables. when writing complex code it is often tempting to use
global variables to share values between multiple functions — which leads to code that is hard to maintain. nested functions can share variables in their parent, so you can use that mechanism to couple functions together when it makes sen...
...And 3 more matches
Arrow function expressions - JavaScript
ct mode function calls. the base object if the function was called as an "object method". etc. this proved to be less than ideal with an object-oriented style of programming. function person() { // the person() constructor defines `this` as an instance of itself. this.age = 0; setinterval(function growup() { // in non-strict mode, the growup() function defines `this` // as the
global object (because it's where growup() is executed.), // which is different from the `this` // defined by the person() constructor. this.age++; }, 1000); } var p = new person(); in ecmascript 3/5, the this issue was fixable by assigning the value in this to a variable that could be closed over. function person() { var that = this; that.age = 0; setinterval(function growup() {...
...exically enclosing function: function person(){ this.age = 0; setinterval(() => { this.age++; // |this| properly refers to the person object }, 1000); } var p = new person(); relation with strict mode given that this comes from the surrounding lexical context, strict mode rules with regard to this are ignored. ...
...00); } var p = new person(); relation with strict mode given that this comes from the surrounding lexical context, strict mode rules with regard to this are ignored. var f = () => { 'use strict'; return this; }; f() === window; // or the
global object all other strict mode rules apply normally. correction: start note: the previous statement seems false. strict mode should prevent creating
global variables when assigning to an undeclared identifier in a function. ...
...And 3 more matches
let - JavaScript
ariables to declare. each must be a legal javascript identifier. value1, value2, …, valuen optional for each variable declared, you may optionally specify its initial value to any legal javascript expression. description let allows you to declare variables that are limited to the scope of a block statement, or expression on which 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 scopi...
...riable is the entire enclosing function: function vartest() { var x = 1; { var x = 2; // same variable! ...
...n: function vartest() { var x = 1; { var x = 2; // same variable! console.log(x); // 2 } console.log(x); // 2 } function lettest() { let x = 1; { let x = 2; // different variable console.log(x); // 2 } console.log(x); // 1 } at the top level of programs and functions, let, unlike var, does not create a property on the
global object. ...
...And 3 more matches
preferences/service - Archive of obsolete content
access the preferences system in firefox. this enables add-ons to get and set system-wide settings. these are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager.
globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,number,boolean preference value. example: var name = "extensions.checkcompatibility.nightly"; require("sdk/preferences/service").set(name, false); get(name, defaultvalue) gets the application preference name. parameters name : string defaultvalue : str...
... 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. ...
...ome://
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. ...
...And 2 more matches
Boxes - Archive of obsolete content
in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout. this does not happen with xul box (or hbox and vbox) by default. however, you can easily add this capability with a style change. ...
..."sss"/> <label value="ttt"/> <label value="uuu"/> <label value="vvv"/> <label value="www"/> <label value="xxx"/> <label value="yyy"/> <label value="zzz"/> </hbox> </window> images if you put image in the contents, you should probably add align="start" attribute to the box. ...
... </window> images if you put image in the contents, you should probably add align="start" attribute to the box. ...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
de them. because a xul document is also an xml document, it can contain xhtml, svg, mathml, and other elements; if you use external entity references, the xml document's contents are modularized; combined with other xml-related technologies, such as dom, xlink, or xslt, you can use it for a number of different applications. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://
global/skin/"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- contents go here. --> </window> listing 2: general structure of a xul document even with the internationalization of firefox and extensions, this kind of xml function is being used. reading in style sheets xul uses css to specify the appearance of its elements. again, since xul is a type of xml, st...
...ization of firefox and extensions, this kind of xml function is being used. reading in style sheets xul uses css to specify the appearance of its elements. again, since xul is a type of xml, stylesheets are read in using the xml-stylesheet processing instruction. on line 2 of listing 2, we’re reading in the theme’s standard style sheet. by referring to a special style sheet within chrome://
global/skin/, we can make label and button sizes, window background color, etc, match the currently selected theme in firefox. we can also read in a stylesheet that we had set up ourselves. the xul box model in principle, xul lays out all ui components using combinations of two kinds of boxes: horizontal and vertical. as shown in listing 3, elements can be laid out horizontally using the hbox (horizon...
...eir values. the action taken when pressing one of these buttons is defined by an event handler with the name ondialog<button name>. if these event handlers are not defined, pressing either the accept button or cancel button will simply close that dialog. listing 8 shows a simple dialog example, and figure 5 shows its output. ...
...And 2 more matches
JavaScript Object Management - Archive of obsolete content
the first step to good javascript object management is having a namespace, or a javascript object that contains our code and data, that you know will not conflict with firefox code or other extensions. ...
...y follow is that the first part of the namespace corresponds to the development group (or company), and the second to the specific project. however, most extensions are small projects by individuals, so these examples follow 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 a...
... the message a few times, so that the number increments. now open a new window and display the message from the new window. what do you think will happen? what will the count be this time? you probably didn't expect this, but the count was reset in the new window. each window keeps its own counter, and now the extension is not behaving as expected. this is a fundamental lesson: the chrome is not
global, it's window-specific. all of your scripts and objects are replicated for each window, and they work independently from each other. this is an issue that is very easy to overlook, since most firefox users, specially power users, have a single window open at all times. you have to make sure you test your extension with multiple windows open; never assume everything will work the same as with a sin...
...And 2 more matches
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
g. skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\
global global contains almost all of the important css files that define the appearance of the browser. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. install your new theme b...
...y difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. copying the necessary files the first step is to move all the files into the right directory structure. so create a new directory called my_theme. into this directory put the browser,
global, communicator, help, and mozapps directories from above, as well as the icon.png and preview.png files. (yes, this means that the structure of your new directory and classic.jar will be slightly different.) creating the install files contents.rdf make a copy of contents.rdf, place it in \my_theme and open it up in your text editor. this file is a small xml database which is used to describe th...
...to add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. <rdf:li resource="urn:mozilla:skin:my_theme:communicator"/> <rdf:li resource="urn:mozilla:skin:my_theme:editor"/> <rdf:li resource="urn:mozilla:skin:my_theme:
global"/> <rdf:li resource="urn:mozilla:skin:my_theme:messenger"/> <rdf:li resource="urn:mozilla:skin:my_theme:navigator"/> save the file and exit the text editor. install.rdf make a copy of install.rdf and place it in the my_theme directory, then open it up in your text editor. this file is a small xml database that describes the skin. <description about="urn:mozilla:install-manifest"> <em:id>...
...And 2 more matches
PyDOM - Archive of obsolete content
note that we don't actually 'import' anything here - the scripts and event handlers do not exist in a python module. the intent is to provide similar semantics to js. ...
...note that we don't actually 'import' anything here - the scripts and event handlers do not exist in a python module. the intent is to provide similar semantics to js. ...
...note that we don't actually 'import' anything here - the scripts and event handlers do not exist in a python module. the intent is to provide similar semantics to js. ...
...And 2 more matches
Using Remote XUL - Archive of obsolete content
ve a screenshot here of a xul document loaded in a content window***] this tutorial walks you through the process of building xul-based navigation for the mozilla.org web site. after completing the tutorial you should understand how to: create xul documents; serve them from a web server; use cascading style sheets (css) to change their appearance; use javascript to define their behavior.
global web site navigation most web sites today have poor
global navigation (features for locating and visiting pages across the entire site). it is difficult to discern the site's basic structure and available resources, which makes it hard to locate a particular page or find the one with the information you want. part of the problem is that html has limited features for navigation. its primary mecha...
...order to give them style we have to reference a stylesheet with rules for styling menus. we could write one ourselves, but we'll make our lives easier and use one of the stylesheets that comes with mozilla-based browsers. in this case, we'll reference the default application stylesheet--the one used by the browser to style its own interface. ...
...skin). if we were to switch the browser to a different skin, the style of our menus would also change. if we want our site to have the same look no matter what skin the user is using, we would need to write our own stylesheet to style the elements. ...
...And 2 more matches
Building a Theme - Archive of obsolete content
ckaged and distributed in zip files or bundles, with the xpi (pronounced “zippy”) file extension. an example of the content within a typical xpi file for a theme: example.xpi: /install.rdf /chrome.manifest /preview.png /icon.png /chrome/ browser/ communicator/
global/ mozapps/ we'll want to create a file structure similar to the one above for our tutorial, so let's begin by creating a folder for your theme somewhere on your hard disk (e.g. c:\themes\my_theme\ or ~/themes/my_theme/). inside your new theme folder, create two new empty text files, one called chrome.manifest and the other called install.rdf. the file preview.png is shown a...
.../firefox.app/contents/macos/omni.ja now, open (or unzip) this file into the directory you created. it contains several folders, modules, jssubloader and others. the files we will be needing are located under the chrome\toolkit\skin\classic folder. create a folder called chrome in your theme's folder. next, the contents of the following directories to their respective folders into the folder.
global to chrome/
global mozapps to chrome/mozapps now that you've copied the
global and mozapps folders, a handful of other folders from the browser/omni.ja archive are required. it is located in the browser folder in the location mentioned above. the files we will be needing from the browser/omni.ja archive are located under chrome/browser/skin/classic. copy the contents of the following directorie...
...copy the contents of the following directories to their respective folders. this gives us a base set of styles to work with. browser to chrome/browser/ communicator to chrome/communicator/ you should end up with this directory structure: <ext path>/ /install.rdf /chrome.manifest /chrome/ browser/ communicator/
global/ mozapps/ after this, it would be a good idea to read the article setting up extension development environment and follow the directions there. it's especially important to install the dom inspector, which we'll be using in later steps. create the install manifest open the file called install.rdf that you created at the top of your extension's folder hierarchy and put this ...
...And 2 more matches
Client-side storage - Learn web development
ok at what we have to do in the first place, to actually set up a database. below the constant declarations, add the following lines: // create an instance of a db object for us to store the open database in let db; here we are declaring a variable called db — this will later be used to store an object representing our database. we will use this in a few places, so we've declared it
globally here to make things easier. next, add the following to the bottom of your code: window.onload = function() { }; we will write all of our subsequent code inside this window.onload event handler function, called when the window's load event fires, to make sure we don't try to use indexeddb functionality before the app has completely finished loading (it could fail if we don't). ...
...o notes stored.'; list.appendchild(listitem); } }; } the first part of this could use some explaining — we retrieve the id of the record to be deleted using number(e.target.parentnode.getattribute('data-note-id')) — recall that the id of the record was saved in a data-note-id attribute on the <li> when it was first displayed. we do however need to pass the attribute through the
global built-in number() object as it is of datatype string, and therefore wouldn't be recognized by the database, which expects a number. we then get a reference to the object store using the same pattern we've seen previously, and use the idbobjectstore.delete() method to delete the record from the database, passing it the id. when the database transaction is complete, we delete the note's <li> from...
...we then use the body.blob() method to extract each response's body as a blob, giving us an object representation of the videos that can be stored and displayed later on. we have a problem here though — these two requests are both asynchronous, but we only want to try to display or store the video when both promises have fulfilled. fortunately there is a built-in method...
...And 2 more matches
Performance
nctions and initialize some fairly heavyweight objects. better: addon.js as above // framescript.js components.utils.import("resource://my-addon/processmodule.jsm", {}).addframe(this) // processmodule.jsm const exported_symbols = ['addframe']; const precomputedconstants = // ... function helper(window, action) { // ... ...
...objects. better: addon.js as above // framescript.js components.utils.import("resource://my-addon/processmodule.jsm", {}).addframe(this) // processmodule.jsm const exported_symbols = ['addframe']; const precomputedconstants = // ... function helper(window, action) { // ... do some work on the window } function dosomething(message) { frame
global = message.target result = helper(frame
global.content, message.data) frame
global.sendasyncmessage("my-addon:response-from-child", {something: result}) } function addframe(frame
global) { frame
global.addmessagelistener("my-addon:request-from-parent", dosomething) } javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks. but care must be tak...
...alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed. ...
...And 2 more matches
Mozilla DOM Hacking Guide
nstructorfnc) (const char* aname); it is initialized with the docreate member function of the helper class passed as third argument to the macro. nsiclassinfo *mcachedclassinfo: mcachedclassinfo holds an nsiclassinfo pointer to an instance of the relevant helper class. const nsiid *mprotochaininterface: pointer to the iid of the first interface available to javascript clients. this is used in
global resolve functions, when xpconnect has to find the member function to call. const nsiid **minterfaces: pointer to the first element of an array of pointers to all the interfaces available through js for this class. pruint32 mscriptableflags: 31; : the fourth argument passed to ns_define_classinfo_data_with_name. prbool mhasclassinterface: 1; : help me? mname and mconstructorfptr, mscriptablef...
.... static nsiscriptsecuritymanager *ssecman: used by the dom security engine. initialized in init(). static nsresult definestaticjsvals(jscontext *cx);: used to define all the static jsstring data members of nsdomclassinfo. static prbool sisinitialized: keeps track of wether class info was already initialized, because init() shouldn't be called twice. static jsval *sx_id: strings used in the
global resolve methods for comparison with the passed in arguments. they represent special words for the dom. initialized by definestaticjsvals(). static const jsclass *sobjectclass: help me! static prbool sdosecuritycheckinaddproperty;: help me! nsdomclassinfo::init() this method is to be called only once. its purpose is, well, to initialize... it does a lot of different things: fill the blanks in...
...o::getclassinfoinstance 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, ...
...And 2 more matches
Power profiling overview
nd voltage, and higher-numbered p-states operate at a lower frequency and voltage to reduce power consumption. processors can have dozens of p-states, but the transitions are controlled by the hardware and os and so p-states are of less interest to application developers than c-states. power and power-related measurements there are several kinds of power and power-related measurements. ...
... devices such as ammeters give the best results, but these can be expensive and difficult to set up. ...
...e easiest and best to use because it reads all power planes, it's a command line utility, and it doesn't measure anything else. proxy measurements the next best measurements are proxy measurements, i.e. measurements of things that affect power consumption such as cpu activity, gpu activity, wakeup frequency, c-state residency, disk activity, and network activity. some of these are measured on a
global basis, and some can be measured on a per-process basis. some can also be measured via instrumentation within firefox itself. the correlation between each proxy measure and power consumption is hard to know and can vary greatly. when used carefully, however, they can still be useful. this is because they can often be measured in a more fine-grained fashion than power measurements and estimates, w...
...And 2 more matches
Research and prep
ider and mozilla, ask for permission from the site provider to include it. ensure that your suggestions follow these parameters: search there are typically five search plug-ins listed for firefox desktop (only four for firefox mobile): generic search the default option should expose the quickest path to the best result on the world wide web for the user (indexing a large portion of the
global www).
global search the second position can be used for the next best local language provider, meaning coverage within the local language and/or locale (indexing a smaller portion of the www but producing better local language results). local search a good test is if you were to run a set of comparative queries; the secondary engine should produce the best local language results a...
...used for the next best local language provider, meaning coverage within the local language and/or locale (indexing a smaller portion of the www but producing better local language results). local search a good test is if you were to run a set of comparative queries; the secondary engine should produce the best local language results and the primary/default position should produce the best
global results. e-commerce search these search engines should allow users to get connected to new and used products they want to buy as quickly and painlessly as possible in a "trusted" site -- for example, choosing the most popular auction, general shopping, or classified type sites that have the desired user experience are good choices. there should be no more than two. specific interest s...
...ed in your language (because it makes the application unusable if it's not in your language provide for the intended user experience (e.g., minimal to no advertisements within the user experience) no more than three (if possible) choices. choosing based on popularity is fine. examples from various localizations some examples from en-us web service provider rationale
global search google best user experience and broadest results. e-commerce search amazon broad set of products, simple search interface with no/limited advertising, popular shopping engine. specific interest wikipedia good user experience (no ads, simple interface), popular site. rss reader google reader popular, no advertising, simple interface. ...
...And 2 more matches
Introduction to NSPR
separate domains: local threads are scheduled within a process only and are handled entirely by nspr, either by completely emulating threads on each host operating system (os) that doesn't support threads, or by using the threading facilities of each host os that does support threads to emulate a relatively large number of local threads by using a relatively small number of native threads.
global threads are scheduled by the host os--not by nspr--either within a process or across processes on the entire host.
global threads correspond to native threads on the host os. nspr threads can also be either user threads or system threads. nspr provides a function, pr_cleanup, that synchronizes process termination. pr_cleanup waits for the last user thread to exit before returning, whereas it ig...
...hreads are based loosely on hints provided by the client and sometimes constrained by the underlying operating system. therefore, priorities are not rigidly defined. for more information, see thread scheduling. in general, it's preferable to create local user threads with normal priority and let nspr take care of the details as appropriate for each host os. it's usually not necessary to create a
global thread explicitly unless you are planning to port your code only to platforms that provide threading services with which you are familiar or unless the thread will be executing code that might directly call blocking os functions. threads can also have "per-thread-data" attached to them. each thread has a built-in per-thread error number and error string that are updated when nspr operations fail...
...relative to a lower-priority thread. this preference is still subject to resource availability, and must not be used in place of proper synchronization. for more information on thread synchronization, see nspr thread synchronization. the issue is further muddied by inconsistent offerings from os vendors regarding the priority of their kernel-supported threads. nspr assumes that the priorities of
global threads are not manageable, but that the host os will perform some sort of fair scheduling. it's usually preferable to create local user threads with normal priority and let nspr and the host take care of the details. in some nspr configurations, there may be an arbitrary (and perhaps large) number of local threads being supported by a more limited number of virtual processors (an internal appli...
...And 2 more matches
Invariants
t stack frame down, thanks to generators!) an object's scope chain (found by chasing jsobject::fslots[jsslot_parent]) never forms a cycle. (we can probably loop forever if that happens. js_setparent can violate this, if the application is really that dumb, but generally every object is newer than its __parent__.) the tracejit 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 ...
...re being created. the public api for compartment-hopping, jsautoentercompartment, and the internal api, js::autocompartment, both make sure the invariant is maintained. however, there is another internal api, js::switchtocompartment, that lets you break this invariant, and of course in xpconnect we use that from time to time when we know we aren't going to be creating any new objects (other than
global objects, which have no parent or prototype) or doing anything that might call back into native code that could create objects. we do this in order to save some cpu cycles (in other words, for no good reason whatsoever). if !js_isrunning(cx) && cx->
globalobject == null, then cx->compartment == cx->runtime->defaultcompartment. while executing a script, cx->compartment == script->compartment. but ...
...nt == cx->runtime->defaultcompartment. while executing a script, cx->compartment == script->compartment. but this is true only so long as we are actually in the interpreter or jit code. a jsnative or other callback may move cx to another compartment, as long as it returns cx to the script's compartment before returning. a given trace-jit trace stays within a single compartment (indeed, a single
global object) end-to-end. lifetime invariants in some places, pointers to jsobjects and jsstrings must refer to live heap objects, but this is not a hard fast rule, especially for strings. some jsstrings are allocated on the stack for quick operations. some commonly used strings are allocated statically; see jsstring::isstatic(). most jscontext pointers must point to live contexts, but jstitle::owne...
...And 2 more matches
JS::PersistentRooted
syntax js::persistentrooted<t> var; // added in spidermonkey 38 js::persistentrooted<t> var(cx); js::persistentrooted<t> var(cx, initial); js::persistentrooted<t> var(rt); js::persistentrooted<t> var(rt, initial); name type description cx jscontext * the context to get the runtime in which to add the root rt jsruntime * the runtime in which to add the root. initial t an initial value for the persistent rooted variable. ...
... persistentrooted<t>& operator=(const t& p) sets the value of ptr. persistentrooted<t>& operator=(const persistentrooted<t>& other) bool operator!=(const t& other) const compares ptr and other. bool operator==(const t& other) const description js::persistentrooted<t> declares a variable of type t whose value is always rooted. this is typically used for
global variables. js::persistentrooted<t> is a copyable, assignable
global gc root type with arbitrary lifetime, an infallible constructor, and automatic unrooting on destruction. these roots can be used in heap-allocated data structures, so they are not associated with any particular jscontext or stack. they are registered with the jsruntime itself, without locking, so they require a full jscontext t...
...e kinds of edges, heap<t> or tenuredheap<t> would be better types. it's up to the implementor of the type containing heap<t> or tenuredheap<t> members to make sure their referents get marked when the object itself is marked. js::persistentrooted<t> may be automatically coerced to a js::handle<t> and js::mutablehandle<t>. before spidermonkey 38, persistentrooted<t> itself cannot be a
global variable, but from spidermonkey38, it can be declared as a
global variable, and initialized later with init() method (bug 1107639). there are typedefs available for the main types: namespace js { typedef persistentrooted<jsfunction*> persistentrootedfunction; typedef persistentrooted<jsid> persistentrootedid; typedef persistentrooted<jsobject*> persistentrootedobject; typedef persisten...
...And 2 more matches
JSClass.flags
) indicates that instances of this class have n reserved slots. n is an integer in the range [0..255]. the slots initially contain unspecified valid jsval values. they can be accessed using js_getreservedslot and js_setreservedslot. (the jsclass.reserveslots hook also allocates reserved slots to objects.) mxr id search for jsclass_has_reserved_slots jsclass_
global_flags this flag is only relevant for the class of an object that is used as a
global object. (ecmascript specifies a single
global object, but in spidermonkey the
global object is the last object in the scope chain, which can be different objects at different times. this is actually quite subtle. js_executescript and similar apis set the
global object for the code they execute. js_set...
..._flags this flag is only relevant for the class of an object that is used as a
global object. (ecmascript specifies a single
global object, but in spidermonkey the
global object is the last object in the scope chain, which can be different objects at different times. this is actually quite subtle. js_executescript and similar apis set the
global object for the code they execute. js_set
globalobject sets an object which is sometimes used as the
global object, as a last resort.) enable standard ecmascript behavior for setting the prototype of certain objects, such as function objects. ...
...he scope chain, which can be different objects at different times. this is actually quite subtle. js_executescript and similar apis set the
global object for the code they execute. js_set
globalobject sets an object which is sometimes used as the
global object, as a last resort.) enable standard ecmascript behavior for setting the prototype of certain objects, such as function objects. ...
...And 2 more matches
JSPrincipals
description refcount mozilla::atomic<int32_t> reference count. 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. obsolete since jsapi 12 destroy void (*)(jscontext *, jsprincipals *) pointer to the function that decrements the reference count and possibly frees the principals if they are no longer in use. obsolete since jsapi 13 methods name description ...
... not defined by the js engine but should be provided by the embedding. added in spidermonkey 17 description jsprincipals is the abstract base class of all principals objects, the objects that identify the source of a function or script and are used to determine its privileges. a principals object is like a java codesource. jsprincipals could be passed into the js engine through the js_new
globalobject function. jsprincipals has refcount property that is the reference count. this is used for memory management. each time an object is referenced, refcount must be increased by one. each time an object is dereferenced, refcount must be decremented by one. when refcount reaches zero, the principals are no longer in use and are destroyed. use the js_holdprincipals to increment refcount, and us...
...ject is indelibly associated not only with the script being compiled or evaluated, but with all functions ever created by that script or code eval()-ed by it. codebase points to the common codebase for this object or script. only objects and scripts that share a common codebase can interact. getprincipalarray is a pointer to the function that retrieves the principals for this object or script.
globalprivilegesenabled is a flag that indicates whether principals are enabled
globally. refcount is the reference count. this is used for memory management. each time an object is referenced, refcount must be increased by one. each time an object is dereferenced, refcount must be decremented by one. when refcount reaches zero, the principals are no longer in use and are destroyed. use the jsprincipal...
...And 2 more matches
JS_SetOptions
option description jsoption_extra_warnings warn on dubious practice. mxr id search for jsoption_extra_warnings jsoption_werror convert warnings to errors. mxr id search for jsoption_werror jsoption_varobjfix make js_evaluatescript() use the last object on its obj param's scope chain (that is, the
global object) as the ecma "variables object". this flag is recommended. without it, the two scripts "x = 1" and "var x = 1", where no variable x is in scope, do two different things. the former creates a property on the
global object. the latter creates a property on obj. with this flag, both create a
global property. mxr id search for jsoption_varobjfix jsoption_private_i...
...at you may currently (jan 2009) experience bugs with this option enabled. mxr id search for jsoption_jit jsoption_no_script_rval added in spidermonkey 1.8.1 by setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to js_executescript. ...
...jit jsoption_no_script_rval added in spidermonkey 1.8.1 by setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to js_executescript. ...
...And 2 more matches
SpiderMonkey 1.8.5
hich accepts pointers to specific types. js_addroot has been replaced by js_addobjectroot, js_addvalueroot and js_addstringroot; similar changes were made for js_addnamedroot and js_removeroot. since jsdoubles are now stored in the jsval, instead of on the heap, we no longer need to define roots for them. compartments spidermonkey 1.8.5 introduces the concept of compartments. a compartment is a
global object, a context, and a set of related objects with no outside references (crosscompartment wrappers excepted). the new garbage collector can perform per-container garbage collection, which can be a significant performance improvement for certain workloads. no compartment may execute js code or call into jsapi on two os threads at the same time. for more information, see spidermonkey compartmen...
...sfastnative has been renamed to jsnative and relevant interfaces have been updated accordingly. embedders converting functions from old-jsnative to new-jsnative (jsfastnative) should study the jsfastnative documentation thoroughly, and pay particular that they do not reference negative indices of argv in spidermonkey 1.8.5; the js_callee, js_this, etc. macros must be used instead. see bug 581263.
global objects
global objects have been specialized, and must be be created with either js_new
globalobject or js_newcompartmentand
globalobject. js_newobject and js_newobjectwithgivenproto remain the correct apis for creating other objects.
global objects must also have the jsclass_
global_flags flag set. merely setting jsclass_is_
global is insufficient. new c apis js_assert_string_is_flat js_addgcthi...
...sion js_executeregexp js_executeregexpnostatics js_executescriptversion js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_get
globalforscopechain js_getinternedstringchars js_getinternedstringcharsandlength js_getownpropertydescriptor js_getpropertyattrsgetterandsetterbyid js_getpropertybyid js_getpropertybyiddefault js_getpropertydefault js_getpropertydescriptorbyid js_getruntimesecuritycallbacks js_getsecuritycallbacks js_getstringcharsandlength js_getstringcharsz js_getstringcharszandlength js_getstringencodin...
...And 2 more matches
Split object
. an outer object may be associated with different inner objects at different times. this feature is complicated. programs other 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 persis...
...time 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 moves from page to page. but each web page must load with fresh
globals. (the problem is even a bit subtler than this, since the reference may be direct or indirect. the script in a might have opened tb by calling window.open, which returns a direct reference to tb's window. more indirectly, suppose there's a javascript function defined in page b that refers to
global variables in page b. if page a gets a reference to that function, then by calling it, it is indir...
...atch. 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. spidermonkey walks up the scope chain to the nearest object that has jsprincipals attached. the end of the scope chain is the
global object for the script. but what jsprincipals should be attached to a window object? the principals of the page the window is currently displaying? but then the page that called window.open could use a with statement to inject that window into its scope chain, gaining access to that window's privileges. (note: with does add an object to the scope chain, but it's a special with wrapper object that ...
...And 2 more matches
Places Developer Guide
of an item (bookmark, folder, separator) prtime getitemdateadded(aitemid) - returns the time in microseconds that an item was added prtime getitemlastmodified(aitemid) - returns the time in microseconds that an item was last modified int64 getfolderidforitem(aitemid) - returns the id of the folder containing the given item. string getitemguid(aitemid) obsolete since gecko 14.0 - returns a
globally unique identifier for the item. this is mainly for use by extensions that sync bookmark data between different profiles. for bookmarks: nsiuri getbookmarkuri(aitemid) - returns the uri of a bookmark item string getkeywordforbookmark(aitemid) - returns a bookmark's keyword, or null for folders: int64 getchildfolder(afolderid, asubfoldertitle) - returns the id of the first subfolder mat...
...mid, aindex) - changes an item's position. note: this does not re-index the whole folder - use moveitem for a managed solution. setitemdateadded(aitemid, adateadded) - set the date the item was first added, in microseconds. setitemlastmodified(aitemid, alastmodified) - set the date the item was last modified, in microseconds. setitemguid(aitemid, aguid) obsolete since gecko 14.0 - returns a
globally unique identifier for the item. this is mainly for use by extensions that sync bookmark data between different profiles. moveitem (afolderid, anewparentid, aindex) - move an item from one folder to another. for bookmarks: changebookmarkuri(aitemid, auri) - change a bookmark's uri. setkeywordforbookmark(aitemid, akeyword) - set the keyword for a bookmark. deleting bookmark items with th...
...ice); the history service provides methods for adding, editing, deleting browser history. it's also the jump-off point for querying and searching the history and bookmarks collections. while nsinavhistory is the main interface for history, there are a couple of other interfaces available for legacy and context-specific uses: nsibrowserhistory - detailed page addition and removal methods nsi
globalhistory2 - simple page detection and addition nsi
globalhistory3 - for adding document redirects adding to history places provides a couple of interfaces for adding to, and editing the browsing history. the main interface is nsinavhistoryservice. other interfaces that provide specialized abilities are nsibrowserhistory and nsi
globalhistory. examples of the capabilities of each are provided below...
...And 2 more matches
nsIContentPrefService
sed as well. nsivariant getpref( in nsivariant agroup, in astring aname, in nsicontentprefcallback acallback optional ); parameters agroup the group for which to retrieve a preference; this may be specified as either a uri or as a string; in either case, the group consists of all sites matching the hostname portion of the specified uri. specify null to get the preference from the
global preference space; those preferences apply to all sites. aname the name of the preference whose value is to be retrieved. acallback an optional nsicontentprefcallback to receive the result. if desired, javascript callers can instead provide a function to call upon completion. return value the preference's value is returned; this value may be a string, integer, boolean, or any othe...
...e could only be specified by nsiuri. now a string can be used as well. nsipropertybag2 getprefs( in nsivariant agroup ); parameters agroup the group whose preferences are to be retrieved; this may be specified as either a uri or as a string; in either case, the group consists of all sites matching the hostname portion of the specified uri. specify null to get the preferences from the
global preference space; those preferences apply to all sites. return value the result is an nsipropertybag2 containing the preferences and their values. exceptions thrown ns_error_illegal_value if agroup is not a string, nsiuri, or null. getprefsbyname() returns the values of all preferences with the specified name. nsipropertybag2 getprefsbyname( in astring aname ); parameters aname...
...specified by nsiuri. now a string can be used as well. boolean haspref( in nsivariant agroup, in astring aname ); parameters agroup the group for which to see if a preference exists; this may be specified as either a uri or as a string. in either case, the group consists of all sites matching the hostname portion of the specified uri. specify null to check for the preference in the
global preference space; those preferences apply to all sites. aname the name of the preference whose existence is to be determined. return value true if the preference exists; otherwise false. exceptions thrown ns_error_illegal_value if agroup is not a string, nsiuri, or null. or if aname is null or an empty string removegroupedprefs() remove all grouped prefs. useful for removing re...
...And 2 more matches
nsIFrameScriptLoader
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisupports this interface is used to load frame scripts. ...
... in boolean aallowdelayedload, [optional] in boolean arunin
globalscope) void removedelayedframescript(in astring aurl); jsval getdelayedframescripts(); loadframescript() load a script in the remote frame. frame scripts are loaded as soon as loadframescript() is called. ...
...otherwise it will only be loaded into frames that exist at the time of the call. ...
...And 2 more matches
Using the clipboard
s. that way, you could have a text version and an html version of the content. the transferable object will hold its own copy of the data. when you've added all the flavors you want, you can put it all on the clipboard at once. the transferable object will hold all of the data that you want until you're ready to put it on the clipboard. services.clipboard.setdata(trans, null, services.clipboard.k
globalclipboard); we get the system clipboard object and store it in the clip variable. we can copy the data to the clipboard by calling the function setdata. the first parameter of this function is the transferable. the second parameter can usually be set to null but you could set it to an nsiclipboardowner so that you can tell when the data you've copied is overwritten by another copy operation. call...
.... the second parameter can usually be set to null but you could set it to an nsiclipboardowner so that you can tell when the data you've copied is overwritten by another copy operation. call setdata only when you're ready to copy to the system clipboard. the third parameter to setdata (and the parameter to emptyclipboard) indicates which clipboard buffer to use. the above code uses the constant k
globalclipboard for this, which refers to the
global clipboard. this would be the same one that cut and paste operations from the edit menu typically use. if you use kselectionclipboard instead, you will copy into the selection buffer, which is generally only available on unix systems. this multi-step process has resulted in text being copied on the clipboard. we can cut to the clipboard instead of cop...
...ting the original data. normally, the text would be in a document or textbox. the code is put together below, with additional error checking: var copytext = "text to copy"; var trans = transferable(sourcewindow); trans.adddataflavor("text/unicode"); trans.settransferdata("text/unicode", supportsstring(copytext), copytext.length * 2); services.clipboard.setdata(trans, null, services.clipboard.k
globalclipboard); the complete function shown below copies some text to the clipboard as html, as well as making it a clickable hyperlink. so we've added a text flavor and an html flavor of the content. the transferable object will hold both flavors. function copylinktoclipboard(copyurl, copylabel, sourcewindow) { // generate the unicode and html versions of the link var textunicode = copyurl...
...And 2 more matches
Index
18 cookies in thunderbird cookies, guide, thunderbird in versions of thunderbird prior to 3 the cookie policy was very restrictive (to rss only). thunderbird 3 uses the gecko cookie policy with some changes. 19 creating a gloda message query thunderbird 3, thunderbird this page describes how to programmatically create a message query using gloda, thunderbird's
global database. see the gloda page for background on the component. see gloda examples for more code samples. 20 db views (message lists) mailnews, thunderbird the thread pane (aka message list) is driven by classes that implement nsimsgdbview and inherit from nsmsgdbview. these are the main view classes: 24 events there are a lot of events that can be fired i...
...n writing extensions that affect the folder pane. see working with the folder pane for examples and code snippets. 28 gloda thunderbird 3, thunderbird thunderbird includes a new message indexing and search system (gloda) that improves search performance, provides sophisticated full-text search capabilities and categorized search results. "gloda" is short for the thunderbird "
global database". 29 gloda debugging the gloda code has log4moz logging statements spread throughout. the following preferences are supported to control how this gets logged: 30 gloda examples thunderbird 3, thunderbird this page provides some examples for using gloda. see creating a gloda message query for more examples. 31 gloda indexing ...
... and related header information for a mail message. 46 message examples thunderbird no summary! 47 message list examples thunderbird no summary! 48 message list interfaces thunderbird no summary! 50 spam filtering seth spitzer the mozilla implement is based on paul graham's a plan for spam. training data is
global across all mail accounts within a profile training data is stored in a binary format, in a file named "training.dat". initially, the training.dat file is empty (there was discussion of shipping with a default file) on spam detection, the user can choose to move spam to a special "junk" folder the user can configure junk mail can be automatically purged from the "junk" folder to ana...
...And 2 more matches
Working with windows in chrome code
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 or pass a ...
...ostrecentwindow and getenumerator. please refer to the nsiwindowmediator page for more information and examples of using nsiwindowmediator. === example: opening a window only if it's not opened already === xxx tbd passing data between windows when working with multiple windows, you often need to pass information from one window to another. since different windows have separate dom documents and
global objects for scripts, you can't just use one
global javascript variable in scripts from different windows. there are several techniques of varying power and simplicity that can be used to share data. we'll demonstrate them from the simplest to the most complex in the next few sections. note: if you want to pass data between privileged (chrome) and non-privileged (web page) windows, or vice-versa...
...dow is a bit less trivial . ...
...And 2 more matches
Using the Beacon API - Web APIs
asynchronous and non-blocking request to a web server. beacon requests use http post and do not require a response. beacon requests are guaranteed to be initiated before the page unloads. this document contains examples of the beacon interfaces. see beacon api for an overview. navigator.sendbeacon() the beacon api's navigator.sendbeacon() method sends a beacon request to the server in the
global browsing context. the method takes two arguments: the url and the data to send. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns true and returns false otherwise. the following example specifies a handler for the load and beforeunload events. the handler calls sendb...
...andler and when that event is fired, the handler calls sendbeacon(). ...
...send_analytics() { var data = json.stringify({ location: location.href, time: date() }); navigator.sendbeacon('/analytics', data); }; workernavigator.sendbeacon() the beacon api's workernavigator.sendbeacon() method works identically to the usual method, but is accessible from worker
global scope. in the following example, a worker sends a beacon using the url and data from the
global context. ...
...And 2 more matches
Applying styles and colors - Web APIs
th(); ctx.arc(12.5 + j * 25, 12.5 + i * 25, 10, 0, math.pi * 2, true); ctx.stroke(); } } } <canvas id="canvas" width="150" height="150"></canvas> draw(); the result looks like this: screenshotlive sample transparency in addition to drawing opaque shapes to the canvas, we can also draw semi-transparent (or translucent) shapes. ...
...); } } } <canvas id="canvas" width="150" height="150"></canvas> draw(); the result looks like this: screenshotlive sample transparency in addition to drawing opaque shapes to the canvas, we can also draw semi-transparent (or translucent) shapes. this is done by either setting the
globalalpha property or by assigning a semi-transparent color to the stroke and/or fill style. ...
...t (or translucent) shapes. this is done by either setting the
globalalpha property or by assigning a semi-transparent color to the stroke and/or fill style.
globalalpha = transparencyvalue applies the specified transparency value to all future shapes drawn on the canvas. the value must be between 0.0 (fully transparent) to 1.0 (fully opaque). this value is 1.0 (fully opaque) by default. the
globalalpha property can be useful if you want to draw a lot of shapes on the canvas with similar transparency, but otherwise it's generally more useful to set the transparency on individual 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 co...
...And 2 more matches
DragEvent - Web APIs
pointer is over a valid drop target (every 50 ms when mouse is not moving else much faster between 5 ms (slow movement) and 1ms (fast movement) approximately. this firing pattern is different than mouseover ). dragstart this event is fired when the user starts dragging an element or text selection. drop this event is fired when an element or text selection is dropped on a valid drop target. ...
... drop target (every 50 ms when mouse is not moving else much faster between 5 ms (slow movement) and 1ms (fast movement) approximately. this firing pattern is different than mouseover ). dragstart this event is fired when the user starts dragging an element or text selection. drop this event is fired when an element or text selection is dropped on a valid drop target. ...
... mouse is not moving else much faster between 5 ms (slow movement) and 1ms (fast movement) approximately. this firing pattern is different than mouseover ). dragstart this event is fired when the user starts dragging an element or text selection. drop this event is fired when an element or text selection is dropped on a valid drop target.
globaleventhandlers
globaleventhandlers.ondrag a
global event handler for the drag event. ...
...And 2 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. htmlelement.contenteditable is a domstring, where a value of true means the element is editable and a value of false means it isn't. html...
...at indicates whether or not the content of the element can be edited. htmlelement.contextmenu is a htmlmenuelement representing the contextual menu associated with the element. it may be null. htmlorforeignelement.dataset read only returns a domstringmap with which script can read and write the element's custom data attributes (data-*) . htmlelement.dir is a domstring, reflecting the dir
global attribute, representing the directionality of the element. possible values are "ltr", "rtl", and "auto". htmlelement.draggable is a boolean indicating if the element can be dragged. htmlelement.dropzone read only returns a domsettabletokenlist reflecting the dropzone
global attribute and describing the behavior of the element regarding a drop operation. htmlelement.hidden is a boolean indi...
...reignelement.tabindex is a long representing the position of the element in the tabbing order. htmlelement.title is a domstring containing the text that appears in a popup box when mouse is over the element. htmlelement.translate is a boolean representing the translation. event handlers most event handler properties, of the form onxyz, are defined on the documentandelementeventhandlers,
globaleventhandlers or toucheventhandlers interfaces and implemented by htmlelement. in addition, the following handlers are specific to htmlelement. htmlelement.oncopy returns the event handling code for the copy event (bug 280959). htmlelement.oncut returns the event handling code for the cut event (bug 280959). htmlelement.onpaste returns the event handling code for the paste event (bug...
...And 2 more matches
Browser storage limits and eviction criteria - Web APIs
ent. basically, the persistent folder was renamed to permanent a while ago to keep upgrades/migration simpler. note: users shouldn’t add their own directories or files under <profile>/storage. this will cause storage initialization to fail; for example, open() will fire an error event. storage limits the maximum browser storage space is dynamic — it is based on your hard drive size. the
global limit is calculated as 50% of free disk space. in firefox, an internal browser tool called the quota manager keeps track of how much disk space each origin is using up, and deletes data if necessary. so if your hard drive is 500 gb, then the total storage for a browser is 250 gb. if this is exceeded, a process called origin eviction comes into play, deleting an entire origin's worth of data unti...
... gb. if this is exceeded, a process called origin eviction comes into play, deleting an entire origin's worth of data until the storage amount goes under the limit again. there is no trimming effect put in place to delete parts of origins — deleting one database of an origin could cause problems with inconsistency. there's also another limit called group limit — this is defined as 20% of the
global limit, but it has a minimum of 10 mb and a maximum of 2 gb. each origin is part of a group (group of origins). there's one group for each etld+1 domain. for example: mozilla.org — group1, origin1 www.mozilla.org — group1, origin2 joe.blogs.mozilla.org — group1, origin3 firefox.com — group2, origin4 in this group, mozilla.org, www.mozilla.org, and joe.blogs.mozilla.org can aggregat...
...10 mb and a maximum of 2 gb. each origin is part of a group (group of origins). there's one group for each etld+1 domain. ...
...And 2 more matches
TouchEvent - Web APIs
r touchstart and touchmove is true and calls to preventdefault() will have no effect. to override this behavior, you need to set the passive option to false, after which calling preventdefault() will work as specified. the change to treat listeners as passive by default prevents the listener from blocking page rendering while a user is scrolling. a demo is available on the google developer site. ...
...e is true and calls to preventdefault() will have no effect. to override this behavior, you need to set the passive option to false, after which calling preventdefault() will work as specified. the change to treat listeners as passive by default prevents the listener from blocking page rendering while a user is scrolling. a demo is available on the google developer site. ...
...no effect. to override this behavior, you need to set the passive option to false, after which calling preventdefault() will work as specified. the change to treat listeners as passive by default prevents the listener from blocking page rendering while a user is scrolling. a demo is available on the google developer site. ...
...And 2 more matches
WebGLRenderingContext.getUniformLocation() - Web APIs
r the specified program hasn't been linked successfully. example in this example, taken from the animatescene() method in the article a basic 2d webgl animation example, obtains the locations of three uniforms from the shading program, then sets the value of each of the three uniforms. ...
... example in this example, taken from the animatescene() method in the article a basic 2d webgl animation example, obtains the locations of three uniforms from the shading program, then sets the value of each of the three uniforms. ...
...f each of the three uniforms. gl.useprogram(shaderprogram); uscalingfactor = gl.getuniformlocation(shaderprogram, "uscalingfactor"); u
globalcolor = gl.getuniformlocation(shaderprogram, "u
globalcolor"); urotationvector = gl.getuniformlocation(shaderprogram, "urotationvector") gl.uniform2fv(uscalingfactor, currentscale); gl.uniform2fv(urotationvector, currentrotation); gl.uniform4fv(u
globalcolor, [0.1, 0.7, 0.2, 1.0]); this code snippet is taken from the function animatescene() in "a basic 2d webgl animation example." see that article for the full sample and to see the resulting animation in action. ...
...And 2 more matches
Web APIs
ionevent animationplaybackevent animationtimeline arraybufferview attr audiobuffer audiobuffersourcenode audioconfiguration audiocontext audiocontextlatencycategory audiocontextoptions audiodestinationnode audiolistener audionode audionodeoptions audioparam audioparamdescriptor audioparammap audioprocessingevent audioscheduledsourcenode audiotrack audiotracklist audioworklet audioworklet
globalscope audioworkletnode audioworkletnodeoptions audioworkletprocessor authenticatorassertionresponse authenticatorattestationresponse authenticatorresponse b baseaudiocontext basiccardrequest basiccardresponse batterymanager beforeinstallpromptevent beforeunloadevent biquadfilternode blob blobbuilder blobevent bluetooth bluetoothadvertisingdata bluetoothcharacteristicproperties b...
...ustomevent d domconfiguration domerror domexception domhighrestimestamp domimplementation domimplementationlist domlocator dommatrix dommatrixreadonly domobject domparser dompoint dompointinit dompointreadonly domquad domrect domrectreadonly domstring domstringlist domstringmap domtimestamp domtokenlist domuserdata datatransfer datatransferitem datatransferitemlist dedicatedworker
globalscope delaynode deprecationreportbody devicelightevent devicemotionevent devicemotioneventacceleration devicemotioneventrotationrate deviceorientationevent deviceproximityevent directoryentrysync directoryreadersync displaymediastreamconstraints document documentfragment documentorshadowroot documenttimeline documenttouch documenttype doublerange dragevent dynamicscompressornode e e...
...r filesystementry filesystementrysync filesystemfileentry filesystemflags filesystemsync focusevent fontface fontfaceset fontfacesetloadevent formdata formdataentryvalue formdataevent fullscreenoptions g gainnode gamepad gamepadbutton gamepadevent gamepadhapticactuator geolocation geolocationcoordinates geolocationposition geolocationpositionerror geometryutils gestureevent
globaleventhandlers gyroscope h htmlanchorelement htmlareaelement htmlaudioelement htmlbrelement htmlbaseelement htmlbasefontelement htmlbodyelement htmlbuttonelement htmlcanvaselement htmlcollection htmlcontentelement htmldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldivelement htmldocument htmlelement htmlembedelement htmlfieldsetelement htmlfonteleme...
...And 2 more matches
Keyboard - Accessibility
f returning assistive technology to a non-interactive state (often called "browse mode"). most interactive elements are focusable by default; you can make an element focusable by adding a tabindex=0 attribute value to it. however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex
global html attribute
global event handlers: onkeydown
global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyboard. a value of zero indicates that the element is part of the default focus order, which is based on the ordering of elements in the html document. a positive value puts the element ahead ...
...ith positive values are focused in the order of their tabindex values (1, then 2, then 3, etc.). this creates confusion for keyboard-only users when the focus order differs from the logical order of the page. a better strategy is to structure the html document so that focusable elements are in a logical order, without the need to re-order them with positive tabindex values. see also tabindex
global html attribute understanding focus order don't use tabindex greater than 0 clickable elements must be focusable and should have interactive semantics if an element can be clicked with a pointing device, such as a mouse, then it should also be focusable using the keyboard, and the user should be able to do something by interacting with it. an element is clickable if it has an onclick event h...
...user should be able to do something by interacting with it. an element is clickable if it has an onclick event handler defined. you can make it focusable by adding a tabindex=0 attribute value to it. you can make it operable with the keyboard by defining an onkeydown event handler; in most cases, the action taken by event handler should be the same for both types of events. see also tabindex
global html attribute
global event handlers: onkeydown
global event handlers: onkeyup interactive elements must be able to be activated using a keyboard if the user can interact with an element using touch or a pointing device, then the element should also support interacting using the keyboard. that is, if you have defined event handlers for touch or click events, you should also define them for k...
...And 2 more matches
itemid - HTML: Hypertext Markup Language
note: the whatwg definition specifies that an itemid must be a url. ...
... note: the whatwg definition specifies that an itemid must be a url. ...
... note: the whatwg definition specifies that an itemid must be a url. ...
...And 2 more matches
Grammar and types - JavaScript
code letters such as å and ü in identifiers. (for more details, see this blog post.) you can also use the unicode escape sequences as characters in identifiers. some examples of legal names are number_hits, temp99, $credit, and _name. declaring variables you can declare a variable in two ways: with the keyword var. for example, var x = 42. ...
...the keyword var. for example, var x = 42. this syntax can be used to declare both local and
global variables, depending on the execution context. with the keyword const or let. for example, let y = 13. this syntax can be used to declare a block-scope local variable. (see variable scope below.) you can also simply assign a value to a variable for example, x = 42. this form creates an undeclared
global variable. it also generates a strict javascript warning. undeclared
global variables can often lead to unexpected behavior. thus, it is discouraged to use undeclared
global variables. evaluating variables a variable declared using the var or let statement with no assigned value specified has the value of undefined. an attempt to access an undeclared variable results in a referenceerror excepti...
...myfunction(); the undefined value converts to nan when used in numeric context. var a; a + 2; // evaluates to nan when you evaluate a null variable, the null value behaves as 0 in numeric contexts and as false in boolean contexts. for example: var n = null; console.log(n * 32); // will log 0 to the console variable scope when you declare a variable outside of any function, it is called a
global variable, because it is available to any other code in the current document. when you declare a variable within a function, it is called a local variable, because it is available only within that function. javascript before ecmascript 2015 does not have block statement scope. rather, a variable declared within a block is local to the function (or
global scope) that the block resides within. for...
...And 2 more matches
Function - JavaScript
ect. this can be seen with the 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 functi...
...ded value. arguments can be passed as they are. function.prototype.tostring() returns a string representing the source code of the function. overrides the object.prototype.tostring method. ...
... representing the source code of the function. overrides the object.prototype.tostring method. examples difference between function constructor and function declaration functions created with the function constructor do not create closures to their creation contexts; they always are created in the
global scope. when running them, they will only be able to access their own local variables and
global ones, not the ones from the scope in which the function constructor was created. ...
...And 2 more matches
delete operator - JavaScript
os: 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 deleted from the scope within which they were defined. non-configur...
...nfigurable, delete won't have any effect, and will return false. in strict mode this will raise a typeerror. ...
...n strict mode, this would have raised an exception. strict vs. non-strict mode when in strict mode, if delete is used on a direct reference to a variable, a function argument or a function name, it will throw a syntaxerror. therefore, to avoid syntax errors in strict mode, you must use the delete operator in the form of delete object.property or delete object['property']. object.defineproperty(
globalthis, 'variable1', { value: 10, configurable: true, }); object.defineproperty(
globalthis, 'variable2', { value: 10, configurable: false, }); // syntaxerror in strict mode. console.log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in...
...And 2 more matches
Content Scripts - Archive of obsolete content
ement content scripts. content scripts can be one of the more confusing aspects of working with the sdk, but you're very likely to have to use them. there are five basic principles: the add-on's main code, including "main.js" and other modules in "lib", can use the sdk high-level and low-level apis, but can't access web content directly content scripts can't use the sdk's apis (no access to
globals exports, require) but can access web content sdk apis that use content scripts, like page-mod and tabs, provide functions that enable the add-on's main code to load content scripts into web pages content scripts can be loaded in as strings, but are more often stored as separate files under the add-on's "data" directory. jpm doesn't make a "data" directory by default, so you must add it and put...
...tribute(), then the listener is evaluated in the page's context, so it will not have access to any variables defined in the content script. for example, this content script will fail with the error "themessage is not defined": var themessage = "hello from content script!"; anelement.setattribute("onclick", "alert(themessage);"); second, if you define an event listener by direct assignment to a
global event handler like onclick, then the assignment might be overridden by the page. for example, here's an add-on that tries to add a click handler by assignment to window.onclick: var myscript = "window.onclick = function() {" + " console.log('unsafewindow.onclick: ' + window.document.title);" + "}"; require("sdk/page-mod").pagemod({ include: "*", contentscript:...
...; // content-script.js self.port.on("alert", function(message) { window.alert(message); }); the context-menu module doesn't use the communication model described here. to learn about communicating with content scripts loaded using context-menu, see the context-menu documentation. ...
...cessing port in the content script in the content script the port object is available as a property of the
global self object. so to emit a message from a content script: self.port.emit("mycontentscriptmessage", mycontentscriptmessagepayload); to receive a message from the add-on code: self.port.on("myaddonmessage", function(myaddonmessagepayload) { // handle the message }); note that the
global self object is completely different from the self module, which provides an api for an add-on to access its data files and id. accessing port in the add-on script in the add-on code, the channel of communication between the add-on and a particular content script context is encapsulated by the worker object. so the port object for communicating with a content script is a property of the corresp...
jpm - Archive of obsolete content
jpm is a command-line tool that enables you to test, run, and package add-ons. this is the reference page for jpm. see also jpm tutorial for getting started. jpm usage is: jpm [command] [options] jpm supports the following
global options: -h, --help - show a help message and exit -v, --version - print the jpm version number --addon-dir - directory for your source code, defaulting to the current directory installation jpm is distributed with the node package manager npm. installing npm there are two ways to get npm. download and install node.js from nodejs.org. node.js includes npm. or, if you have a package manager like apt, install npm via that. for example, in an ubuntu or debian terminal window, enter sudo apt-get install nodejs...
...u, this can be remedied by ensuring you installed the compatibility package, nodejs-legacy: sudo apt-get install nodejs-legacy on other distributions, you may have to create a local symlink to nodejs manually: sudo ln -s "$(which nodejs)" /usr/local/bin/node installing jpm after you have npm installed and node on your path, install jpm just as you would any other npm package. ...
...nsuring you installed the compatibility package, nodejs-legacy: sudo apt-get install nodejs-legacy on other distributions, you may have to create a local symlink to nodejs manually: sudo ln -s "$(which nodejs)" /usr/local/bin/node installing jpm after you have npm installed and node on your path, install jpm just as you would any other npm package. installing jpm
globally npm install jpm --
global depending on your setup, you might need to run this as an administrator: sudo npm install jpm --
global installing jpm locally if you do not wish to, or are unable to, install jpm
globally, you may instead install it locally: cd $home && npm install jpm to run jpm from a terminal when installed locally, you must add the directory "$home/node_modules/.bin/" to your terminal's path first. add t...
...tively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link after installing jpm after installation, at the command prompt, type: jpm you should see a screen summarizing the available jpm commands. note that unlike cfx, jpm is available in every command prompt you start, as long as you installed it with the --
global flag. install a different version of firefox as of firefox 48, it is not possible to use unsigned add-ons (i.e. any add-on which you are in the process of developing) in the branded release or beta versions of firefox. thus, you will need to download and install a different version of firefox. assuming you don't want an old version of firefox, your options are firefox developer edition, firefox...
Extension Etiquette - Archive of obsolete content
llow for easy identification among other extensions in the extensions manager. coding practices namespace conflicts 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...
... are among the most common examples of namespaces in which conflicts can occur, there are many others. in general, care must be taken 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. expando properties are best avoided using tools such as weakmaps. prefix names in shared namespaces when shared namespaces can't be avoided, the simplest solution to prevent conflicts is to use a distinct prefix for all of your names. class names for html elements created by th...
...lobal variable and prototype conflicts. expando properties are best avoided using tools such as weakmaps. prefix names in shared namespaces when shared namespaces can't be avoided, the simplest solution to prevent conflicts is to use a distinct prefix for all of your names. class names for html elements created by the cool beans extension, for instance, might all be prefixed with cool-beans-.
global variables might all be defined as properties of the coolbeans object. some namespaces have specific conflict prevention conventions, which should be followed as appropriate. xpcom contract ids, for instance, should always begin with an @, followed by a domain name that the author controls, e.g., "@example.com/foo/bar;1" it is important that the prefix that you use be unlikely to conflict with...
... e.g., "@example.com/foo/bar;1" it is important that the prefix that you use be unlikely to conflict with other code, and that it be indicative of the name of your add-on. generic prefixes such as myextension-, or short prefixes such as ffx-, are likely to be used elsewhere, and therefore unsuitable to the purpose. call .noconflict(true) where applicable many common libraries which create
global variables provide a method called noconflict, or similar, which revert any
global variables they've declared, and return the object itself. for instance, calling jquery.noconflict(true) will remove the window.jquery and window.$ variables, and return the jquery object itself, for future use by the caller. when available, these methods should always be used to prevent conflicts with third-party ...
The Essentials of an Extension - Archive of obsolete content
refox what it is that is being declared (content, skin, locale, or others mentioned later on). the second is the package name, which we will explain shortly. skin and locale packages have a third value to specify what locale or what skin they are extending. there can be multiple skin and locale entries relating to different skins and locales. the most common case is having one skin entry for the
global skin, classic/1.0, and multiple locale entries, one for each translation. finally, the location is specified. there are some additional options that can be included in the entries of a chrome.manifest file. they are documented in the chrome registration page. notably, we can have entries that are os-specific. this is important because the appearance of the browser is very different for each oper...
...an argument to the function. event handlers are explained in greater depth further ahead. now let's look at the javascript file and see what's going on when the event is fired. /** * xulschoolchrome namespace. */ if ("undefined" == typeof(xulschoolchrome)) { var xulschoolchrome = {}; }; the xulschoolchrome namespace is defined. all objects and variables we define in this javascript are
global, meaning that scripts in firefox and other extensions can see them and interact with them. this also means that if we define an object called menuhandler or some other generic name, it's likely going to conflict with an existing object. what we do here is define a single
global object: xulschoolchrome. now we know that all of our objects are inside this object, which is unlikely to be duplicated ...
...to handle different types of plural forms that are also language-dependent. skin styling xul is very similar to styling html. we'll look into some of the differences when we cover the xul box model, and other more advanced topics. there isn't much styling you can do to a minimal menu and a very simple alert message, so the hello world extension only includes an empty css file and the compulsory
global skin file: <?xml-stylesheet type="text/css" href="chrome://
global/skin/" ?> <?xml-stylesheet type="text/css" href="chrome://xulschoolhello/skin/browseroverlay.css" ?> the
global skin css file holds the default styles for all xul elements and windows. forgetting to include this file in a xul window usually leads to interesting and often unwanted results. in our case we don't really need ...
...at any rate it's better to always include it. this way it's harder to make the mistake of not including it. you can enter the chrome path in the location bar and inspect the file if you're curious. this covers all of the files in the hello world extension. ...
Code snippets - Archive of obsolete content
bed browser api. ...
...window.gbrowser.addtab(url); } } partially corrupt a server components.utils.import("resource://services-sync/main.js"); components.utils.import("resource://services-sync/resource.js"); function deletepath(path) { let resource = new resource(weave.service.storageurl + path); resource.setheader("x-confirm-delete", "1"); return resource.delete(); } // delete meta/
global: deletepath("meta/
global"); // delete keys: deletepath("crypto/keys"); // delete server: deletepath(""); corrupt a single engine on the server let engine = "bookmarks"; components.utils.import("resource://services-sync/main.js"); components.utils.import("resource://services-sync/resource.js"); components.utils.import("resource://services-sync/util.js"); let r = new resource(weave.service.storageurl + "meta/
global"); l...
...; } }; coll.get(); console.log("deleted: " + deleted + ", " + json.stringify(items)); get a log from xul fennec view about:sync-log. long-tap the log in question. choose "save link". open a mail client. click attach. choose "file manager" as the handler. navigate to "downloads", pick correct file. watch live sync logs set services.sync.log.appender.console to trace. ...
...ck correct file. watch live sync logs set services.sync.log.appender.console to trace. ...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
s to retrieve an element reference using the cross-browser approach, you use document.getelementbyid(aid), which works in internet explorer 5.0+, mozilla-based browsers, other w3c-compliant browsers and is part of the dom level 1 specification. mozilla does not support accessing an element through document.elementname or even through the element's name, which internet explorer does (also called
global namespace polluting). mozilla also does not support the netscape 4 document.layers method and internet explorer's document.all. while document.getelementbyid lets you retrieve one element, you can also use document.layers and document.all to obtain a list of all document elements with a certain tag name, such as all <div> elements. the w3c dom level 1 method gets references to all elements with ...
...s. the mozilla event model follows the w3c and netscape model. in internet explorer, if a function is called from an event, it can access the event object through window.event. mozilla passes an event object to event 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 moz...
...ed. } see using xml data islands in mozilla for an alternative approach. xmlhttprequest internet explorer allows you to send and retrieve xml files using msxml's xmlhttp class, which is instantiated through activex using new activexobject("msxml2.xmlhttp") or new activexobject("microsoft.xmlhttp"). since there is no standard method of doing this, mozilla provides the same functionality in the
global javascript xmlhttprequest object. since version 7 ie also supports the "native" xmlhttprequest object. after instantiating the object using new xmlhttprequest(), you can use the open method to specify what type of request (get or post) you use, which file you load, and if it is asynchronous or not. if the call is asynchronous, then give the onload member a function reference, which is called onc...
...orer will return "microsoft". <xsl:if test="system-property('xsl:vendor') = 'transformiix'"> <!-- mozilla specific markup --> </xsl:if> <xsl:if test="system-property('xsl:vendor') = 'microsoft'"> <!-- internet explorer specific markup --> </xsl:if> mozilla also provides javascript interfaces for xslt, allowing a web site to complete xslt transformations in memory. you can do this using the
global xsltprocessor javascript object. xsltprocessor requires you to load the xml and xslt files, because it needs their dom documents. the xslt document, imported by the xsltprocessor, allows you to manipulate xslt parameters. xsltprocessor can generate a standalone document using transformtodocument(), or it can create a document fragment using transformtofragment(), which you can easily append into...
A XUL Bestiary - Archive of obsolete content
ferenced graphics for a xul file, the localization strings are just a dtd, and the content is just the xul. the chrome url this concept of a chrome as an integrated, dynamic thing in some way divorced from the "appcore" is realized in the use of the chrome url to point to chunks of xul and their related files. the chrome url, which appears in place of the http url in pointers like the following
global skin processing instruction: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> specifies a chrome to be loaded by the gecko rendering engine. in the example above, the chrome is simply a skin file to be loaded into the xul file, but the chrome can also be used to load whole chromes, as when a <menuitem> in one window brings up a new chrome: <menuitem value="mozilla help" onc...
...,dialog=no')" /> in this example, the chrome url is being used to point to a chrome within the package hierarchy of the mozilla application. a help chrome defined in mozilla/bin/chrome/help/ is being invoked from the help menu. note that when no file name is specified after the chrome directory path, a file name with the same name as the package is assumed. in other words, a chrome url like the
global pointer above picks up a file called
global.css, and the help pointer above could also be written as chrome://help/content, because the name of the package itself is "help." viewing chromes other than mozilla's there is a special flag you can use to start mozilla with some chrome other than the default. when you invoke mozilla from the command line with the -chrome flag, you can specify a chrom...
... like this, you can use the following chrome url, chrome://navigator/skin/mynewskin/newskin.css which in turn loads the graphics in that subdirectory as needed. skin the skin is the css and graphics that makes up the look or presentation of xul. xul itself contains very little provision for how widgets are to be presented in the interface. even prior to the skinning that takes place with the
global skin, which is loaded in almost every xul file you see in mozilla (and whose absence from your own xul files can make your work look strange, senseless, or invisible altogether), a xul.css file is loaded which provides some very basic presentational information for the widgets in the toolkit. so css is a lot of what makes xul xul, especially with the advent of css2 and its new positioning capabil...
...ot of what makes xul xul, especially with the advent of css2 and its new positioning capabilities. skinning is most often brought up in the context of dynamic changes to the overall look of an application. though this is not yet in the browser, very soon it will be possible to change the look of a whole application dynamically, but only to the extent that the skin is actually defined in the main
global.css, or
global skin. when you create styles in <style> tags, as style attributes for individual elements, or in custom css files, you break the ability of gecko to skin the application to which your xul belongs. widgets widgets are the pieces that you assemble to make an interface. menus, toolbars, buttons, and scrollbars are widgets, and so are such general purpose pieces as boxes and springs.
Adding Style Sheets - Archive of obsolete content
let's assume that we are building the find files dialog for themeability, because the find files dialog can be referred to with the url chrome://findfile/content/findfile.xul so the style sheet file will be stored in chrome://findfile/skin/findfile.css. all the xul examples so far have actually been using a style sheet already. the second line has always been: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> this line indicates that we want to use the style provided by chrome://
global/skin/. in mozilla, this will be translated as the file
global.css, which contains default style information for xul elements. you could leave the line out and the elements will still work, however they will look fairly plain. the style sheet applies various fonts, colors and borders to make the...
...difference in layout might change the meaning of the element. however you should avoid this as much as possible. for installed files, you'll have to create or modify a manifest file and install the skin. our find files dialog example let's modify the find files dialog so that its style comes from a separate style file. first, the modifed lines of findfile.xul: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <?xml-stylesheet href="findfile.css" type="text/css"?> ... <spacer class="titlespace"/> <groupbox orient="horizontal"> <caption label="search criteria"/> <menulist id="searchtype"> <menupopup> <menuitem label="name"/> <menuitem label="size"/> <menuitem label="date modified"/> </menupopup> </menulist> ...
...yle sheets for use. an example is shown below: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> this might be the first lines of a bookmarks window. it imports the bookmarks style sheet, which is bookmarks.css. mozilla's skin system is smart enough to figure out which style sheet to use, because the specific filename was not indicated here. we have done a similar thing with the
global style sheet file (chrome://
global/skin). a style sheet may import styles from another stylesheet using the import directive. normally, you will only import one style sheet from each xul file. the
global style sheet can be imported from within the style sheet associated with the xul file. this can be done with the code below, allowing you to remove the import from the xul file: style import from x...
...kin). a style sheet may import styles from another stylesheet using the import directive. normally, you will only import one style sheet from each xul file. the
global style sheet can be imported from within the style sheet associated with the xul file. this can be done with the code below, allowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> style import from css: @import url(chrome://
global/skin/); the second syntax is preferred because it reduces the number of dependencies within the xul file itself. remove the
global style sheet import from findfile.xul and add the import to findfile.css. all elements can be styled using css. you can use selectors to select the element that you wish to have styled. ...
Creating Dialogs - Archive of obsolete content
ng the bottom of the dialog forok,cancel, and so on. you do not need to include the xul for each button; however, you do need to supply code to perform the appropriate tasks when the user presses each button. this mechanism is necessary because different platforms have a specific order in which the buttons appear. ...
...m of the dialog forok,cancel, and so on. you do not need to include the xul for each button; however, you do need to supply code to perform the appropriate tasks when the user presses each button. this mechanism is necessary because different platforms have a specific order in which the buttons appear. ...
...t - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996. ...
... appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996. ...
Creating a Window - Archive of obsolete content
« previousnext » we're going to be creating a simple find files utility throughout this tutorial. first, however, we should look at the basic syntax of a xul file. creating a xul file an xul file can be given any name but it really should have a .xul extension. the simplest xul file has the following structure: <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- other elements go here --> </window> this window will not do anything since it doesn't contain any ui elements. those will be added in the next section. in fact, there will not be shown any window at all. if you want to fo...
...on. in fact, there will not be shown any window at all. if you want to force the window to become visible you can add the width and height attribute to the window tag. here is a line by line breakdown of the code above: <?xml version="1.0"?> this line simply declares that this is an xml file. you would normally add this line as is at the top of each xul file. <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> this line is used to specify the style sheets to use for the file. this is the syntax that xml files use to import style sheets. in this case, we import the styles found in the
global part of a skin package. we didn't specify a specific file so mozilla will determine which files in the directory to use. in this case, the all-important
global.css file is selected. this f...
... <window this line declares that you are describing a window. each user interface window is described in a separate file. this tag is much like the html tag which surrounds an entire html document, except that a user interface window is described instead of a document. ...
...leges. the extension developer's extension contains an xul editor that allows you to type in xul code and see the results in real-time from within mozilla! troubleshooting if the xul window fails to show up on the desktop but has an icon on the desktop tool bar, check the xml-stylesheet declaration. make sure that you have included the stylesheet correctly: <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> in the next section, we will add some buttons to the window. « previousnext » ...
XULRunner 2.0 Release Notes - Archive of obsolete content
ac os x download xulrunner for 32-bit linux download xulrunner for 64-bit linux (warning: links may become out-of-date at times). windows unpack the zip file to a new directory using an archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\2.0 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. xulrunner 2.0 is a universal binary containing i386 and x86_64 architectures. xulrunner 1.9.2 and earlier versions had powerpc (ppc) and i386 architectures. linux (32-bit) unpack the tarball to a new directory using tar -xjf ...
...ons. xulrunner 2.0 is a universal binary containing i386 and x86_64 architectures. xulrunner 1.9.2 and earlier versions had powerpc (ppc) and i386 architectures. linux (32-bit) unpack the tarball to a new directory using tar -xjf xulrunner-2.0.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/2.0 . ...
...remove the xulrunner directory. ...
...o a new directory using tar -xjf xulrunner-2.0.en-us.linux-x86_64.tar.bz2. the following directory is recommended: /opt/xulrunner/2.0 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. windows from a command prompt, run xulrunner.exe --unregister-
global or xulrunner.exe --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. mac os x if you have multiple versions of xulrunner ins...
Debugging a XULRunner Application - Archive of obsolete content
nkman jar:venkman.jar!/content/venkman/ contentaccessible=yes i get errors about not being able to open contentareautils.js, contentareadd.js, findutils.js, or contentareautils.js... ...
...et errors about not being able to open contentareautils.js, contentareadd.js, findutils.js, or contentareautils.js... ...
...entareadd.js, findutils.js, or contentareautils.js... ...
...nsclipboard.js" /> <script src="chrome://
global/content/nsdraganddrop.js" /> - <script src="chrome://communicator/content/contentareautils.js" /> - <script src="chrome://communicator/content/contentareadd.js" /> - <script src="chrome://communicator/content/findutils.js" /> - <script src="chrome://browser/content/contentareautils.js" /> + <script src="chrome://
global/content/contentareautils.js" /> + <script src="chrome://
global/content/contentareadd.js" /> <script src="chrome://
global/content/findutils.js" /> + <script src="chrome://
global/content/contentareautils.js" /> + <script src="chrome://
global/content/findutils.js" /> <script src="chrome://
global/content/strres.js" /> ...
XULRunner tips - Archive of obsolete content
file.in rebuild... useful chrome urls most of these require branding. ...
...hrome urls most of these require branding. window url window type extension manager chrome://mozapps/content/extensions/extensions.xul?type=extensions extension:manager-extensions theme manager chrome://mozapps/content/extensions/extensions.xul?type=themes extension:manager-themes javascript console chrome://
global/content/console.xul
global:console about:config chrome://
global/content/config.xul developer extensions venkman need a custom build or a compatible extension need to edit compatibility in needs a method to start venkman (usually by overlaying the main xul file, similar to existing code for firefox, suite, etc.) the function toopenwindowbytype() needs to be defined. there is a working stub. a...
...extensions venkman need a custom build or a compatible extension need to edit compatibility in needs a method to start venkman (usually by overlaying the main xul file, similar to existing code for firefox, suite, etc.) the function toopenwindowbytype() needs to be defined. there is a working stub. any better suggestion? venkman uses "chrome://communicator/skin/" as an alias for "chrome://
global/skin/" and this alias was maintained in the xulrunner toolkit until xulrunner 1.9 was released. when using xulrunner 1.9 or greater, you can create your own alias in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single css file named "communicator.css" with this content: @import url("c...
...and this alias was maintained in the xulrunner toolkit until xulrunner 1.9 was released. when using xulrunner 1.9 or greater, you can create your own alias in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single css file named "communicator.css" with this content: @import url("chrome://
global/skin"); dom inspector to add dom inspector 2.0.* to your xulrunner 1.9.0.* application follow these steps: download the dom inspector (instead of clicking the "add to..." button, right-click and select "save link as..."). save the dom_inspector-*.xpi package to a temporary directory unzip the package copy the following files: chrome/inspector.jar to the chrome directory of you...
Theme changes in Firefox 3 - Archive of obsolete content
e edges, so that the image is smaller. may or may not affect other mac themes that use it. browser/themes/pinstripe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. instead .tabs-left now displayed and given the same width as the former margin-left. it was already done this way in winstripe. changes in browser --- changes in
global all platforms the yellow background for the location bar has been deprecated; instead, themes should style the new #identity-box element depending on its verifieddomain/verifiedidentity class. the go button is now located inside the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. the rule that's needed to show and hide the go button and other locatio...
... the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. ...
...aller. the rule that's needed to show and hide the go button and other location bar icons is: #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button { visibility: collapse; } images to add add the following images: chrome://
global/skin/icons/information-16.png used when presenting information notices. chrome://
global/skin/icons/warning-16.png used when displaying warnings. ...
...e following images: chrome://
global/skin/icons/information-16.png used when presenting information notices. chrome://
global/skin/icons/warning-16.png used when displaying warnings. images to remove the following images were removed: chrome://mozapps/skin/extensions/question.png no longer used. mac os x mac os x themes for firefox 3 should add these two rules to the end of chrome://
global/skin/wizard.css: .wizard-buttons-btm { padding:xpx; } .wizard-label-box { display: none; } the numeric value ofx, the number of pixels of padding in .wizard-buttons-btm, should be the same as the value of the margin for .wizard-buttons-box-2. image changes chrome://
global/skin/icons/loading_16.gif was replaced with chrome://
global/skin/icons/loading_16.png . changes in mozapps see als...
Choosing the right approach - Learn web development
ssamsung internetsettimeoutchrome full support 30edge full support 12firefox full support 1 full support 1 full support 52notes notes setinterval now defined on windoworworker
globalscope mixin.ie full support 4opera full support 4safari full support 1webview android full support 4.4chrome android full support 30firefox android full suppor...
...ebview android full support 4.4chrome android full support 30firefox android full support 4 full support 4 full support 52notes notes setinterval now defined on windoworworker
globalscope mixin.opera android full support 10.1safari ios full support 1samsung internet android full support 3.0supports parameters for callbackchrome full support yesedge full support ...
...samsung internetsetintervalchrome full support 30edge full support 12firefox full support 1 full support 1 full support 52notes notes setinterval now defined on windoworworker
globalscope mixin.ie full support 4opera full support 4safari full support 1webview android full support 4.4chrome android full support 30firefox android full suppor...
...ebview android full support 4.4chrome android full support 30firefox android full support 4 full support 4 full support 52notes notes setinterval now defined on windoworworker
globalscope mixin.opera android full support 10.1safari ios full support 1samsung internet android full support 3.0supports parameters for callbackchrome full support yesedge full support ...
Starting our Svelte Todo list app - Learn web development
ell svelte to ignore this warning for the next block of markup with a comment beginning with svelte-ignore, like this: <!-- svelte-ignore a11y-missing-attribute --> <img height="32" width="88" src="https://udn.realityripple.com/samples/b0/98dase3c7d.png"> note: with vscode you can automatically add this ignore comment by clicking on the quick fix... link or pressing ctrl + +. if you want to
globally disable this warning you can add this onwarn handler to your rollup.config.js file inside the configuration for the svelte plugin, like this: plugins: [ svelte({ dev: !production, css: css => { css.write('public/build/bundle.css'); }, // warnings are normally passed straight to rollup. you can // optionally handle them here, for example to squelch // warnings wi...
...checks for many accessibility rules on jsx elements. svelte aims to implement all of them in its compiler, and most of them have already been ported to svelte. on github you can see which accessibility checks are still missing. you can check the meaning of each rule by clicking on its link. styling our markup let's make the todo list look a little better. ...
...size: 100%; line-height: 1.15; margin: 0; } button, input { overflow: visible; } input[type="text"] { border-radius: 0; } body { width: 100%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 arial, sans-serif; background-color: #f5f5f5; color: #4d4d4d; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ /*
global styles */ .form-group > input[type="text"] { display: inline-block; margin-top: 0.4rem; } .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color...
...1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .stack-small > * + * { margin-top: 1.25rem; } .stack-large > * + * { margin-top: 2.5rem; } @media screen and (min-width: 550px) { .stack-small > * + * { margin-top: 1.4rem; } .stack-large > * + * { margin-top: 2.8rem; } } .stack-exception { margin-top: 1.2rem; } /* end
global styles */ .todoapp { background: #fff; margin: 2rem 0 4rem 0; padding: 1rem; position: relative; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 2.5rem 5rem 0 rgba(0, 0, 0, 0.1); } @media screen and (min-width: 550px) { .todoapp { padding: 4rem; } } .todoapp > * { max-width: 50rem; margin-left: auto; margin-right: auto; } .todoapp > form { max-width: 100%; } .todoapp > h1...
Getting started with Svelte - Learn web development
e to the source files. your browser will display something like this: application structure the starter template comes with the following structure: moz-todo-svelte ├── readme.md ├── package.json ├── package-lock.json ├── rollup.config.js ├── .gitignore ├── node_modules ├── public │ ├── favicon.ico │ ├── index.html │ ├──
global.css │ └── build │ ├── bundle.css │ ├── bundle.css.map │ ├── bundle.js │ └── bundle.js.map └── src ├── app.svelte └── main.js the contents are as follows: package.json and package-lock.json: contains information about the project that node.js/npm uses to keep it organized. you don't need to understand t...
...antiates the app component and binds it to the body of our html page. public: this directory contains all the files that will be published in production. favicon.png: this is the favicon for your app. currently, it's the svelte logo. index.html: this is the main page of your app. initially it's just an empty html5 page that loads the css files and js bundles generated by svelte.
global.css: this file contains unscoped styles. it's a regular css file that will be applied to the whole application. build: this folder contains the generated css and javascript source code. bundle.css: the css file that svelte generated from the styles defined for each component. bundle.js: the javascript file compiled from all your javascript source code. having a l...
...ning localhost:5000 in a new browser tab, right/ctrl-clicking on the hello world! label, and choosing inspect: when compiling the app, svelte changes our h1 styles definition to h1.svelte-1tky8bj, and then modifies every <h1> element in our component to <h1 class="svelte-1tky8bj">, so that it picks up the styles as required. note: you can override this behavior and apply styles to a selector
globally using the :
global(...) modifier (see the svelte <style> docs for more information). making a couple of changes now that we have a general idea of how it all fits together, we can start making a few changes. at this point you can try updating your app.svelte component — for example change the <h1> element on line 6 of app.svelte so that it reads like this: <h1>hello {name} from mdn!</h1> ...
.../main.js to reference the features of each component. finally the file public/index.html includes the generated bundle.css and bundle.js files: <!doctype html> <html lang="en"> <head> <meta charset='utf-8'> <meta name='viewport' content='width=device-width,initial-scale=1'> <title>svelte app</title> <link rel='icon' type='image/png' href='/favicon.png'> <link rel='stylesheet' href='/
global.css'> <link rel='stylesheet' href='/build/bundle.css'> <script defer src='/build/bundle.js'></script> </head> <body> </body> </html> the minified version of bundle.js weighs a little more than 3kb, which includes the "svelte runtime" (just 300 lines of javascript code) and the app.svelte compiled component. as you can see, bundle.js is the only javascript file referenced by index.html. the...
Working with Svelte stores - Learn web development
previous overview: client-side javascript frameworks next in the last article we completed the development of our app, finished organizing it into components, and discussed some advanced techniques for dealing with reactivity, working with dom nodes, and exposing component functionality. in this article we will show another way to handle state management in svelte — stores. stores are
global global data repositories that hold values. components can subscribe to stores and receive notifications when their values change. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app.
...gged in user, or whether the dark theme is selected or not. sometimes, your app state will need to be accessed by multiple components that are not hierarchically related, or by a regular javascript module. moreover, when your app becomes complicated and your component hierarchy gets complex, it might become too difficult for components to relay data between each other. in that case, moving to a
global data store might be a good option. if you’ve already worked with redux or vuex, then you'll be familiar with how this kind of store works. svelte stores offer similar features for state management. a store is simply an object with a subscribe() method that allows interested parties to be notified whenever the store value changes, and an optional set() method that allows you to set new values f...
...fore. that's much better! behind the scenes svelte has generated the code to declare the local variable $alert, subscribe to the alert store, update $alert whenever the store's content is modified, and unsubscribe when the component is unmounted. it will also generate the alert.set(...) statements whenever we assign a value to $alert. the end result of this nifty trick is that you can access
global stores just as easily as using reactive local variables. this is a perfect example of how svelte puts the compiler in charge of better developer ergonomics, not only saving us from typing boiler plate, but also generating less error-prone code. writing to our store writing to our store is just a matter of importing it and executing $store = 'new value'. let's use it in our todos component. ...
...you can also inspect it in the devtools console. in the web console, enter the command localstorage.getitem('mdn-svelte-todo'). make some changes to your app, like pressing the uncheck all button, and check the web storage content once more. you will get something like this: svelte stores provide a very simple and lightweight, but extremely powerful, way to handle complex app state from a
global data store in a reactive way. and because svelte compiles our code, it can provide the $store auto-subscription syntax that allows us to work with stores in the same way as local variables. because stores has a minimal api, it's very simple to create our custom stores to abstract away the inner workings of the store itself. bonus track: transitions let's change the subject now, and do something...
Introducing a complete toolchain - Learn web development
itor, as seen in the visual studio code example below: anyway, installing git is all we need to do for now. let's move on. code tidying tools we'll be using prettier, which we first met in chapter 2, to tidy our code in this project. if you followed the directions in the installing prettier section then you might already have prettier installed. if not, we'll get you to install prettier as a
global utility using the terminal right now. you can check whether you've already got it installed
globally using the following command: prettier -v if installed, you'll get a version number returned like 2.0.2; if not, it'll return something along the lines of "command not found". if this is the case, install it using the following command: npm install prettier -g now that prettier is installed, r...
... configuration just right! out of the box, eslint is going to complain that it can't find the configuration file if you run it. the configuration file supports multiple formats but for this project we'll use .eslintrc.json (the leading period means the file is hidden by default). eslint is installed via npm, so as per discussions in chapter 2, you have the choice to install this tool locally or
globally. using both is recommended: for projects you intend to share, you should always include eslint as a local dependency so that anyone making their own copy can follow the rules you've applied to the project. you should also consider having eslint installed
globally so that you can quickly use it to check any file you want. for the sake of simplicity, in this chapter we're not going to explo...
...irectory. we have our project files in place. that’s all we need to do for now! note: if you want to just take our existing project and set it up, ready to use, you could go into the root directory of the unzipped downloaded, and run one single installation command to install all of the project’s dependencies: npm install. this is possible because we installed all the tools locally, not
globally, and highlights why it is such a powerful option. installing our tools now it's time to install the initial set of tools we'll be using in our dev environment. run the following from inside your project's root directory: npm install --save-dev eslint prettier babel-eslint there's two important things to note about the command you just ran. the first is that we're installing the dependencie...
...e'll be using in our dev environment. run the following from inside your project's root directory: npm install --save-dev eslint prettier babel-eslint there's two important things to note about the command you just ran. the first is that we're installing the dependencies locally to the project — installing tools locally is better for a specific project. installing locally (not including the --
global option) allows us to easily recreate this setup on other machines. the second important part of this install command is the --save-dev option. this tells the npm tool that these particular dependencies are only needed for development (npm therefore lists them in the package.json file under devdependencies, not dependencies). this means that if this project is installed in production mode these d...
Chrome Worker Modules
as it implements a minimal commonjs require(). loading modules loading a module is simple. start by importing the module loader. you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js"); note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once. this defines a
global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now use module core. core.declareffi(...) note that, for the moment, require() only accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating module...
...y accepts absolute uris. if the your module uri ends with “.js”, you can omit the extension. creating modules creating a module is just as simple. a module is a file, whose filename generally ends with either “.js” or “.jsm”, and designed to be opened through require(). any value you define in that file is private by default. ...
...le is private by default. ...
... bar. you should not modify exports or module.exports once your module initialization is complete. the module loader supports cyclic calls to require(). however, if you have cyclic requirements, some of the modules involved in the cyclic requirements may become visible by the other modules before they are fully evaluated. no attempt is made to fully isolate modules from each other. in particular,
globals (string, math, object, self) and the worker
global scope itself (this) are shared between workers. in other words, the true isolation unit is the worker itself, not the module. ...
Mozilla accessibility architecture
ieve the accessible. finally, because the msaa client gets the same accessible for the event and for tree traversal each time, it can do comparisons with its own internal data model. for example, this allows the msaa client to invalidate parts of its own cache or data model based on dom mutation events. three levels of the accessibility cache there are three levels in the accessibility cache:
global cache of doc accessibles (g
globaldocaccessiblecache), used to get the accessible for any document. per-document cache of accessibles a cache in each nsdocaccessible (maccessnodecache), containing all of the accessible nodes created so far for each document. member variables in nsaccessible that keep track of the number of children (maccchildcount), the parent (mparent), the first child (mfirs...
...here are known to be no more siblings. if mnextsiblings == nsnull, then there could still be more siblings. this architecture allows us to quickly wipe away an entire document's worth of cached nodes when a document goes away, simply by destroying the document accessible's cache. however, it takes two steps to get a dom node's cached accessible. we must first get the document accessible from the
global cache for the node's document, and then use that document accessible's specific cache to check for an entry for the dom node. this is not much of a problem because it is still much faster than creating a new accessible every time. this two step process is implemented in nsaccessibilityservice::getcachedaccessible(domnode). the member variables keeping track of the number of children, parent, firs...
...jects we must cache is nsaccessnode. nsaccessnode::init() when nsaccessibilityservice::getaccessible() gets a newly created accessible, it calls nsiaccessnode::init() on the new object, which will add this to the cache for the doc accessible. each nsaccessnode contains the dom node and weak pres shell for the object. the weak pres shell is used to create a hash key to get the doc accessible from g
globaldocaccessiblecache. the dom node pointer is used to create the new hash key and add the nsiaccessnode* into the document accessible's maccessnodecache. the init() method is also virtual, and many accessibles override it to do their own special initialization. if they do, they must also call their parent class' init() method when finished. nsaccessnode::shutdown() shutdown() is used when the dom no...
...ssnode entries in the cache for each dom node, shutting them down if they exist. this is better than just traversing the accessibles by using the member variables mfirstchild and mnextsibling, because that would miss nsaccessnode's that are not nsaccessible's. at program shutdown, when the nsaccessibilityservice observes ns_xpcom_shutdown_observer_id, it iterates through the doc accessibles in g
globaldocaccessiblecache and destroys all of the doc accessibles them. challenges of the accessibility cache there are some tricky issues when dealing with the accessibility cache: remaining valid: changes in a given document, or the destruction of documents must update or shutdown parts of the cache. we use dom mutation events to listen for document changes, and invalidate the appropriate part of e...
Command line options
cationname. applications may be uninstalled per usual methods for your system. "c:\program files\mozilla xulrunner\1.8.0.4\xulrunner\xulrunner.exe" --install-app "c:\users\billdo\desktop\myapplication.xpi" /opt/xulrunner/1.8.0.4/xulrunner/xulrunner --install-app ~/desktop/myapplication.xulapp /library/frameworks/xul.framework/xulrunner-bin --install-app ~/desktop/myapplication.xpi --register-
global registers xulrunner on the system for all users. must be run as admin / root. --register-user registers xulrunner for a single user. --unregister-
global unregisters xulrunner for all users. --unregister-user unregisters xulrunner for a single user. chrome -chrome chrome_url load the specified chrome. firefox -chrome chrome://inspector/content -register chrome_url register the specif...
...register-user registers xulrunner for a single user. --unregister-
global unregisters xulrunner for all users. --unregister-user unregisters xulrunner for a single user. chrome -chrome chrome_url load the specified chrome. firefox -chrome chrome://inspector/content -register chrome_url register the specified chrome, but do not start application. add-ons gecko 1.9.2 note -install-
global-extension and -install-
global-theme have been removed from gecko 1.9.2 and upwards. -install-
global-extension /path/to/extension installs the extension into the application directory. the parameter is the path to the extension. you must have administrative privileges. -install-
global-theme /path/to/theme same as above, but for themes. you must have administrative privileges. note: since fi...
...installing from a network share directly will no longer succeed. ...
...installing from a network share directly will no longer succeed. ...
Creating Sandboxed HTTP Connections
eam, it could be called multiple times (depending on the size of the returned data, networking conditions, etc). onstoprequest - the request has finished. onchannelredirect - when a redirect happens, a new nsichannel is created, and both the old and new ones are passed in as arguments. ...
... since nsistreamlistener does not cover cookies, the current channel being used will need to be stored as a
global, since another listener will be used for cookie notifications (covered in the next section). it is usually best to use a javascript wrapper that implements all the required methods and calls the specified callback function when the connection has completed. ...
...it would be better to have the entire implementation inside a class and storing the channel as a member: function myclass() { this.mchannel = null; // ... var listener = new this.streamlistener(callbackfunc); // ... } myclass.prototype.streamlistener = function (acallbackfunc) { return ({ ...
...channel) that caused this notification to happen. atopic: the notification topic. adata: null for the two topics. since the observers get notified for the registered topic for any connection, the listener needs to make sure that the notification is for the http connection our code created. since the channel that causes the notification is passed in as the first argument, comparing it to the
globally stored channel (gchannel) in the previous section (which also gets updated each time a redirect happens). // create an nsiobserver implementor var listener = { observe : function(asubject, atopic, adata) { // make sure it is our connection first. if (asubject == gchannel) { var httpchannel = asubject.queryinterface(components.interfaces.nsihttpchannel); if (atopic == "htt...
ESLint
like: export path=$path:/c/nodejs enabling eslint for a new directory remove the directory from .eslintignore (in the base directory of the repository) fix errors that occur when running ./mach eslint path/to/dir, see also the no-undef rules below. no-undef the no-undef rule is currently being enabled throughout the code base. here are some common issues: my script is imported into the
global browser.xul scope. add a line like: /* eslint-env mozilla/browser-window */ or enable the rule in a .eslintrc.js if it will apply to the whole directory. my script is a frame-script, or includes items that loaded into content scripts: add a line to tell eslint to use the frame-script environment: /* eslint-env mozilla/frame-script */ ...
... foo.jsm exports a symbol, but that is not recognised by eslint check it is listed correctly in tools/lint/eslint/modules.json using services.scriptloader.loadsubscript? you'll need to include t...
... foo.jsm exports a symbol, but that is not recognised by eslint check it is listed correctly in tools/lint/eslint/modules.json using services.scriptloader.loadsubscript? you'll need to include the following just above it: ...
.../* eslint-env mozilla/frame-script */ my script is a worker: add a line to tell eslint to use the worker environment: /* eslint-env worker */ or, to use a chrome worker environment: /* eslint-env mozilla/chrome-worker */ my file uses chrome/xbl specific
globals either, specify the
global at the top of the file: /*
globals mychrome
global */ or, add to the
global section toolkit/.eslintrc.js if it is widely used. foo.jsm exports a symbol, but that is not recognised by eslint check it is listed correctly in tools/lint/eslint/modules.json using services.scriptloader.loadsubscript? you'll need to include the following just above it: /* import-
globals-from relative/path/to/...
Communicating with frame scripts
ere absolutely necessary, frame scripts can pass wrappers called cross process object wrappers (also known as cpows) to chrome, and chrome can use these wrappers to get synchronous access to content objects. content to chrome the frame script can choose to send synchronous or asynchronous messages to chrome code. asynchronous messaging to send an asynchronous message the frame script uses the
global sendasyncmessage() function: // frame script sendasyncmessage("my-addon@me.org:my-e10s-extension-message"); sendasyncmessage() takes one mandatory parameter, which is the name of the message. all messages share the same namespace, so to avoid conflicts with other code, you'll need to ensure that the names you use are unique. if you're using the message manager in an add-on, a good way to do tha...
...<div#searchcontainer> } if your code requires access to a window (for example to run window.opendialog), and your message listener is run from somewhere without access to a window (e.g. an xpcom component), you can access the window of the browser that sent the message with message.target.ownerdocument.defaultview. ...
...er("my-addon@me.org:my-e10s-extension-message", listener); chrome to content to send a message from chrome to content, you need to know what kind of message manager you're using. if it's a browser message manager, you can use the message manager's sendasyncmessage method: // chrome script browser.messagemanager.sendasyncmessage("my-addon@me.org:message-from-chrome"); if you have a window or a
global message manager, you need to use the broadcastasyncmessage method: // chrome script window.messagemanager.broadcastasyncmessage("my-addon@me.org:message-from-chrome"); these methods takes one mandatory parameter, which is the message name. all messages share the same namespace, so to avoid conflicts with other code, you'll need to ensure that the names you use are unique. if you're using the me...
.... 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 message name, you can pass detailed data as a string or a json-serializable object: // chrome script messagemanager.sendasyncmessage("my-addon@me.org:message-from-chrome", { details : "some more details" }); to receive a message from chrome, a frame script uses the
global addmessagelistener() function. this takes two parameters: the name of the message and a listener function. the listener will be passed a message object whose data property is the message payload: // frame script function handlemessagefromchrome(message) { var payload = message.data.details; // "some more details" } addmessagelistener("my-addon@me.org:message-from-chrome", handlemessagefr...
Embedding Tips
.e. wait for persistence to complete before returning. hint, add a native message processing loop after the call to saveuri that terminates when onstatechange indicates persistence has finished.. how do i print a page? query the web browser object for nsiwebbrowserprint. call the nsiwebbrowserprint::print() method supplying a print settings object (e.g. that returned from nsiwebbrowserprint::get
globalprintsettings) that you wish to print the page with. how do i print preview a page? query the web browser object for the nsiwebbrowserprint interface. call the nsiwebbrowserprint::printpreview() method supplying a print settings object (e.g. that returned from nsiwebbrowserprint::get
globalprintsettings()) that you wish to preview the page with. the nsiwebbrowserprint::printpreviewnavigate() met...
... 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. ...
...eed the javascript inside the browser window to talk to my embedding client. how do i do it? at startup use the category manager to register properties of the
global object in javascript like this: nscomptr<nsicategorymanager> catman = do_getservice(ns_categorymanager_contractid); if (!catman) return ns_error_failure; nsxpidlcstring previous; catman->addcategoryentry(javascript_
global_property_category, "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(previous)); this will cause a component with the contract id my_prop_contract_id to be lazily created when the my_prop_name is resolved in any javascript window scope. if you want to create your component multiple times within the browser window, you can u...
... pr_true, pr_true, getter_copies(previous)); this will cause a component with the contract id my_prop_contract_id to be lazily created when the my_prop_name is resolved in any javascript window scope. if you want to create your component multiple times within the browser window, you can use a javascript constructor instead of a javascript property: catman->addcategoryentry("javascript
global constructor", "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(previous)); that way you will be able to do: var my_comp = new my_prop_name(); this was taken from weirdal's excellent "burning chrome" article. how do i specify alternate locations for profiles? specify a profile directory in your implementation of nsidirec...
Script security
any access to objects in a more privileged scope, unless the more privileged scope explicitly clones those objects. an example of this scope is web content accessing objects in a chrome-privileged scope. compartments compartments are the foundation for gecko's script security architecture. a compartment is a specific, separate area of memory. in gecko, there's a separate compartment for every
global object. this means that each
global object and the objects associated with it live in their own region of memory. normal content windows are
globals, of course, but so are chrome windows, sandboxes, workers, the contentframemessagemanager in a frame script, and so on. gecko guarantees that javascript code running in a given compartment is only allowed to access objects in the same compartment...
...cript, and so on. gecko guarantees that javascript code running in a given compartment is only allowed to access objects in the same compartment. when code from compartment a tries to access an object in compartment b, gecko gives it a cross-compartment wrapper. this is a proxy in compartment a for the real object, which lives in compartment b. inside the same compartment, all objects share a
global and are therefore same-origin with each other. therefore there's no need for any security checks, there are no wrappers, and there is no performance overhead for the common case of objects in a single window interacting with each other. whenever cross-compartment access happens, the wrappers enable us to implement the appropriate security policy. because the wrapper we choose is specific to the ...
...er uses the wrapper, there's no need to check who is making the call or where it is going. cross-compartment access same-origin as we've already seen, the most common scenario for same-origin access is when objects belonging to the same window 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-ori...
...d to protect content scripts from access by untrusted web content, without having to give content scripts system privileges. null principal the null principal fails almost all security checks. it has no privileges and can't be accessed by anything but itself and chrome. it subsumes no other principals, even other null principals. (this is what is used when html5 and other specs say "origin is a
globally unique identifier".) principal relationships the diagram below summarizes the relationships between the different principals. the arrow connecting principals a and b means "a subsumes b". (a is the start of the arrow, and b is the end.) computing a wrapper the following diagram shows the factors that determine the kind of wrapper that compartment a would get when trying to access an obje...
HTTP Cache
an entries hashtable is found. then this entries hashtable is searched using <enhance-...
...ging to an anonymous load b - when present the scope is in browser element load i - when present must have a decimal integer value that represents an app id the scope belongs to, otherwise there is no app (app id is considered 0) p - when present the scope is of a private browsing load, this never persists cachestorageservice keeps a
global hashtable mapped by the scope key. elements in this
global hashtable are hashtables of cache entries. the cache entries are mapped by concantation of enhance id and uri passed to nsicachestorage.asyncopenuri. so that when an entry is beeing looked up, first the
global hashtable is searched using the scope key. an entries hashtable is found. then this entries hashtable is searched using <enhance-id:><uri> string. the elemets in this hashtable are cacheen...
...way to remove cacheentry objects from memory is by exhausting a memory limit for intermediate memory caching, what triggers a background process of purging expired and then least used entries from memory. another way is to directly call the nsicachestorageservice.purge method. that method is also called automatically on the "memory-pressure" indication. access to the hashtables is protected by a
global lock. we also - in a thread-safe manner - count the number of consumers keeping a reference on each entry. the open callback actually doesn't give the consumer directly the cacheentry object but a small wrapper class that manages the 'consumer reference counter' on its cache entry. this both mechanisms ensure thread-safe access and also inability to have more then a single instance of a cacheentr...
...efile object that holds actual data and meta data and, when told to, persists it to the disk. the openers fifo is an array of cacheentry::callback objects. cacheentry::callback keeps a strong reference to the opener plus the opening flags. ...
NSS 3.21 release notes
158489 / cve-2015-7575 - prevent md5 downgrade in tls 1.2 signatures. new in nss 3.21 new functionality certutil now supports a --rename option to change a nickname (bug 1142209) tls extended master secret extension (rfc 7627) is supported (bug 1117022) new info functions added for use during mid-handshake callbacks (bug 1084669) new functions in nss.h nss_optionset - sets nss
global options nss_optionget - gets the current value of nss
global options in secmod.h secmod_createmoduleex - create a new secmodmodule structure from module name string, module parameters string, nss specific parameters string, and nss configuration parameter string. the module represented by the module structure is not loaded. the difference with secmod_createmodule is the new functio...
... sha1 fingerprint: 96:56:cd:7b:57:96:98:95:d0:e1:41:46:68:06:fb:b8:c6:11:06:87 cn = a-trust-nqual-03 sha-1 fingerprint: d3:c0:63:f2:19:ed:07:3e:34:ad:5d:75:0b:32:76:29:ff:d5:9a:f2 cn = usertrust legacy secure server ca sha-1 fingerprint: 7c:2f:91:e2:bb:96:68:a9:c6:f6:bd:10:19:2c:6b:52:5a:1b:ba:48 friendly name: digital signature trust co. ...
...:19:ed:07:3e:34:ad:5d:75:0b:32:76:29:ff:d5:9a:f2 cn = usertrust legacy secure server ca sha-1 fingerprint: 7c:2f:91:e2:bb:96:68:a9:c6:f6:bd:10:19:2c:6b:52:5a:1b:ba:48 friendly name: digital signature trust co.
global ca 1 sha-1 fingerprint: 81:96:8b:3a:ef:1c:dc:70:f5:fa:32:69:c2:92:a3:63:5b:d1:23:d3 friendly name: digital signature trust co.
global ca 3 sha-1 fingerprint: ab:48:f3:33:db:04:ab:b9:c0:72:da:5b:0c:c1:d0:57:f0:36:9b:46 cn = utn - datacorp sgc sha-1 fingerprint: 58:11:9f:0e:12:82:87:ea:50:fd:d9:87:45:6f:4f:78:dc:fa:d6:d4 o = tÜrktrust bilgi İletişim ve bilişim güvenliği hizmetleri a.Ş. (c) kasım 2005 sha-1 fingerprint: b4:35:d4:e1:11:9d:1c:66:90:a7:49:eb:b3:94:bd:63:7b...
...9:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the following ca certificates were added cn = certification authority of wosign g2 sha1 fingerprint: fb:ed:dc:90:65:b7:27:20:37:bc:55:0c:9c:56:de:bb:f2:78:94:e1 cn = ca wosign ecc root sha1 fingerprint: d2:7a:d2:be:ed:94:c0:a1:3c:c7:25:21:ea:5d:71:be:81:19:f3:2b cn = oiste wisekey
global root gb ca sha1 fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed the version number of the updated root ca list has been set to 2.6 bugs fixed in nss 3.21 this bugzilla query returns all the bugs fixed in nss 3.21: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milest...
JIT Optimization Strategies
the arguments object that falls out of the cases defined above, this optimization will be suppressed. in particular, arguments cannot be returned from the function, or passed as an argument into calls (except for the apply example listed above). getprop_inferredconstant attempts to optimize an access to a property that seems to be a constant. it applies to property accesses on objects which are
global-like in that there is only one instance of them per program. this includes
global objects, object literals defined at the top-level of a script, and top-level function objects. this optimization makes the assumption that a property that has not changed after it was first assigned, is likely a constant property. it then directly inlines the value of the property into hot code that accesses it. fo...
...; } when this optimization is successful, property access is eliminated entirely and replaced with an inline constant. getprop_constant attempts to optimize reading a property that contains a uniquely-typed (or "singleton") object. with uniquely-typed objects, it is guaranteed that no other object has that same type. unique (or "singleton") types are assigned to certain kinds of objects, like
global objects, top-level functions, and object literals declared at the top-level of a script. if a property has always contained the same uniquely-typed object, then the engine can use the unique type to map back to a specific object, and eliminate the property access, replacing it with a constant reference to the object. when this optimization is successful, property access is eliminated entirely an...
...k to a specific object, and eliminate the property access, 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 o...
.... the following pseudocode describes the kind of machine code generated by this optimization: if obj.shape == shape1 then obj.slots[0] elif obj.shape == shape2 then obj.slots[5] elif obj.shape == shape3 then obj.slots[2] ... end getprop_innerize attempts to optimize a situation where a property access of the form window.prop can be directly translated into a property access on the inner
global object. this optimization will always fail on property accesses which are not on the window object. it is useful because accessing
global names via the 'window' object is a common idiom in web programming. getprop_inlinecache this is the worst-case scenario for a property access optimization. this strategy is used when all the others fail. the engine simply inserts an inline cache at the prop...
JS_GetParent
ve the parent. description js_getparent retrieves the parent object of obj, or null if obj does not have a parent. warning: the result may be an internal-use-only object. such an object should not be passed to any other jsapi function that could expose it to script code. each object is assigned a parent when it is created: the standard library objects and functions all have the
global object as their parent. objects created by standard library functions, such as array.prototype.concat, have the
global object as their parent. an object created by a script via the new keyword has the same parent as the constructor. for example, after d = new date, d has the same parent as date, ordinarily the
global object. an object created by a script via implicit conversion (the ecmascrip...
...otherwise, the parent is implementation-defined. ...
...he ecmascript toobject operator), an object initializer ({a: 1, b: 2}), or an array initializer ([1, 2, 3]), has the
global object as its parent. the parent of a function created by evaluating a function declaration or function expression in a script depends on the lexical scope of the function. if there is no enclosing function, with statement, or block scope, then the function's parent is the
global object. otherwise, the parent is implementation-defined. it may be a call, with, or block object representing the function's dynamic scope, or it may be the
global object. in any case the
global object is guaranteed appear on the new function's parent chain. the initial parent of an object created via the jsapi depends on the particular jsapi function (of which there are many that create obje...
...initclass). some of these functions allow the application to specify a parent object. if the jsapi function creating the object has a parent parameter, and the application passes a non-null value to it, then that object becomes the new object's parent. otherwise, if the context is running any scripts or functions, a default parent object is selected based on those. otherwise, if the context has a
global object, it is used. otherwise the new object has no parent. this is often the case for the
global object, which is typically the first object created in a new context. the preferred way to set an object's parent is by using the parent parameter to js_newobject or js_constructobject. an application can also use js_setparent, but see the caveats on that page. an object's parent serves two pur...
JS_GetScopeChain
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. retrieves the scope chain for the javascript code currently running in a given context. js_getscopechain has been removed in spidermonkey 1.8.7 with no identical replacement. when you only used this function to retrieve the scope chain's
global, then you can use the function js_get
globalforscopechain. syntax jsobject * js_getscopechain(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, des...
...erties 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 object against which the function was created. note that cx's current
global object, as set by js_set
globalobject, is not guaranteed to be on the scope chain. if the currently executing function was created in the scope of a different
global object, then that object will be the last object in the current scope chain. if the context is currently executing a script, and not in any function, it's ...
...cope chain. if the currently executing function was created in the scope of a different
global object, then that object will be the last object in the current scope chain. if the context is currently executing a script, and not in any function, it's running in a scope that was passed to js_executescript or a similar function by the application. this scope chain may or may not contain cx's current
global object. if any code is currently executing in cx, js_getscopechain returns a pointer to the first jsobject on the current scope chain. otherwise, if cx has a
global object, js_getscopechain returns that. otherwise, an error is reported and js_getscopechain returns null. ...
... contain cx's current
global object. if any code is currently executing in cx, js_getscopechain returns a pointer to the first jsobject on the current scope chain. otherwise, if cx has a
global object, js_getscopechain returns that. otherwise, an error is reported and js_getscopechain returns null. to walk the scope chain, use js_getparent. ...
Components.utils.Sandbox
box, call components.utils.sandbox: var sandbox = components.utils.sandbox(principal[, options]); using new components.utils.sandbox(...) to create a sandbox has the same effect as calling sandbox(...) without new. the created sandbox is simply an empty javascript object marked as having been created by the restricted privilege principal. you can then use it with evalinsandbox() to make it the
global scope object for the specified script. principal the security principal defined for a sandbox determines what code running in that sandbox will be allowed to do. the principal may be one of four types: the system principal, a content principal, an expanded principal, or a null principal. see security checks for more information on security principals. system principal to specify the system p...
... 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. want
globalproperties 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: -prom...
... wantxrays a boolean value indica...
... wantxrays a boolean value indicating whether the sandbox wants xray vision with respect to same-origin objects outside the sandbox. default: true. "xray vision" is exactly the same xray behavior that script always gets, by default, when working with dom objects across origin boundaries. ...
Components.utils.exportFunction
uch as an extension, can share code with less-privileged code like a normal web page script. a function exported from privileged to less-privileged code can be called from the less privileged code's context. the function has access to its surrounding closure just as if it were being called in the privileged context. the exported function does not have to be added to the less privileged code's
global window object: it can be exported to any object in the target scope. exportfunction() is made available as a
global in sandboxes which have the wantexporthelpers option set in the sandbox() constructor. this includes add-on sdk content scripts. to understand what happens if the functions you export accept arguments, see exporting functions that take arguments below. syntax components.utils.ex...
...) constructor. this includes add-on sdk content scripts. to understand what happens if the functions you export accept arguments, see exporting functions that take arguments below. syntax components.utils.exportfunction(func, targetscope[, options]); parameters func : function the function to export. targetscope : object the object to attach the function to. this does not have to be the
global window object: it could be any other object in the target window, or an object created by the caller. options : object optional parameter that supplies additional options. the following options are currently defined: defineas: determines the name of the function in targetscope. if this is omitted, you need to assign the return value of exportfunction() to an object in the target scope. all...
...g this, is checked to make sure that the caller subsumes that argument. this prevents passing cross-origin objects (like window or location) to privileged functions, since the privileged code will have full access to those objects and might unintentionally do something dangerous. this provision can be overridden by passing { allowcrossoriginarguments: true } to exportfunction. ...
...suppose the content window defines a local variable bar: // page-script.js var bar = {}; now the add-on script can attach the function to bar: // addon-script.js components.utils.exportfunction(greetme, contentwindow.bar, {defineas: "greetme"}); // page-script.js var value = bar.greetme("bob"); console.log(v...
nsIBrowserHistory
toolkit/components/places/public/nsibrowserhistory.idlscriptable a browser-specific interface to
global history. it adds functions used by the basic browser like, marking pages as typed in the url bar, and removing pages as from the history interface. inherits from: nsi
globalhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1. to use this service, use: var browserhistory = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsibrowserhistory); method overview void addpagewithdetails(in nsiuri auri, in wstring atitle, in long long alastvisited); obsolete since gecko 15.0 void markpageasfollowedlink(i...
... void unregisteropenpage(in nsiuri auri); obsolete since gecko 9.0 note: the markpageasfollowedlink and markpageastyped methods were moved to nsinavhistoryservice in gecko 22.0 so that all markpageas* methods can be found in one interface. attributes attribute type description count obsolete since gecko 15.0 pruint32 indicates if there are entries in
global history. for performance reasons this does not return the real number of entries. read only. lastpagevisited obsolete since gecko 10.0 autf8string the last page that was visited in a top-level window. read only. note: the count attribute was removed in gecko 15.0 because it was only used to determine if there were any entries at all anyway, so the nsinavhistoryservice.hashis...
...9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) mark a page as being currently open. note: this method was an alias for moziplacesautocomplete.registeropenpage(), which still exists and can be used instead. void registeropenpage( in nsiuri auri ); parameters auri the page that is to be marked as currently open. removeallpages() this method removes all the pages from the
global history. void removeallpages(); parameters none. remarks visits are removed synchronously, but pages are expired asynchronously, off the main thread. note: removals are handled in a batch. single removals are not subject to individual notification; instead, nsinavhistoryobserver.onclearhistory() is called on the history observer. removepage() this method removes all visits for a page fro...
...a page as no longer being open (either by closing the window or tab, or by navigating away from that page). note: this method was an alias for moziplacesautocomplete.unregisteropenpage(), which still exists and can be used instead. void unregisteropenpage( in nsiuri auri ); parameters auri the page to unregister as an open page. see also places using the places history service nsi
globalhistory2 ...
nsIModule
er acompmgr, in nsifile alocation, in string aloaderstr, in string atype); void unregisterself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr); methods canunload() this method may be queried to determine whether or not the component module can be unloaded by xpcom. boolean canunload( in nsicomponentmanager acompmgr ); parameters acompmgr the
global component manager. return value indicates to the caller whether or not the component module can be unloaded. returning true is not a guarantee that the module will be unloaded. it constitues only willingness of the module to be unloaded. it is very important to ensure that no outstanding references to the module's code/data exist before returning true. returning false guaratees that the module w...
... component modules are never unloaded. getclassobject() obtains a class object from a nsimodule for a given cid and iid pair. this class object can either be query to a nsifactory or a may be query to a nsiclassinfo. void getclassobject( in nsicomponentmanager acompmgr, in nscidref aclass, in nsiidref aiid, [retval, iid_is(aiid)] out nsqiresult aresult ); parameters acompmgr the
global component manager. aclass the classid of object instance requested. aiid the iid of interface requested. aresult the resulting interface pointer. exceptions thrown ns_error_factory_not_registered indicates that the requested class is not available. ns_error_no_interface indicates that the requested interface is not supported. registerself() when the nsim...
...ested class is not available. ns_error_no_interface indicates that the requested interface is not supported. registerself() when the nsimodule is discovered, this method will be called so that any setup registration can be preformed. void registerself( in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr, in string atype ); parameters acompmgr the
global component manager. alocation the location of the nsimodule on disk. aloaderstr opaque loader specific string. atype loader type being used to load this module. unregisterself() when the nsimodule is being unregistered, this method will be called so that any unregistration can be preformed. void unregisterself( in nsicomponentmanager acompmgr, in nsifile alocation, i...
... nsimodule on disk. aloaderstr opaque loader specific string. atype loader type being used to load this module. unregisterself() when the nsimodule is being unregistered, this method will be called so that any unregistration can be preformed. void unregisterself( in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr ); parameters acompmgr the
global component manager. alocation the location of the nsimodule on disk. aloaderstr opaque loader specific string. remarks this interface was finalized (frozen) for gecko 0.9.9. see bug 99154 for details. from gecko 2.0 interfaces are no longer frozen. ...
Web Console remoting - Firefox Developer Tools
steners(), etc. protocol packets look as follows: { "to": "root", "type": "listtabs" } { "from": "root", "consoleactor": "conn0.console9", "selected": 2, "tabs": [ { "actor": "conn0.tab2", "consoleactor": "conn0.console7", "title": "", "url": "https://tbpl.mozilla.org/?tree=fx-team" }, // ... ] } notice that the consoleactor is also available as a
global actor. when you attach to the
global consoleactor you receive all of the network requests, page errors, and the other events from all of the tabs and windows, including chrome errors and network events. this actor is used for the browser console implementation and for debugging remote firefox/b2g instances. startlisteners(listeners, onresponse) the new startlisteners packet: { "to": "conn0.c...
...has private windows open. each page error, console api message and network request is annotated with a private flag. private messages are cleared whenever the last private window is closed. the console actor provides the lastprivatecontextexited notification: { "from": "conn0.console19", "type": "lastprivatecontextexited" } this notification is sent only when your client is attached to the
global console actor, it does not make sense for tab console actors. this notification has been introduced in firefox 24. send http requests starting with firefox 25 you can send an http request using the console actor: { "to": "conn0.console9", "type": "sendhttprequest", "request": { "url": "http://localhost", "method": "get", "headers": [ { name: "header-name", ...
...ing packet: { "to": "conn0.console9", "type": "evaluatejs", "text": "document", "bindobjectactor": null, "frameactor": null, "url": null, "selectednodeactor": null, } the bindobjectactor property is an optional objectactor id that points to a debugger.object. this option allows you to bind _self to the debugger.object of the given object actor, during string evaluation. see evalin
globalwithbindings() for information about bindings. the variable view needs to update objects and it does so by binding _self to the debugger.object of the objectactor that is being viewed. as such, variable view sends strings like these for evaluation: _self["prop"] = value; the frameactor property is an optional frameactor id. the fa holds a reference to a debugger.frame. this option allows y...
...ated packet for tab actors. firefox 23: bug 783499 - removed the webconsoleobjectactor. now the web console uses the javascript debugger api and the objectactor. firefox 23: added the bindobjectactor and frameactor options 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 t...
Compositing and clipping - Web APIs
« previousnext » in all of our previous examples, shapes were always drawn one on top of the other. this is more than adequate for most situations, but it limits the order in which composite shapes are built. we can, however, change this behaviour by setting the
globalcompositeoperation property. in addition, the clip property allows us to hide unwanted parts of shapes. ...
... « previousnext » in all of our previous examples, shapes were always drawn one on top of the other. this is more than adequate for most situations, but it limits the order in which composite shapes are built. we can, however, change this behaviour by setting the
globalcompositeoperation property. in addition, the clip property allows us to hide unwanted parts of shapes. ...
... see compositing examples for the code of the following examples. ...
...tions to use. see compositing examples for the code of the following examples. clipping paths a clipping path is like a normal canvas shape but it acts as a mask to hide unwanted parts of shapes. this is visualized in the image on the right. the red star shape is our clipping path. everything that falls outside of this path won't get drawn on the canvas. if we compare clipping paths to the
globalcompositeoperation property we've seen above, we see two compositing modes that achieve more or less the same effect in source-in and source-atop. the most important differences between the two are that clipping paths are never actually drawn to the canvas and the clipping path is never affected by adding new shapes. this makes clipping paths ideal for drawing multiple shapes in a restricted area.
ExtendableEvent - Web APIs
this ensures that any functional events (like fetchevent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. if waituntil() is called outside of the extendableevent handler, the browser should throw an invalidstateerror; note also that multiple calls will stack up, and the resulting promises will be added to the list of extend lifetime promises. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface. ...
...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 lifet...
...eight="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" 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 serviceworker
globalscope. 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 intend...
...hods 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 service worker prefetch sample (see prefetch example live.) the code calls extendableevent.waituntil() in serviceworker
globalscope.oninstall, delaying treating the serviceworkerregistration.installing worker as installed until the passed promise resolves successfully. the promise resolves when all resources have been fetched and cached, or else when any exception occurs. the code snippet also shows a best practice for versioning caches used by the service worker. though there's only one cache in this example, the same ...
Selection API - Web APIs
to a text string using selection.tostring(), adding a range (as represented by a standard range object) to the selection (or removing one) with selection.addrange()/selection.removerange(), or changing the selection to be the entire contents of a dom node using selection.selectallchildren(). you can run code in response to the selection being changed, or a new selection being started, using the
globaleventhandlers.onselectionchange and
globaleventhandlers.onselectstart event handlers. selection api interfaces selection represents the range of text selected by the user or the current position of the caret. extensions to other interfaces window.getselection(), document.getselection() returns a selection object representing the range of text selected by the user or the current posit...
...ction api interfaces selection represents the range of text selected by the user or the current position of the caret. extensions to other interfaces window.getselection(), document.getselection() returns a selection object representing the range of text selected by the user or the current position of the caret. document.getselection() is basically an alias of window.getselection().
globaleventhandlers.onselectstart represents the event handler that is called when a selectstart event is fired on the current object (i.e. when a new range of text is about to be selected by the user).
globaleventhandlers.onselectionchange represents the event handler that is called when a selectionchange event is fired on the current object (i.e. when the selected text range changes). specific...
...android webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetselection experimentalchrome full support 1edge full support 12firefox full support 1notes full support 1notes notes the
globaleventhandlers.onselectionchange and
globaleventhandlers.onselectstart event handlers are supported as of firefox 52.ie full support 9opera full support 9safari full support 1webview android full support 1chrome android ...
... 9safari full support 1webview android full support 1chrome android full support 18firefox android full support 4notes full support 4notes notes the
globaleventhandlers.onselectionchange and
globaleventhandlers.onselectstart event handlers are supported as of firefox 52.opera android full support 10.1safari ios full support 1samsung internet android full support 1.0addrange experimentalchrome full sup...
Date and time formats used in HTML - HTML: Hypertext Markup Language
ious datetime-local string. the space has been replaced with the "t" character and the trailing zero in the fraction of a second has been removed to make the string as short as possible. note that the normalized form of this date drops the ":00" indicating the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the length of the string.
global date and time strings a
global date and time string specifies a date and time as well as the time zone in which it occurs. a valid
global date and time string is the same format as a local date and time string, except it has a time zone string appended to the end, following the time. time zone offset string a time zone offset string specifies the offset in either a positive or a negative numbe...
...d 59. while this format allows for time zones between -23:59 and +23:59, the current range of time zone offsets is -12:00 to +14:00, and no time zones are currently offset from the hour by anything other than 00, 30, or 45 minutes. this may change at more or less anytime, since countries are free to tamper with their time zones at any time and in any way they wish to do so. ...
...time zones between -23:59 and +23:59, the current range of time zone offsets is -12:00 to +14:00, and no time zones are currently offset from the hour by anything other than 00, 30, or 45 minutes. this may change at more or less anytime, since countries are free to tamper with their time zones at any time and in any way they wish to do so. ...
...the current range of time zone offsets is -12:00 to +14:00, and no time zones are currently offset from the hour by anything other than 00, 30, or 45 minutes. this may change at more or less anytime, since countries are free to tamper with their time zones at any time and in any way they wish to do so. ...
Closures - JavaScript
ate methods with closures languages such as java allow you to declare methods as private, meaning that they can be called only by other methods in the same class. javascript does not provide a native way of doing this, but it is possible to emulate private methods using closures. private methods aren't just useful for restricting access to code. they also provide a powerful way of managing your
global namespace. the following code illustrates how to use closures to define public functions that can access private functions and variables. note that these closures follow the module design pattern. var counter = (function() { var privatecounter = 0; function changeby(val) { privatecounter += val; } return { increment: function() { changeby(1); }, decrement: functi...
...changes by changing the value of this variable. changes to the variable value in one closure don't affect the value in the other closure. using closures in this way provides benefits that are normally associated with object-oriented programming. in particular, data hiding and encapsulation. ...
...every closure has three scopes: local scope (own scope) outer functions scope
global scope a common mistake is not realizing that, in the case where the outer function is itself a nested function, access to the outer function's scope includes the enclosing scope of the outer function—effectively creating a chain of function scopes. to demonstrate, consider the following example code. ...
...ain of function scopes. to demonstrate, consider the following example code. ...
Functions - JavaScript
tement will return a default value. in the case of a constructor called with the new keyword, the default value is the value of its this parameter. for all other functions, the default return value is undefined. the parameters of a function call are the function's arguments. arguments are passed to functions by value. if the function changes the value of an argument, this change is not reflected
globally or in the calling function. however, object references are values, too, and they are special: if the function changes the referred object's properties, that change is visible outside the function, as shown in the following example: /* declare the function 'myfunc' */ function myfunc(theobject) { theobject.brand = "toyota"; } /* * declare variable 'mycar'; * create and initialize a new obj...
...names to be used by the function as formal parameters. each must be a proper javascript identifier. functionbody a string containing the javascript statements comprising the function body. invoking the function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. the generatorfunction constructor note: generatorfunction is not a
global object, but could be obtained from generator function instance (see generatorfunction for more detail). note: using the generatorfunction constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems. as all other objects, generatorfunction objects can be created using the new o...
... by a function declaration can be used before the function declaration itself. for example: foo(); // alerts foo! function foo() { alert('foo!'); } a function defined by a function expression or by a function declaration inherits the current scope. that is, the function forms a closure. on the other hand, a function defined by a function constructor does not inherit any scope other than the
global scope (which all functions inherit). /* * declare and initialize a variable 'p' (
global) * and a function 'myfunc' (to change the scope) inside which * declare a varible with same name 'p' (current) and * define three functions using three different ways:- * 1. function declaration * 2. function expression * 3. function constructor * each of which will log 'p' */ var p = 5; ...
...that is, the function body string passed to the function constructor must be parsed each and every time the constructor is called. although a function expression creates a closure every time, the function body is not reparsed, so function ...
RegExp.prototype.test() - JavaScript
nt to know whether a pattern is found in a string. test() returns a boolean, unlike the string.prototype.search() method (which returns the index of a match, or -1 if not found). to get more information (but with slower execution), use the exec() method. (this is similar to the string.prototype.match() method.) as with exec() (or in combination with it), test() called multiple times on the same
global regular expression instance will advance past the previous match. examples using test() simple example that tests if "hello" is contained at the very beginning of a string, returning a boolean result. const str = 'hello world!'; const result = /^hello/.test(str); console.log(result); // true the following example logs a message which depends on the success of the test: function testinput(...
...(regexp.prototype.exec() also advances the lastindex property.) further calls to test(str) will resume searching str starting from lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testi...
...(regexp.prototype.exec() also advances the lastindex property.) further calls to test(str) will resume searching str starting from lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test(...
...resume searching str starting from lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test() returns false, the calling regex's lastindex property will reset to 0. ...
RegExp - JavaScript
regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to start the next match. instance properties regexp.prototype.flags a string that contains the flags of the regexp object. regexp.prototype.dotall whether . matches newlines or not. regexp.prototype.
global whether to test the regular expression against all possible matches in a string, or only against the first. regexp.prototype.ignorecase whether to ignore case while attempting a match in a string. regexp.prototype.multiline whether or not to search in strings across multiple lines. regexp.prototype.source the text of the pattern. regexp.prototype.sticky whether or not the search is stick...
...performs sticky matching in the target string by attempting to match starting at regexp.prototype.lastindex. ...
... let str = '#foo#' let regex = /foo/y regex.lastindex = 1 regex.test(str) // true regex.lastindex = 5 regex.test(str) // false (lastindex is taken into account with sticky flag) regex.lastindex // 0 (reset after match failure) the difference between the sticky flag and the
global flag with the sticky flag y, the next match has to happen at the lastindex position, while with the
global flag g, the match can happen at the lastindex position or later: re = /\d/y; while (r = re.exec("123 456")) console.log(r, "and re.lastindex", re.lastindex); // [ '1', index: 0, input: '123 456', groups: undefined ] and re.lastindex 1 // [ '2', index: 1, input: '123 456', groups: undefined ] and re.lastindex 2 // [ '3', index: 2, input: '123 456', groups: undefined ] and re.lastindex 3 // ...
...at the lastindex position or later: re = /\d/y; while (r = re.exec("123 456")) console.log(r, "and re.lastindex", re.lastindex); // [ '1', index: 0, input: '123 456', groups: undefined ] and re.lastindex 1 // [ '2', index: 1, input: '123 456', groups: undefined ] and re.lastindex 2 // [ '3', index: 2, input: '123 456', groups: undefined ] and re.lastindex 3 // ... and no more match. with the
global flag g, all 6 digits would be matched, not just 3. regular expression and unicode characters \w and \w only matches ascii based characters; for example, a to z, a to z, 0 to 9, and _. to match characters from other languages such as cyrillic or hebrew, use \uhhhh, where hhhh is the character's unicode value in hexadecimal. this example demonstrates how one can separate out unicode characters ...
WebAssembly - JavaScript
you can compare it to math, which is also a namespace object for mathematical constants and functions, or to intl which is the namespace object for internationalization constructors and other language-sensitive functions. description the primary 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. ...
... 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 webassembly.linkerror() indicates an error during module instantiation (besides traps from the start function). we...
...odule then compile and instantiate it the following example (see our instantiate-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a resultobject. because the instantiatestreaming() function accepts a promise for a response object, you can directly pass it a windoworworker
globalscope.fetch() call, and it will pass the response into the function when it fulfills. var importobject = { imports: { imported_func: arg => console.log(arg) } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the resultobject's instance member is then accessed, and the contained exported function invoked. specifications ...
... 52notes notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0
globalchrome full support 69edge no support nofirefox full support 62ie no support noopera no support nosafari no support nowebview andr...
eval() - JavaScript
nd us a pull request. syntax eval(string) parameters string a string representing a javascript expression, statement, or sequence of statements. the expression can include variables and properties of existing objects. return value the completion value of evaluating the given code. if the completion value is empty, undefined is returned. description eval() is a function property of the
global object. the argument of the eval() function is a string. if the string represents an expression, eval() evaluates the expression. if the argument represents one or more javascript statements, eval() evaluates the statements. do not call eval() to evaluate an arithmetic expression; javascript evaluates arithmetic expressions automatically. if you construct an arithmetic expression as a string, y...
...ring('2 + 2')); // returns a string object containing "2 + 2" eval('2 + 2'); // returns 4 you can work around this limitation in a generic fashion by using tostring(). var expression = new string('2 + 2'); eval(expression.tostring()); // returns 4 if you use the eval function indirectly, by invoking it via a reference other than eval, as of ecmascript 5 it works in the
global scope rather than the local scope. this means, for instance, that function declarations create
global functions, and that the code being evaluated doesn't have access to local variables within the scope where it's being called. function test() { var x = 2, y = 4; console.log(eval('x + y')); // direct call, uses local scope, result is 6 var geval = eval; // equivalent to calling eval in th...
...cope rather than the local scope. this means, for instance, that function declarations create
global functions, and that the code being evaluated doesn't have access to local variables within the scope where it's being called. function test() { var x = 2, y = 4; console.log(eval('x + y')); // direct call, uses local scope, result is 6 var geval = eval; // equivalent to calling eval in the
global scope console.log(geval('x + y')); // indirect call, uses
global scope, throws referenceerror because `x` is undefined (0, eval)('x + y'); // another example of indirect call } never use eval()! eval() is a dangerous function, which executes the code it's passed with the privileges of the caller. if you run eval() with a string that could be affected by a malicious party, you may end up ru...
...n function('"use strict";return (' + obj + ')')(); } console.log(loosejsonparse( "{a:(4-1), b:function(){}, c:new date()}" )) comparing the two code snippets above, the two code snippets might seem to work the same way, but think again: the eval() one is a great deal slower. notice c: new date() in the evaluated object. in the function without the eval(), the object is being evaluated in the
global scope, so it is safe for the browser to assume that date refers to window.date() instead of a local variable called date. but, in the code using eval(), the browser cannot assume this since what if your code looked like the following: function date(n){ return ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"][n%7 || 0]; } function loosejsonparse(obj){ return eval("(...
undefined - JavaScript
the initial value of undefined is the primitive value undefined. ...
... writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax undefined description undefined is a property of the
global object. that is, it is a variable in
global scope. the initial value of undefined is the primitive value undefined. in modern browsers (javascript 1.8.5 / firefox 4+), undefined is a non-configurable, non-writable property, per the ecmascript 5 specification. (even when this is not the case, avoid overriding it.) a variable that has not been assigned a value is of type undefined. a method or st...
...when this is not the case, avoid overriding it.) a variable that has not been assigned a value is of type undefined. a method or statement also returns undefined if the variable that is being evaluated does not have an assigned value. a function returns undefined if a value was not returned. be careful. while it is possible to use it as an identifier (variable name) in any scope other than the
global scope (because undefined is not a reserved word), doing so is a very bad idea that will make your code difficult to maintain and debug. // don't do this // logs "foo string" (function() { var undefined = 'foo'; console.log(undefined, typeof undefined); })(); // logs "foo string" (function(undefined) { console.log(undefined, typeof undefined); })('foo'); examples strict equality an...
...eclared. // x has not been declared before if (typeof x === 'undefined') { // evaluates to true without errors // these statements execute } if (x === undefined) { // throws a referenceerror } however, there is another alternative. javascript is a statically scoped language, so knowing if a variable is declared can be read by seeing whether it is declared in an enclosing context. the
global scope is bound to the
global object, so checking the existence of a variable in the
global context can be done by checking the existence of a property on the
global object, using the in operator, for instance: if ('x' in window) { // these statements execute only if x is defined
globally } void operator and undefined the void operator is a third alternative. var x; if (x === void 0) { //...
Transitioning to strict mode - JavaScript
in contexts where what was done was an error. strict mode throws in such cases. if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. ...
... base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the
global object which is rarely the expected effect. ...
...once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the
global object which is rarely the expected effect. if you really want to set a value to the
global object, pass it as an argument and explicitly assign it as a property: var
global = 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 p...
... are very subtle differences. it's possible that a test suite doesn't catch this kind of subtle difference. careful review of your code base will probably be necessary to be sure these differences don't affect the semantics of your code. fortunately, this careful review can be done gradually down the function granularity. this in function calls in function calls like f(), the this value was the
global object. in strict mode, it is now undefined. when a function was called with call or apply, if the value was a primitive value, this one was boxed into an object (or the
global object for undefined and null). in strict mode, the value is passed directly without conversion or replacement. arguments doesn't alias named function arguments in non-strict mode, modifying a value in the arguments obje...
Interacting with page scripts - Archive of obsolete content
with unsafewindow you can see javascript objects that have been defined by page scripts, and if a page script has modified the behavior of native dom functions, you'll get the modified version of them as well. in this example a page script adds a string variable foo to the window: <!doctype html"> <html> <head> <script> window.foo = "hello from page script" </...
...}; // page-script.js var button = document.getelementbyid("show-content-script-var"); button.addeventlistener("click", function() { // access object defined by content script console.log(window.contentscriptobject.greeting); // "hello from add-on" }, false); after firefox 30, you can still do this for primitive values, but can no longer do it for objects. instead, you need to use the
global cloneinto() function to clone the object into the page script's scope. cloneinto() creates a structured clone of the object in the target context, and returns a reference to the clone. you can then assign that to a property of the target window, and the page script can access it. here's an example. the "main.js" opens the local file "page.html" and attaches a content script to it: // main.js ...
...", function(event) { console.log(event.detail.greeting); }, false); after firefox 30: clone the message object this technique depends on being able to share the message payload between the content script scope and the page script scope. ...
Intercepting Page Loads - Archive of obsolete content
ations in appendix a regarding performance if you're planning on implementing any of these. the easy way: load events this comes from the tabbrowser code snippets page. in a nutshell, from the chrome code in the overlay we add an event listener for the load event. this._loadhandler = function() {that._onpageload(); }; gbrowser.addeventlistener("load", this._loadhandler, true); gbrowser is a
global object that corresponds to the tabbrowser element in the main browser window. it is full of useful functions, so you should always keep it in mind when you want to handle tabs and web content windows. attaching the load event handler to gbrowser allows us to listen to these events for all tabs, without having to worry how many tabs are open. gbrowser exists in every browser window. we store the h...
...ficient. these require creating xpcom components that implement existing firefox interfaces. they may be useful in case you have most of your application logic in xpcom, or if you absolutely need a single point of inspection for loads. the previously explained solutions are enough for most cases, so these ones will be mentioned briefly. document loader service nsidocumentloader is nothing but a
global web progress listener. you can create an xpcom component that extends nsiwebprogresslistener and use the addprogresslistener method in the service to include it. everything mentioned before applies here as well, except you'll be receiving all the events for all tabs and windows in a single object, and you don't have to worry about adding and removing listeners every time a tab is opened or closed...
...is also has the advantage of detecting page loads anywhere in the application, not only in browser windows. if you are building a web filtering extension, you should keep in mind that xul windows such as the dom inspector window and the add-ons manager window allow (limited) web navigation. other extensions might add xul windows that allow navigation as well, so in those cases it's best to use a
global solution like this one. content policy finally, there is the option of implementing nsicontentpolicy. you can create an xpcom component that extends nsicontentpolicy and register it to the "content-policy" category using the nsicategorymanager. the nsicontentpolicy.shouldload() method is the only one in this interface that is really useful. it actually allows for cleaner-looking code than most...
Drag and Drop Example - Archive of obsolete content
pi. an example of implementing drag and drop will be implemented in this section. dragging elements around here, we'll create a simple board where items from a palette can be dragged onto the board. the user can click on one of several xul elements on the palette and drag it onto a stack element 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 resi...
... that if the text from an external drag just happens to be set to button, a button will be created on the board. a custom type means that the board will only accept drags from the palette. ...
...set to button, a button will be created on the board. a custom type means that the board will only accept drags from the palette. ...
Java in Firefox Extensions - Archive of obsolete content
note: the
global java object has been removed in gecko 16.0, so this page is out of date. you should still be able to use the java plugin's scripting functionality, see liveconnect for the pointers. note bug 834918 about click-to-play effect on java plugins in chrome and bug 775301. if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. ...
... effect on java plugins in chrome and bug 775301. if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these
globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the
global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., var ajavalist = new java.util.linkedlist(); if you want to load your own jars, then you can create your own java class loader. the foll...
...tor.newinstance(arglist); be aware that liveconnect, while now actively supported by sun has only recently been reimplemented for use in mozilla, so there may still be some bugs (though many prior liveconnect bugs, such as try-catch not catching java exceptions, the failure of auto-converting javascript arrays properly, etc., have now been fixed). one example seems to be the fact that the "java"
global is not immediately available if the extension operates in a sidebar (using settimeout solved it at least). i've had problems with stability in the latest xquseme when testing in firefox 3.5b4, especially apparently on linux (i haven't so far been able to find any workarounds/incompatibilities, but everything is working in firefox 3.0.10.). i've also experienced crashes in referencing the 'java' g...
Install script template - Archive of obsolete content
indows desktop, in this case c:\winnt\system32\myplugin\ 3. writes registry keys exposing the above secondary install location for other browsers to find. ...
...current_user = "hkey_current_user"; var reg_moz_path = "software\\mozillaplugins"; // my own error code in case secondary installation fails var nosecondaryinstall = 1; // error return codes need some memory var err; // error return codes when we try and install to the current browser var errblock1; // error return codes when we try and do a secondary installation var errblock2 = 0; //
global variable containing our secondary install location var secondaryfolder; //special error values used by the cycore developers (www.cycore.com) who helped make this install script var exceptionoccurederror = -4711; var winregisnullerror = -4712; var invalidrootkeyerror = -4713; var registrykeynotwritableerror = -4714; //initinstall block //the installation is initialize...
...ake this install script var exceptionoccurederror = -4711; var winregisnullerror = -4712; var invalidrootkeyerror = -4713; var registrykeynotwritableerror = -4714; //initinstall block //the installation is initialized here -- if we fail here, cancel the installation // initinstall is quite an overloaded method, but i have invoked it here with three strings // which are
globally defined err = initinstall(software_name, plid, version); if (err != 0) { // call initinstall again in case illegal characters in plid err = initinstall(software_name, software_name, version); if (err != 0) cancelinstall(err); } //addfiles to current browser block var pluginsfolder = getfolder("plugins"); //verify disk space if(verifydiskspace(pluginsfolder, plugin_size+component_...
Installer Script - Archive of obsolete content
lder = getfolder("plugins"); 35. if (!fileexists(pluginsfolder)) 36. { 37. var ignoreerr = dircreate(pluginsfolder); 38. logcomment("dircreate() returned: " + ignoreerr); 39. } 40. else 41. logcomment("plugins folder already exists"); 42. var cf = getfolder("chrome"); 43. registerchrome(content | delayed_chrome, getfolder(cf,"toolkit.xpi"),"content/
global/"); 44. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/communicator/"); 45. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/editor/"); 46. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/navigator/"); 47. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/communica...
...nt/editor/"); 46. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/navigator/"); 47. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/communicator/"); 48. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/editor/"); 49. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/
global/"); 50. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/messenger/"); 51. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/navigator/"); 52. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/aim/"); 53. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/communicator/...
...navigator/"); 52. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/aim/"); 53. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/communicator/"); 54. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/editor/"); 55. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/
global/"); 56. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/messenger/"); 57. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/navigator/"); 58. registerchrome(skin | delayed_chrome, getfolder(cf,"classic.jar"),"skin/classic/aim/"); 59. if (err==success) 60. { 61. err = performinstall(); 62. logcomment("per...
Index - Archive of obsolete content
t xul attributes, xul reference no summary! 96 disablechrome xul, xul attribute, xul reference no summary! 97 disableclose xul attributes, xul reference no summary! 98 disabled xul attributes, xul reference no summary! 99 disablefastfind xul, xul attribute, xul reference no summary! 100 disable
globalhistory no summary! 101 disablehistory no summary! 102 disablesecurity xul attributes, xul reference no summary! 103 dlgtype xul attributes, xul reference no summary! 104 dragging xul attributes, xul reference no summary! 105 drawintitlebar no summary! 106 droppedlinkhan...
...please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) 531 loaduriwithflags xul methods, xul reference (see nsiwebnavigation.loaduri() for details on the referrer and postdata parameters.) 532 makeeditable xul methods, xul reference no ...
... below.the type of browser, which can be used to set access of the document loaded inside the browser. 1126 image xul elements, xul reference 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. 1127 key reference, xul, xul elements, xul reference the key element defines a window-
global keyboard shortcut and must be placed inside a keyset element. 1128 keyset xul elements, xul reference a container element for key elements. the keyset and its descendants are not displayed. 1129 label xul elements, xul reference 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 assoc...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
?xml-stylesheet href="chrome://myextension/skin/toolbar-button.css" type="text/css"?> note: the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. this is very important because the toolbar customization dialog won't work correctly without this. to include the style on your chrome.manifest file: style chrome://
global/content/customizetoolbar.xul chrome://myextension/skin/toolbar-button.css if you are developing for firefox 1.0, attach it to the customize toolbar window (chrome://
global/content/customizetoolbar.xul) using skin/contents.rdf. the code looks like this: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <seq about="u...
...extensions for firefox/thunderbird 1.5 and above should instead use something like this in their chrome.manifest: skin myextension classic/1.0 c...
...li resource="urn:mozilla:skin:classic/1.0"/> </seq> <description about="urn:mozilla:skin:classic/1.0"> <chrome:packages> <seq about="urn:mozilla:skin:classic/1.0:packages"> <li resource="urn:mozilla:skin:classic/1.0:myextension"/> </seq> </chrome:packages> </description> <seq about="urn:mozilla:stylesheets"> <li resource="chrome://
global/content/customizetoolbar.xul"/> </seq> <seq about="chrome://
global/content/customizetoolbar.xul"> <li>chrome://myextension/skin/toolbar-button.css</li> </seq> </rdf> the skin/contents.rdf file is denigrated in developing for later releases of firefox. extensions for firefox/thunderbird 1.5 and above should instead use something like this in their chrome.manifest: skin myextension classic/1.0 chrome/skin/ style chrome://
global/content/customizetoolbar.xul chro...
Document Object Model - Archive of obsolete content
in mozilla, the dom may be accessed and manipulated using javascript. 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, t...
...each frame will also have a separate window object. the window is often referred to using the window property, although this is optional. sometimes, this is done just to clarify the scope of the method you are referring to. ...
...is optional. sometimes, this is done just to clarify the scope of the method you are referring to. for example, the following two lines which open a new window are functionally equivalent: window.open("test.xul","_new"); open("test.xul","_new"); when you declare a function or a variable at the top level of a script, that is outside another function, you are actually declaring a property of the
global object. in xul, each function you declare will be set as a property of the window object. for example, the following code will display the text 'message' in an alert twice. function gettext(){ return "message"; } alert(gettext()); alert(window.gettext()); thus, if you want to access variables or call a function declared in a script used by another window, you just need to access it using th...
browser - Archive of obsolete content
he 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. ...
... autocompletepopup type: id the id of a popup element used to hold autocomplete results for the element. autoscroll type: boolean set to false to disable autoscroll for this browser. if this attribute is set to true or omitted, autoscroll will be enabled or depending on the user preference general.autoscroll. disablehistory type: boolean disables both session and
global history for the docshell attached to the browser. disable
globalhistory type: boolean disables
global history for the docshell attached to the browser while keeping session history active. disablesecurity type: boolean set this attribute to true to disable the security ui for this browser. omit this attribute off to enable it. droppedlinkhandler type: function this functio...
...eturn type: no return value go forward one page in the history. gohome() return type: no return value load the user's home page into the browser. gotoindex( index ) return type: no return value navigate to the page in the history with the given index. use a positive number to go forward and a negative number to go back. note: this is the xul method on <browser> / <tabbrowser>, not the
global function in chrome://browser/content/browser.js. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into the document, with the given referrer and character set. the first argument should be a string, not a nsiuri object...
tree - Archive of obsolete content
value for a specific column (for example column 'age') from the currently focused row in the tree: var t = document.getelementbyid('mytree'); document.title = t.view.getcelltext(t.currentindex,t.columns.getnamedcolumn('age')); to select the checkbox and display the cell's text value, you can use code like the following. ...
...s. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: url("") } treechildren::-moz-tree-checkbox(checked) { /* checked checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x so you should specify a url to an image in your extension or elsewhere. ...
...url to an image in your extension or elsewhere. */ list-style-image: url("chrome://
global/skin/checkbox/cbox-check.gif"); } treechildren::-moz-tree-checkbox(disabled) { /* disabled checkbox treecells. cbox-check-dis.gif isn't available in firefox 1, 2, and 3 in mac os x, so you should specify a url to an image in your extension or elsewhere. ...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the zip file to a new directory using an archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\1.8.0.4 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.4.en-us.linux-i686.tar.gz. the following directory is recommended: /opt/xulrunner/1.8.0.4 . register xulrunner with the system by running xulru...
...r all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.4.en-us.linux-i686.tar.gz. the following directory is recommended: /opt/xulrunner/1.8.0.4 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. windows from a command prompt, run xulrunner.exe --unregis...
... remove the xulrunner directory. ...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the zip file to a new directory using an archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\1.9.1 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-1.9.1.19.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9.1 . register xulrunner with the system by running xulrun...
...or all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-1.9.1.19.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9.1 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. windows from a command prompt, run xulrunner.exe --unregiste...
... remove the xulrunner directory. ...
XULRunner 1.9 Release Notes - Archive of obsolete content
os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the zip file to a new directory using an archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\1.9 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-1.9.0.17.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9 . register xulrunner with the system by running xulrunn...
...for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-1.9.0.17.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. windows from a command prompt, run xulrunner.exe --unregis...
... remove the xulrunner directory. ...
Sunbird Theme Tutorial - Archive of obsolete content
preview graphic. you normally make these after you have designed the rest of your theme. make an image file 32 by 32 pixels, and save it as <tt>icon.png</tt> in your theme directory. make an image file about 200 by 100 pixels, and save it as <tt>preview.png</tt> in your theme directory. adding other components your theme only modifies the calendar component. ...
...to understand the user interface provided by these other components, unpack the other jar files. ...
...to understand the user interface provided by these other components, unpack the other jar files. ...
Common Firefox theme issues and solutions - Archive of obsolete content
ng toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows. the problem is commonly caused by a -moz-appearance:menulist style rule in chrome://
global/skin/menulist.css. once the offending rule is found, it should be deleted and manual styling used. app button not styled on linux, but is styled on windows on linux the firefox app button that is displayed when tabs are on top and menu bar is disabled is not styled properly compared to windows and is not changing colors when in private browsing mode. the cause of this issue is that linux firefo...
... .addon[active="false"] .icon { filter: url("chrome://mozapps/skin/extensions/extensions.svg#greyscale"); opacity:0.3; } about:memory about:memory nodes do not collapse the styling of about:memory is a little messed up in that nodes do not collapse as they should when clicked on. to fix this issue you need to copy the following file from the latest version of firefox to your theme: chrome://
global/content/aboutmemory.css. about:permissions domain names don't line up in about:permissions the domains on the domain list of about:permissions do not line up properly due to missing placeholder icons for domains without favicons. this issue is fixed by adding the following css instructions to the file browser/preferences/aboutpermissions.css: .site-favicon { height: 16px; width: 16px; -...
...s will break in firefox 10. change the style rules: .playbutton[paused] {...} .mutebutton[muted] {...} to: .playbutton[paused="true"] {...} .mutebutton[muted="true"] {...} error console warnings unknown namespace for videocontrols.css the error console is reporting the following issue: warning: unknown namespace prefix 'html'. ruleset ignored due to bad selector. source file: chrome://
global/skin/media/videocontrols.css the solution to this issue is to add the following name space to the second line of the file right after, and in addition to, 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 console² you can easily filter out content related m...
Theme changes in Firefox 4 - Archive of obsolete content
rectory chrome. now copy all of the directories from omni.jar mentioned above into it. then copy all of icon.png, install.rdf and preview.png from <firefox-app-bundle>/contents/macos/extensions/{...} into my_theme. ...
...he directories from omni.jar mentioned above into it. then copy all of icon.png, install.rdf and preview.png from <firefox-app-bundle>/contents/macos/extensions/{...} into my_theme. ...
...e. finally, you need to create a chrome.manifest file with the contents: skin browser classic/1.0 chrome/browser/ skin communicator classic/1.0 chrome/communicator/ skin
global classic/1.0 chrome/
global/ skin mozapps classic/1.0 chrome/mozapps/ this results in the following structure : /my_theme/chrome/browser/* /my_theme/chrome/communicator/* /my_theme/chrome/
global/* /my_theme/chrome/mozapps/* /my_theme/chrome.manifest /my_theme/icon.png /my_theme/install.rdf /my_theme/preview.png note: for more information (and how to package into a jar) consult creating a skin for firefox which still mostly applies. most likely you must replace all occurences of classic/1.0 in chrome.manifest and install.rdf with some other name. improving your appearance on windows ...
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
ed well-known symbols. these symbols let you configure how js treats an object, by using them as property keys. examples of well-known symbols are: symbol.iterator for array-like objects, or symbol.search for string objects. they are listed in the specification in the well-known symbols table: symbol.hasinstance symbol.isconcatspreadable symbol.iterator symbol.toprimitive …and so on. ...
...s let you configure how js treats an object, by using them as property keys. examples of well-known symbols are: symbol.iterator for array-like objects, or symbol.search for string objects. they are listed in the specification in the well-known symbols table: symbol.hasinstance symbol.isconcatspreadable symbol.iterator symbol.toprimitive …and so on. ...
...r symbol.search for string objects. they are listed in the specification in the well-known symbols table: symbol.hasinstance symbol.isconcatspreadable symbol.iterator symbol.toprimitive …and so on.
global symbol registry there is a
global symbol registry holding all available symbols. the methods that access the registry are symbol.for() and symbol.keyfor(); these mediate between the
global symbol table (or "registry") and the run-time environment. the
global symbol registry is mostly built by javascript's compiler infrastructure, and the
global symbol registry's content is not available to javascript's run-time infrastructure, except through these reflective methods. the method symbol.for(tokenstring) returns a symbol value from the registry, and symbol.keyfor(symbolvalue) returns...
Mobile accessibility - Learn web development
locking the phone when talkback is turned on, unlocking the phone is a bit different. you can do a two-finger swipe up from the bottom of the lock screen. if you've set a passcode or pattern for unlocking your device, you will then be taken to the relevant entry screen to enter it. you can also explore by touch to find the unlock button at the bottom middle of the screen, and then double-tap.
global and local menus talkback allows you to access
global and local context menus, wherever you have navigated to on the device. the former provides
global options relating to the device as a whole, and the latter provides options relating just to the current app/screen you are in. to get to these menus: access the
global menu by quickly swiping down, and then right. access the local menu by qui...
... browsing web pages you can use the local context menu while in a web browser to find options to navigate web pages using just the headings, form controls, or links, or navigate line by line, etc. ...
... browsing web pages you can use the local context menu while in a web browser to find options to navigate web pages using just the headings, form controls, or links, or navigate line by line, etc. for example, with talkback turned on: open your web browser. activate the url bar. ...
Sending form data - Learn web development
m a request; html form data can be transmitted via a number of different methods, the most common being the get method and the post method to understand the difference between those two methods, let's step back and examine how http works. each time you want to reach a resource on the web, the browser sends a request to a url. an http request consists of two parts: a header that contains a set of
global metadata about the browser's capabilities, and a body that can contain information necessary for the server to process the specific request. the get method the get method is the method used by the browser to ask the server to send back a given resource: "hey server, i want to get this resource." in this case, the browser sends an empty body. because the body is empty, if a form is sent using th...
...n, many servers limit the length of urls they accept. on the server side: retrieving the data whichever http method you choose, the server receives a string that will be parsed in order to get the data as a list of key/value pairs. the way you access this list depends on the development platform you use and on any specific frameworks you may be using with it. ...
...d on any specific frameworks you may be using with it. example: raw php php offers some
global objects to access the data. assuming you've used the post method, the following example just takes the data and displays it to the user. of course, what you do with the data is up to you. you might display it, store it into a database, send it by email, or process it in some other way. <?php // the
global $_post variable allows you to access the data sent with the post method by name // to access the data sent with the get method, you can use $_get $say = htmlspecialchars($_post['say']); $to = htmlspecialchars($_post['to']); echo $say, ' ', $to; ?> this example displays a page with the data we sent. you can see this in action in our example php-example.html file — which contains the ...
Frame script environment
may be null (see below) docshell the nsidocshell associated with the browser. addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content. addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. sendsyncmessage() send a synchronous message to chrome. dump() print a message to the console. atob() base64 decode. ...
...hrome. dump() print a message to the console. atob() base64 decode. btoa() base64 encode. components the usual components object. in particular, note that a frame script accesses the dom window using content, not window: // frame script var links = content.document.getelementsbytagname("a"); all the frame scripts running in a tab share this
global. however, any top-level variables defined by a script are not stored on the
global: instead, top-level variables are stored in a special per-script object that delegates to the per-tab
global. this means you don't have to worry about
global variables you define conflicting with
global variables defined by another frame script. you can still access the
global directly via this. frame scripts run ...
...aptured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager
global object in order to avoid handling unload events from content. does not bubble. domwindowcreated fires when a new content object is created. this can be used if a framescript needs to interact with individual dom windows instead of simply listening for events bubbling up from content. another use is to interact with the content very early in the page load ...
Limitations of chrome scripts
80. also note that unlike other shims, this shim is always active. alternatively, you can use nsiwebprogresslistener in the content process. observers in the chrome process depending on the topic, you need to register observers in either the chrome process or in a frame script. for most topics you need to register observers in the chrome process. however, you must listen to content-document-
global-created and document-element-inserted in a frame script. observers for these topics get content objects as the asubject argument to observe(), so notifications are not sent to the chrome process. there is a shim that will forward these two topics to the chrome process, sending cpows as the asubject argument. http requests you can't observe http requests in the content process. if you do, you'l...
...l and you could handle them there. this no longer happens in multiprocess firefox. with the shim the shim intercepts chrome process code that adds listeners to xul elements and sets up listeners in the content process, relaying the result back to the chrome process. the event object itself is relayed to the chrome process as a cpow. to make the shim unnecessary: register event listeners on the
global object inside a frame script. for example: addeventlistener("load", handler, true) // for example if you need to contact the chrome process when that happens, send it a message. sandboxes you can create sandboxes in the chrome or the content process. sandboxes are often used as a safe way to manipulate web content, and if that's your goal, create the sandbox in the content process. the...
...om about: pages registered using nsiaboutmodule are loaded in the chrome process. this means that you can't access their content from the content process (via xhr, for example). you can change this default in the code you use to register the about: uri. see about: and chrome: uris. javascript code modules (jsms) in single-process firefox, you can use javascript code modules (jsms) to maintain
global state. in multiprocess firefox, a jsm loaded into one process does not share any state with the same jsm loaded into a different process: so you can't use a jsm to share state between the chrome and content processes. if an add-on wants to use a jsm to share state in this way, it's best to load the jsm in the chrome process, and have frame scripts store and access the jsm's state by sending m...
Frame script environment
addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content. addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. sendsyncmessage() send a synchronous message to chrome. dump() print a message to the console. atob() base64 decode. ...
...me. dump() print a message to the console. atob() base64 decode. btoa() base64 encode. components the usual components object. in particular, note that a frame script accesses the dom window using content, not window: // frame script var links = content.document.getelementsbytagname("a"); all of the frame scripts running in a tab share this
global. however, any top-level variables defined by a script are not stored on the
global: instead, top-level variables are stored in a special per-script object that delegates to the per-tab
global. this means you don't have to worry about
global variables you define conflicting with
global variables defined by another frame script. you can still access the
global directly using this. frame scripts ru...
... the current content object the following additional events get fired in a frame script environment: unload bubbles no fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager
global object to avoid handling unload events from content. domwindowcreated fires when a new content object is created. this can be used if a framescript needs to interact with individual dom windows instead of simply listening for events bubbling up from content. another use is to interact with the content very early in the page load process, long before domcontent...
Frame script loading and lifetime
oads a frame script into the currently selected tab. the script just writes "foo" to the command line: // chrome script var mm = gbrowser.selectedbrowser.messagemanager; mm.loadframescript('data:,dump("foo\\n")', true); loadframescript() takes two mandatory parameters: a url that points to the frame script you want to load a boolean flag, allowdelayedload note: if the message manager is a
global frame message manager or a window message manager, loadframescript() may load the script multiple times, once in each applicable frame. chrome: urls extension developers usually use a chrome:// url to refer to the frame scripts. to define the mapping between a chrome:// url and a frame script packaged with an extension, use a "chrome.manifest" file to register a chrome url: // chrome.manifest...
...e a chrome:// url to refer to the frame scripts. to define the mapping between a chrome:// url and a frame script packaged with an extension, use a "chrome.manifest" file to register a chrome url: // chrome.manifest content my-e10s-extension chrome/content/ // chrome script mm.loadframescript("chrome://my-e10s-extension/content/content.js", true); allowdelayedload if the message manager is a
global frame message manager or a window message manager then: if allowdelayedload is true, the frame script will be loaded into any new frame, which has opened after the loadframescript() call. for example: var mm = window.messagemanager; mm.loadframescript("chrome://my-e10s-extension/content/frame-script.js", true); the script will be loaded into all tabs currently open in this window, and...
...if you did not set the third argument to true in bootstrap.js on services.mm.addmessagelistener, sending this message during, and after, the unloading event will do nothing. var gcontentframemessagemanager = this; addeventlistener('unload', function(aevent) { if (aevent.target == gcontentframemessagemanager) { sendasyncmessage('my-addon-id', 'framescrip...
Process scripts
if you're using the addon sdk you can use the remote/parent module's remoterequire instead. when you need to run code in the content process in order to access web content, then you should use frame scripts. however, a problem with frame scripts is that they can be loaded multiple times in the content process, in multiple scopes that are insulated from each other. for example, if you call the
global frame message manager's loadframescript() function, then the script will be loaded separately into all open tabs. this can then cause a problem the frame scripts are interacting with a
global service in the content process. for example, in multiprocess firefox, if you need to use nsicontentpolicy to register a content policy, you must do this in the content process. but if you register it in a f...
...in the content process, but if you do this in a frame script, and the frame script is loaded more than once, then you will get multiple notifications for that event. the solution in these cases is to use a process script instead of a frame script. you can load a process script by accessing a parent process message manager and calling its loadprocessscript() function. ...
... code uses the
global parent process message manager, which will load the script into the the chrome process and any child processes: // chrome code let ppmm = cc["@mozilla.org/parentprocessmessagemanager;1"] .getservice(ci.nsiprocessscriptloader); ppmm.loadprocessscript("chrome://whatever/process-script.js", true); ppmm.addmessagelistener("hello", function(msg) { ... ...
AddonManager
the majority of the methods are asynchronous meaning that results are delivered through callbacks passed to the method. the callbacks will be called just once but that may be before or after the method returns. one of the forces of the addonmanager is that it deals with any kind (type) of add-on in a generic manner. to do so many methods of the addonmanager take the add-on types as parameters. the existing add-on types are defined in xpiprovider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
... was not in any known format. update_status_security_error the update information was not correctly signed or there was an ssl error. auto update values constant description autoupdate_disable indicates that the add-on should not update automatically. autoupdate_default indicates that the add-on should update automatically only if that's the
global default. autoupdate_enable indicates that the add-on should update automatically. pending operations constant description pending_none no operations are pending. pending_enable this add-on will be enabled after the application restarts. pending_disable this add-on will be disabled after the application restarts. pending_...
...on scopes constant value description scope_all 15 a combination of all the installation scopes. scope_application 4 this add-on is a part of the current application (installed and owned by firefox). scope_profile 1 this add-on is installed in the current profile directory. scope_system 8 this add-on is installed somewhere
global to the system (installed for all users of the computer). scope_user 2 this add-on is installed somewhere specific to the current user (all profiles of the logged-in user). note: the extensions.enabledscopes preference lets you configure which of these scopes are enabled; however, you can't turn off the profile scope. starting in firefox 8, you can also set the value of the p...
Localization and Plurals
for a given language, there is a grammatical rule on how to change words, depending on the number qualifying the word. different languages can have different rules. plural form: for a particular plural rule, there can be multiple forms of a word, such as "page" and "pages". in this case, there are 2 forms, but other languages can have 1 or many more. if you're here for pluralrule in the chrome/
global/intl.properties file, you'll need to figure out what plural rule to choose for your 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...
...ur localization. this plural rule is used to determine how many plural forms are needed for each word that needs to be localized, with plurals in mind. for all other properties files that link to this page, you'll need to provide enough plural forms of the desired word, and separate them with semi-colons (;). if you don't know how many plural forms you need, check the pluralrule number in chrome/
global/intl.properties, and look up the corresponding entry in the following list of plural rules. list of plural rules this section contains a list of plural rules ordered by their plural rule number. each entry indicates how many plural forms are needed when localizing a word. for each entry, there is a list of families and languages in those families, to help you figure out if it's the rule you sho...
...luralform.jsm loading the pluralform module from javascript is simple with components.utils.import. just put the following line somewhere that will be evaluated before you want to use pluralform. at the top of your javascript file is fine. components.utils.import("resource://gre/modules/pluralform.jsm"); methods: get these methods make use of the browser's current locale specified by chrome://
global/locale/intl.properties's pluralrule value. /** * get the correct plural form of a word based on the number * * @param anum * the number to decide which plural form to use * @param awords * a semi-colon (;) separated string of words to pick the plural form * @return the appropriate plural form of the word */ string pluralform get(int anum, string awords) here is an example ...
Investigating leaks using DMD heap scan mode
ke a while. analyzing the logs getting the pid and address of the leaking object the first step is to figure out the pid of the leaking process. the second step is to figure out the address of the leaking object, usually a window. conveniently, you can usually do both at once using the cycle collector log. ...
...15873 is the pid of the process that leaked. you'll want to write down the name of the file and the pid. let's call the file $cclog and the pid $pid. ...
...tput. you'll want to save a copy of this output for later. the output will look something like this, after a message about loading progress: 0x7f0882fe3230 [fragmentorelement (xhtml) script https://www.example.com] --[[via hash] mlistenermanager]--> 0x7f0899b4e550 [eventlistenermanager] --[mlisteners event=onload listenertype=3 [i]]--> 0x7f0882ff8f80 [callbackobject] --[mincumbent
global]--> 0x7f0897082c00 [ns
globalwindowinner # 2147483662 inner https://www.example.com] root 0x7f0882fe3230 is a ref counted object with 1 unknown edge(s). known edges: 0x7f08975a24c0 [fragmentorelement (xhtml) head https://www.example.com] --[mattrsandchildren[i]]--> 0x7f0882fe3230 0x7f08967e7b20 [js object (htmlscriptelement)] --[unwrapdomobject(obj)]--> 0x7f0882fe3230 the ...
L20n Javascript API
les(); when you freeze the context by calling requestlocales, the resource files will be retrieved, parsed and compiled. you can listen to the ready event (emitted by the context instance when all the resources have been compiled) and use ctx.getsync and ctx.getentitysync to get translations synchronously. alternatively, you can register callbacks to execute when the context is ready (or when
globals change and translations need to be updated) with ctx.localize. ctx.localize(['hello', 'new'], function(l10n) { var node = document.queryselector('[data-l10n-id=hello]'); node.textcontent = l10n.entities.hello.value; node.classlist.remove('hidden'); }); ctx.registerlocales(defaultlocale: string?, availablelocales: array<string>?) register the default locale of the context instance, as...
...ysync(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(ids: array<string>, callback: function) registers a callback which fires when all entities listed in ids have been...
...allback 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 the
globals used in the translation of ids has changed. ctx.ready(callback: function) fires the function passed as argument as soon as the context is available. if the context is available when the function is called, it fires the callback instantly. otherwise it sets the event listener and fire as soon as the context is ready. af...
PRThreadScope
the scope of an nspr thread, specified as a parameter to pr_createthread or returned by pr_getthreadscope. syntax #include <prthread.h> typedef enum prthreadscope { pr_local_thread, pr_
global_thread pr_
global_bound_thread } prthreadscope; enumerators pr_local_thread a local thread, scheduled locally by nspr within the process. pr_
global_thread a
global thread, scheduled by the host os. pr_
global_bound_thread a
global bound (kernel) thread, scheduled by the host os description an enumerator of type prthreadscope specifies how a thread is scheduled: either locally by nspr within the process (a local thread) or
globally by the host (a
global thread).
global threads are scheduled by the host os and compete with all other threads on the host os for resources. they are subje...
... specifies how a thread is scheduled: either locally by nspr within the process (a local thread) or
globally by the host (a
global thread).
global threads are scheduled by the host os and compete with all other threads on the host os for resources. they are subject to fairly sophisticated scheduling techniques. local threads are scheduled by nspr within the process. the process is assumed to be
globally scheduled, but nspr can manipulate local threads without system intervention. in most cases, this leads to a significant performance benefit. however, on systems that require nspr to make a distinction between
global and local threads,
global threads are invariably required to do any form of i/o. if a thread is likely to do a lot of i/o, making it a
global thread early is probably warranted. ...
... system intervention. in most cases, this leads to a significant performance benefit. however, on systems that require nspr to make a distinction between
global and local threads,
global threads are invariably required to do any form of i/o. if a thread is likely to do a lot of i/o, making it a
global thread early is probably warranted. on systems that don't make a distinction between local and
global threads, nspr silently ignores the scheduling request. to find the scope of the thread, call pr_getthreadscope. ...
nss tech note8
he client session cache source file. the same cache/uncache api is used by both client and server code. as originally designed, before calling the cache function, the caller was responsible to fill in the session creation time (which might not be the same as the time of insertion into the cache) and the session expiration time, among other things. since nss 1.0, up until nss 3.4, there were two
global variables that contained the expected session lifetimes for ssl2 and ssl3 sessions. extern pruint32 ssl_sid_timeout; (the ssl2 session lifetime) extern pruint32 ssl3_sid_timeout; (the ssl3 session lifetime) each of these variables applied to both client and server sessions. that is, the client session lifetime was not separately settable from the server session lifetime. these two variabl...
... = sid->creationtime = ssl_time(); sid->expirationtime = sid->creationtime + ssl3_sid_timeout; (*ss->sec.cache)(sid); the cache api was defined such that the caller must set creationtime properly, and may set expirationtime to the desired value or to zero. if zero, then the called cache function would compute the correct expiration time by adding the chosen timeout (from one of those two
global variables) to the sid's creationtime, giving the expirationtime. however, none of the callers relied on the ability of the respective cache functions to be able to compute the expiration time. all callers computed the expiration times explicitly, as shown above. the server side of the session cache code was largely rewritten for nss 3.4. the objectives were to make the server session cache fa...
...r the server session cache, and to allow multiple different server session caches to coexist. as part of that work, i decided that each cache would have its own variables containing the ssl2 and ssl3 session durations. this means that client cache session lifetimes are separate from server session cache lifetimes, and that each server session cache may have its own lifetimes. so, in nss 3.4, the
global variables ssl3_sid_timeout and ssl_sid_timeout were intended to become the definitions for the client cache only, and each server cache had its own new pair of variables for ssl2 and ssl3 session lifetimes, i.e., cache->ssl2timeout and cache->ssl3timeout. the server cache initialization function was intended to no longer alter the variables ssl3_sid_timeout and ssl_sid_timeout, but rather to set ...
Functions
the whole scope chain. so we optimize this when we can. these optimizations depend on being sure that we will never have to walk the scope chain, so with and eval inhibit them all. null closures. if we can prove at compile time that a function does not refer to any locals or arguments of enclosing functions, it is a null closure. since it will never need to walk the scope chain, its parent is the
global object. this is the best case. barring with and eval, all outermost functions are null closures. null closures with upvars. a nested function is algol-like if it is only ever defined and called, and it isn't accessed in any other way (and it is not a generator-function). such a function is guaranteed never to be called again after the enclosing function exits. an algol-like function may read the ...
...ariables and arguments that never change value after the function is created, then the function can be implemented as a flat closure. when a flat closure is created, all the closed-on values are copied from the stack into reserved slots of the function object. to evaluate a name, instead of walking the scope chain, we just take the value from the reserved slot. the function object's parent is the
global object. flat closures and null closures have been removed: https://bugzilla.mozilla.org/show_bug.cgi?id=730497 https://bugzilla.mozilla.org/show_bug.cgi?id=739808 name lookups in order of speed, fastest to slowest. arg and local instructions. if a name definitely refers to an argument or local variable of the immediately enclosing function, it can be accessed using jsop_{get,set,call}{arg,lo...
...) { eval(s); print(s); // s can be loaded with getarg with (obj) { print(s); // no getarg here; s might refer to obj.s } } upvar instructions. jsop_{get,call}upvar (in algol-like functions only, i think?) todo dslot instructions. jsop_{get,call}dslot (in flat closures only) todo gvar instructions. outside all functions, if a name definitely refers to a
global for which we have seen a var, const, or function declaration, then we emit a js_defvar instruction in the script prelude and access the
global using jsop_{get,set,call}gvar. this is fast if the
global either doesn't exist before the script runs (the script creates it) or it's a non-configurable data property (which amounts to the same thing). otherwise the gvar instructions are as slow as name in...
JS_NewRegExpObject
ct * js_newucregexpobjectnostatics(jscontext *cx, char16_t *chars, size_t length, unsigned flags); name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a
global object. bytes or chars const char * or const char16_t * a pointer to the string that contains a regular expression. length size_t the length of bytes or chars, in characters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. i ...
... or chars const char * or const char16_t * a pointer to the string that contains a regular expression. length size_t the length of bytes or chars, in characters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. ...
... js_newregexpobjectnostatics and js_newucregexpobjectnostatics create a new regexp instance. they do not or in any regexp constructor properties. ...
Language bindings
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.retu...
...s mechanism doesn't account for any native (c++) xpcom objects hanging off javascript objects though. in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable. in this case it can be important to be able to force a garbage collection cycle from javascript. components.utils.get
globalforobjectthis method is used to determine the
global object with which an object is associated. this is the
global object in place at the time the object was created, which is to say the
global object used when executing the script that created the object.components.utils.getweakreferencethis method was introduced in firefox 3 and is used for obtaining a weak reference for an object. to obtain the...
... reference for an object. to obtain the object reference, you have to call get() on the resulting object.components.utils.importcomponents.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.components.utils.import
globalpropertiesimports various objects into a system scope.components.utils.isxraywrapperwhen 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, privileged code using an xr...
Observer Notifications
quested that the close be aborted. after this is sent and handled, the browser window will close. browser-delayed-startup-finished sent when the browser window and all its components have been loaded and initialized. documents these topics indicate notifications you can monitor related to dom documents. ...
...d. documents these topics indicate notifications you can monitor related to dom documents. topic subject data description chrome-document-
global-created nsidomwindow null sent immediately after a chrome document window has been set up, but before any script code has been executed. this lets extensions inject api into chrome windows as needed (see nsidom
globalpropertyinitializer for an alternative method of doing this, which uses significantly less memory). data is intentionally left blank. content-document-
global-created nsidomwindow origin sent immediately after a web content document window has been set up, but before any script code has been executed. this lets extensions inject api into content windows as needed (see nsidomgl...
... just after a xul window is made visible. browsing-context-discarded browsingcontext called while a browsingcontext is being discarded. by this point, the browsingcontext will have been detached from its browsingcontextgroup and parent windowcontext, and removed from any browsingcontext tree it was a part of. this is sent before browsingcontext::closed() is updated. window-
global-created window
globalparent called just after a window
globalparent is initialized. a window
global actor has a lifetime matching that of an ns
globalwindowinner. window-
global-destroyed window
globalparent called just before a window
globalparent is destroyed. by this point, the wgp being destroyed will have cleaned up most of its state, including its browsingcontext children and ...
nsIMessageListenerManager
dom/base/nsimessagemanager.idlscriptable this interface enables clients to listen for messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces. 1.0 66 introduced gecko 17 inherits from: nsisupports last changed in gecko 41 (firefox 41 / thunderbird 41 / seamonkey 2.38) implemented by: @mozilla.org/
globalmessagemanager;1. ...
...lscriptable this interface enables clients to listen for messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces. 1.0 66 introduced gecko 17 inherits from: nsisupports last changed in gecko 41 (firefox 41 / thunderbird 41 / seamonkey 2.38) implemented by: @mozilla.org/
globalmessagemanager;1. ...
...o listen for messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces. 1.0 66 introduced gecko 17 inherits from: nsisupports last changed in gecko 41 (firefox 41 / thunderbird 41 / seamonkey 2.38) implemented by: @mozilla.org/
globalmessagemanager;1. ...
nsIMsgWindow
this article. inherits from: nsisupports last changed in gecko 8 (firefox 8 / thunderbird 8 / seamonkey 2.5) implemented by: @mozilla.org/messenger/msgwindow;1. to create an instance, use: msgwindow = components.classes["@mozilla.org/messenger/msgwindow;1"] .createinstance(components.interfaces.nsimsgwindow); in thunderbird the default message window is stored in the
global variable msgwindow. method overview void displayhtmlinmessagepane(in astring title, in astring body, in boolean clearmsghdr); void stopurls(); void closewindow(); attributes attribute type description windowcommands nsimsgwindowcommands this allows the backend code to send commands to th...
...ack the folder currently open in the ui. rootdocshell nsidocshell this is used to track the chrome window's nsidocshell object. you don't normally need to set this, instead set the domwindow property instead. messagewindowdocshell nsidocshell readonly: this retrieves the nsidocshell object for the message pane. you should not store this in a
global variable. notificationcallbacks nsiinterfacerequestor these are currently used to set notification callbacks on protocol channels to handle things like bad cert exceptions. promptdialog nsiprompt readonly: this is the equivalent of calling getinterface on the rootdocshell object. mailcharacterset acstring this is ...
...erride boolean remember the message's charset was overridden, so it can be inherited (e.g for quoting). stopped boolean check if a running url been stopped. if you are checking this flag, you need to clear it before you start your operation since there's no convenient place to clear it. domwindow nsidomwindow the message window's
global chrome window object. set this to initialize the rootdocshell. methods displayhtmlinmessagepane() loads the specified html in the message pane. this is equivalent to calling loaduri on the nsiwebnavigation object with a data: url specifying the html. void displayhtmlinmessagepane(in astring title, in astring body, in boolean cle...
nsIWorkerScope
onmessage nsidomeventlistener a listener object to be called when a message is posted on the port. the message is in the event's data member. ...
... onmessage nsidomeventlistener a listener object to be called when a message is posted on the port. the message is in the event's data member. ...
...ject. ...
nsIXPCScriptable
making the call. implementations may skip writing to *_retval unless they want to return pr_false. js/src/xpconnect/idl/nsixpcscriptable.idlnot scriptable please add a summary to this article. ...
...26 dont_reflect_interface_names 1 << 27 want_equality 1 << 28 want_outer_object 1 << 29 want_inner_object 1 << 30 reserved 1 << 31 the high order bit is reserved for consumers of these flags. no implementor of this interface should ever return flags with this bit set. ...
...nt_outer_object 1 << 29 want_inner_object 1 << 30 reserved 1 << 31 the high order bit is reserved for consumers of these flags. no implementor of this interface should ever return flags with this bit set. ...
XPCOM Interface Reference
omdesktopnotificationcenternsidomelementnsidomeventnsidomeventgroupnsidomeventlistenernsidomeventtargetnsidomfilensidomfileerrornsidomfileexceptionnsidomfilelistnsidomfilereadernsidomfontfacensidomfontfacelistnsidomgeogeolocationnsidomgeopositionnsidomgeopositionaddressnsidomgeopositioncallbacknsidomgeopositioncoordsnsidomgeopositionerrornsidomgeopositionerrorcallbacknsidomgeopositionoptionsnsidom
globalpropertyinitializernsidomhtmlaudioelementnsidomhtmlformelementnsidomhtmlmediaelementnsidomhtmlsourceelementnsidomhtmltimerangesnsidomjswindownsidommousescrolleventnsidommoznetworkstatsnsidommoznetworkstatsdatansidommoznetworkstatsmanagernsidommoztoucheventnsidomnshtmldocumentnsidomnavigatordesktopnotificationnsidomnodensidomofflineresourcelistnsidomorientationeventnsidomparsernsidomprogresseventns...
...sultnsifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotocolhandlernsifilespecnsifilestreamsnsifileurlnsifileutilitiesnsifileviewnsifocusmanagernsiformhistory2nsiframeloadernsiframeloaderownernsiframemessagelistenernsiframemessagemanagernsiframescriptloadernsigsettingscollectionnsigsettingsservicensigeolocationprovidernsigeolocationupdatensi
globalhistorynsi
globalhistory2nsi
globalhistory3nsihtmleditornsihttpheaderlistenernsihapticfeedbacknsihttpactivitydistributornsihttpactivityobservernsihttpchannelnsihttpchannelinternalnsihttpheadervisitornsihttpservernsihttpupgradelistenernsiidnservicensiiframeboxobjectnsiiniparsernsiiniparserfactorynsiiniparserwriternsiioservicensiidleservicensiinprocesscontentframemessagemanagernsiinputstreamnsiinputst...
...thandlerregistrarnsiwebnavigationnsiwebnavigationinfonsiwebpagedescriptornsiwebprogressnsiwebprogresslistenernsiwebprogresslistener2nsiwebsocketchannelnsiwebsocketlistenernsiwebappssupportnsiwifiaccesspointnsiwifilistenernsiwifimonitornsiwinaccessnodensiwinapphelpernsiwintaskbarnsiwindowcreatornsiwindowmediatornsiwindowwatchernsiwindowsregkeynsiwindowsshellservicensiworkernsiworkerfactorynsiworker
globalscopensiworkermessageeventnsiworkermessageportnsiworkerscopensiwritablepropertybagnsiwritablepropertybag2nsixformsmodelelementnsixformsnsinstanceelementnsixformsnsmodelelementnsixmlhttprequestnsixmlhttprequesteventtargetnsixmlhttprequestuploadnsixpcexceptionnsixpcscriptablensixpconnectnsixsltexceptionnsixsltprocessornsixsltprocessorobsoletensixulappinfonsixulbrowserwindownsixulbuilderlistenernsixu...
XPCOM Interface Reference by grouping
t nsiautocompletesearch console nsiconsolelistener nsiconsolemessage nsiconsoleservice document nsidocshell dom device nsidomgeogeolocation nsidomgeoposition nsidomgeopositionaddress nsidomgeopositioncallback nsidomgeopositioncoords nsidomgeopositionerror nsidomgeopositionerrorcallback nsidomgeopositionoptions nsidom
globalpropertyinitializer element nsidomchromewindow nsidomclientrect nsidomelement nsidomhtmlaudioelement nsidomhtmlformelement nsidomhtmlmediaelement nsidomhtmlsourceelement nsidomhtmltimeranges nsidomjswindow nsidomnode nsidomnshtmldocument nsidomstorageitem nsidomstoragemanager nsidomwindow nsidomwindow2 nsidomwindowinternal ...
...ylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexception nsixsltprocessor download nsidownload nsidownloadmanager nsidownloadprogresslistener element internal nsiworker nsiworker
globalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree nsitreeboxobject nsitreecolumn nsitreecolumns nsitreecontentview nsitreeselection nsitreeview xform nsixformsmodelelement nsixformsnsinstanceelement nsixformsnsmodelelement xmlhttprequest nsixmlhttprequesteventtarget favicon nsifavicondatacall...
... nsiauthmodule nsiauthprompt nsiauthpromptprovider nsiauthpromptwrapper nsiasyncverifyredirectcallback content nsicontentpolicy credentials nsilogininfo nsiloginmanager using nsiloginmanager nsiloginmanagerstorage nsiloginmetainfo history nsi
globalhistory nsi
globalhistory2 nsi
globalhistory3 ssl nsibadcertlistener2 system action nsicancelable application application nsiapplicationupdateservice nsiappshell nsiappshellservice nsiappstartup ...
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.import
globalproperties() function: components.utils.import
globalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...r an overview.) however, the apis can also be accessed from system-privileged javascript using the components.utils.import
globalproperties() function: components.utils.import
globalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...ed javascript using the components.utils.import
globalproperties() function: components.utils.import
globalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
XUL Overlays
ckage. since the purpose of an overlay is to define new ui elements for a package within the context of that package's skin, the overlay should add structure but not new style. any skins that are loaded by an overlay destructively replace the master skin for the base file, and can change the basic appearance of the package's skin in unfortunate ways. note: the master skin is not the same as the
global skin. for any package, the master skin file is that css file named after the package itself. the master skin file for the bookmarks package, for example, is called bookmarks.css, and is located in the skin/default subdirectory. overlaying attributes in addition to new elements and subtrees, you can also overlay attributes into existing elements. in xul, attributes control important features of th...
...tom of common dialogs, the ok and cancel buttons, may be used in dozens of places in the ui. rather than redefining this set of buttons each time they are necessary in a particular dialog, base xul files can overlay the xul file in which these buttons are defined, dialogoverlay.xul. (actually, the implementation is one step more complicated than this: base files overlay dialogoverlay.xul from the
global component directory, which in turn overlays a platform-specific xul file such as platformdialogoverlay.xul. the mechanism is the same, however.) any dialog that wants to overlay these buttons just declares the overlay at the top: <?xul-overlay href="chrome://
global/content/dialogoverlay.xul"?> and includes an empty box with an id of okcancelbuttons in the ui. the following snippet shows a dialog ...
...toolbars, submenus, boxes, and any other subtrees that appear in multiple places can be defined in overlays files in this way and referenced for reuse wherever necessary. see also chapter 12 "overlays and chrome" of "rapid application development with mozilla" "overlays", "cross package overlays of xul tutorial ...
Browser Console - Firefox Developer Tools
per tools in the regular web toolbox with add-on or browser code, consider using the browser toolbox. similarly, you can execute javascript expressions using the browser console. but while the web console executes code in the page window scope, the browser console executes them in the scope of the browser's chrome window. this means you can interact with all the browser's tabs using the gbrowser
global, and even with the xul used to specify the browser's user interface. nb: the browser console command line (to execute javascript expressions) is disabled by default. to enable it set the devtools.chrome.enabled preference to true in about:config, or set the "enable browser chrome and add-on debugging toolboxes" (firefox 40 and later) option in the developer tool settings. opening the browser...
... the scope of the chrome window of the browser. you can confirm this by evaluating window: this means you can control the browser: opening, closing tabs and windows and changing the content that they host, and modify the browser's ui by creating, changing and removing xul elements. controlling the browser the command line interpreter gets access to the tabbrowser object, through the gbrowser
global, and that enables you to control the browser through the command line. try running this code in the browser console's command line (remember that to send multiple lines to the browser console, use shift+enter): var newtabbrowser = gbrowser.getbrowserfortab(gbrowser.selectedtab); newtabbrowser.addeventlistener("load", function() { newtabbrowser.contentdocument.body.innerhtml = "<h1>this page ha...
...er.contentdocument.location.href = "https://mozilla.org/"; it adds a listener to the currently selected tab's load event that will eat the new page, then loads a new page. note: you can restart the browser with the command ctrl + alt + r (windows, linux) or cmd + alt + r (mac) this command restarts the browser with the same tabs open as before the restart. modifying the browser ui since the
global window object is the browser's chrome window, you can also modify the browser's user interface. on windows, the following code will add a new item to the browser's main menu: var parent = window.document.getelementbyid("appmenuprimarypane"); var makethetea = gbrowser.ownerdocument.defaultview.document.createelementns("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem"); m...
Compositing example - Web APIs
this sample program demonstrates a number of compositing operations. the output looks like this: compositing example this code sets up the
global values used by the rest of the program. var canvas1 = document.createelement("canvas"); var canvas2 = document.createelement("canvas"); var gco = [ 'source-over','source-in','source-out','source-atop', 'destination-over','destination-in','destination-out','destination-atop', 'lighter', 'copy','xor', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity' ].reverse(); var gcotext = [ 'this is the default setting and draws new shapes on top of the existing canvas conte...
..."); p.textcontent = gcotext.pop(); dd.appendchild(p); var canvastodrawon = createcanvas(); var canvastodrawfrom = createcanvas(); var canvastodrawresult = createcanvas(); var ctx = canvastodrawresult.getcontext('2d'); ctx.clearrect(0, 0, width, height) ctx.save(); ctx.drawimage(canvas1, 0, 0, width/2, height/2); ctx.
globalcompositeoperation = pop; ctx.drawimage(canvas2, 0, 0, width/2, height/2); ctx.
globalcompositeoperation = "source-over"; ctx.fillstyle = "rgba(0,0,0,0.8)"; ctx.fillrect(0, height/2 - 20, width/2, 20); ctx.fillstyle = "#fff"; ctx.font = "14px arial"; ctx.filltext(pop, 5, height/2 - 5); ctx.restore(); var ctx = canvastodrawon.g...
...tx.filltext('new content', 5, height/2 - 5); ctx.restore(); dd.appendchild(canvastodrawon); dd.appendchild(canvastodrawfrom); dd.appendchild(canvastodrawresult); dl.appendchild(dd); } }; utility functions the program relies on a number of utility functions. ...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
here are generally not important to most javascript programmers. this information is provided as a basis for why microtasks are useful and how they function; if you don't care, you can skip this and come back later if you find that you need to. when a fragment of javascript code runs, it runs inside an execution context. there are three types of code that create a new execution context: the
global context is the execution context created to run the main body of your code; that is, any code that exists outside of a javascript function. each function is run within its own execution context. this is frequently referred to as a "local context." using the ill-advised eval() function also creates a new execution context. each context is, in essence, a level of scope within your code. as one ...
...+ "<br>\r"; } greetuser("mike"); greetuser("teresa"); greetuser("veronica"); this short program contains three execution contexts, some of which are created and destroyed several times over the course of the program's execution. as each context is created, it is placed on the execution context stack. when it exits, the context is removed from the context stack. upon starting the program, the
global context is created. when greetuser("mike") is reached, a context is created for the greetuser() function; this execution context is pushed onto the execution context stack. when greetuser() calls localgreeting(), another context is created to run that function. when this function returns, the context for localgreeting() is removed from the execution stack and destroyed. program e...
... contexts in this manner, each program and function is able to have its own set of variables and other objects. each context additionally tracks the next line in the program that should be run and other information critical to that context's operation. by using the contexts and the context stack in this manner, many of the fundamentals of how a program operates can be managed, including local and
global variables, function calls and returns, and so forth. a special note about recursive functions—that is, functions which call themselves, possibly over multiple levels of depth or recursion: each recursive call to the function creates a new execution context. this allows the javascript runtime to track the levels of recursion and the return of results through that recursion, but it also means th...
Push API - Web APIs
hen the service worker is active, it can subscribe to push notifications, using pushmanager.subscribe(). the resulting pushsubscription includes all the information that the application needs to send a push message: an endpoint and the encryption key needed for sending data. the service worker will be started as necessary to handle incoming push messages, which are delivered to the serviceworker
globalscope.onpush event handler. this allows apps to react to push messages being received, for example, by displaying a notification (using serviceworkerregistration.shownotification().) each subscription is unique to a service worker. the endpoint for the subscription is a unique capability url: knowledge of the endpoint is all that is necessary to send a message to your application. the endpoint u...
... and not all generate a visible notification. note: chrome versions earlier than 52 require you to set up a project on google cloud messaging to send push messages, and use the associated project number and api key when sending push notifications. it also requires an app manifest, with some special parameters to use this service. interfaces pushevent represents a push action, sent to the
global scope of a serviceworker. it contains information sent from an application to a pushsubscription. pushmanager provides a way to receive notifications from third-party servers, as well as request urls for push notifications. this interface has replaced the functionality offered by the obsolete pushregistrationmanager interface. pushmessagedata provides access to push data sent by a server, and...
... entry point for using push messages. they also monitor and respond to push and subscription change events. serviceworkerregistration.pushmanager read only returns a reference to the pushmanager interface for managing push subscriptions including subscribing, getting an active subscription, and accessing push permission status. this is the entry point into using push messaging. serviceworker
globalscope.onpush an event handler fired whenever a push event occurs; that is, whenever a server push message is received. serviceworker
globalscope.onpushsubscriptionchange an event handler fired whenever a pushsubscriptionchange event occurs; for example, when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time.) examples moz...
SVGElement - Web APIs
these can also be defined in svg using attributes of the form data-*, where * is the key name for the pair. this works just like html's htmlelement.dataset...
...element, svgelementinstance svgelement.datasetread only a domstringmap object which provides a list of key/value pairs of named data attributes which correspond to custom data attributes attached to the element. these can also be defined in svg using attributes of the form data-*, where * is the key name for the pair. this works just like html's htmlelement.dataset property and html's data-*
global attribute. svgelement.classname read only an svganimatedstring that reflects the value of the class attribute on the given element, or the empty string if class is not present. this attribute is deprecated and may be removed in a future version of this specification. authors are advised to use element.classlist instead. svgelement.ownersvgelementread only an svgsvgelement referring to the ...
...g> element. null if the given element is the outermost <svg> element. svgelement.viewportelementread only the svgelement, which established the current viewport. often, the nearest ancestor <svg> element. null if the given element is the outermost <svg> element. methods this interface has no methods, but inherits methods from: documentandelementeventhandlers, element, elementcssinlinestyle,
globaleventhandlers, htmlorforeignelement, svgelementinstance events listen to these events using addeventlistener() or by assigning an event listener to the equivalent on... handler property defined on
globaleventhandlers or windoweventhandlers. abort fired when page loading is stopped before an svg element has been allowed to load completely. also available via the onabort property. error fir...
Using Service Workers - Web APIs
t experiments, as it supports https. in order to facilitate local development, localhost is considered a secure origin by browsers as well. basic architecture with service workers, the following steps are generally observed for basic set up: the service worker url is fetched and registered via serviceworkercontainer.register(). if successful, the service worker is executed in a serviceworker
globalscope; this is basically a special kind of worker context, running off the main script execution thread, with no dom access. the service worker is now ready to process events. installation of the worker is attempted when service worker-controlled pages are accessed subsequently. an install event is always the first one sent to a service worker (this can be used to start the process of populating...
... service worker, which runs in a worker context, and therefore has no dom access. you then run code in the service worker outside of your normal pages to control their loading. a single service worker can control many pages. each time a page within your scope is loaded, the service worker is installed against that page and operates on it. bear in mind therefore that you need to be careful with
global variables in the service worker script: each page doesn’t get its own unique worker. note: your service worker functions like a proxy server, allowing you to modify requests and responses, replace them with items from its own cache, and more. note: one great thing about service workers is that if you use feature detection like we’ve shown above, browsers that don’t support service work...
...er is registered, the browser will attempt to install then activate the service worker for your page/site. the install event is fired when an install is successfully completed. the install event is generally used to populate your browser’s offline caching capabilities with the assets you need to run your app offline. to do this, we use service worker’s brand new storage api — cache — a
global object on the service worker that allows us to store assets delivered by responses, and keyed by their requests. this api works in a similar way to the browser’s standard cache, but it is specific to your domain. it persists until you tell it not to — again, you have full control. note: the cache api is not supported in every browser. (see the browser compatibility section for more informat...
SharedWorker - Web APIs
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). ...
... 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). ...
...the ports associated with that worker are accessible in the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { ...
Web Workers API - Web APIs
. the advantage of this is that laborious processing can be performed in a separate thread, allowing the main (usually the ui) thread to run without being blocked/slowed down. web workers concepts and usage a worker is an object created using a constructor (e.g. worker()) that runs a named javascript file — this file contains the code that will run in the worker thread; workers run in another
global context that is different from the current window. this context is represented by either a dedicatedworker
globalscope object (in the case of dedicated workers - workers that are utilized by a single script), or a sharedworker
globalscope (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 except...
... 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 even workers. ...
...haredworker represents a specific kind of worker that can be accessed from several browsing contexts, being several windows, iframes or even workers. worker
globalscope represents the generic scope of any worker (doing the same job as window does for normal web content). different types of worker have scope objects that inherit from this interface and add more specific features. dedicatedworker
globalscope represents the scope of a dedicated worker, inheriting from worker
globalscope and adding some dedicated features. sharedworker
globalscope represents the scope of a shared worker, inheriting from worker
globalscope and adding some dedicated features. workernavigator represents the identity and state of the user agent (the client): examples we have created a couple of simple demos to sh...
Window.open() - Web APIs
the request from sending the url of the page that initiated the request to the server where the request is sent. in addition, setting this feature also automatically sets noopener. see rel="noreferrer" for additional details and compatibility information. firefox introduced support for noreferrer in firefox 68. ...
...ndow and will name it "promotefirefoxwindowname". ...
... onclick="openrequestedpopup(this.href, this.target); return false;" title="this link will create a new window or will re-use an already opened one" >promote firefox adoption</a></p> you can also make such function able to open only 1 secondary window and to reuse such single secondary window for other links in this manner: <script type="text/javascript"> var windowobjectreference = null; //
global variable var previousurl; /*
global variable that will store the url currently in the secondary window */ function openrequestedsinglepopup(url) { if(windowobjectreference == null || windowobjectreference.closed) { windowobjectreference = window.open(url, "singlesecondarywindowname", "resizable,scrollbars,status"); } else if(previousurl != url) { windowob...
Worker.onmessage - Web APIs
note: the message payload is available in the message event's data property. syntax myworker.onmessage = function(e) { ... } example the following code snippet shows creation of a worker object using the worker() constructor. ...
... for a full example, see ourbasic dedicated worker example (run dedicated worker). specifications specification status comment html living standardthe definition of 'worker.onmessage' in that specification. living standard ...
... for a full example, see ourbasic dedicated worker example (run dedicated worker). specifications specification status comment html living standardthe definition of 'worker.onmessage' in that specification. living standard ...
Overview of events and handlers - Developer guides
bjects in the dom (document object model) tree including user interactions or modifications, the xmlhttprequest objects used for network requests, and the media objects such as audio and video, when the media stream players change state. although this list is currently incomplete. ...
...change state. although this list is currently incomplete. some notable events are: note: this list of events will need work to make relevant; that work is awaiting some
global reorganization work on the documents. this will also need finding a good explanation of the events involved during page loading, such as discussed partially in this web page or in this stack overflow question. ...
.... this will also need finding a good explanation of the events involved during page loading, such as discussed partially in this web page or in this stack overflow question. ...
Writing forward-compatible websites - Developer guides
this page explains how to write websites that do not break when new browser versions are released. this is especially important for intranets and other non-public websites; if we can't see your code, we can't see that it broke. it's not always possible to follow all of these, but following as many of them as possible will help future-proof your website. javascript prefix all
global variable access in onfoo attributes with “window.” when an event handler content attribute (onclick, onmouseover, and so forth) is used on html element, all name lookup in the attribute first happens on the element itself, then on the element's form if the element is a form control, then on the document, and then on the window (where the
global variables you have defined are). for example, if you hav...
...ens on the element itself, then on the element's form if the element is a form control, then on the document, and then on the window (where the
global variables you have defined are). for example, if you have this markup: <div onclick="alert(ownerdocument)">click me</div> then clicking on the text alerts the ownerdocument of the div. this happens even if there is a var ownerdocument declared in
global scope. what this means is that any time you access a
global variable in an event handler content attribute, including calling any function declared
globally, you can end up with a name collision if a specification adds a new dom property to elements or documents which has the same name as your function or variable, and a browser implements it. if that happens, then suddenly your function stops b...
...function declared
globally, you can end up with a name collision if a specification adds a new dom property to elements or documents which has the same name as your function or variable, and a browser implements it. if that happens, then suddenly your function stops being called. this has happened multiple times to various sites already during the evolution of html5. to avoid this, fully qualify
global variable access using "window.", like so: <script> function localname() { alert('function localname has been called'); } </script> <div onclick="window.localname()">clicking me should show an alert<div> don't concatenate scripts you don't control the "use strict;" directive in ecmascript, when used on the file level, applies to everything in the file. so appending a script that depend...
<a>: The Anchor element - HTML: Hypertext Markup Language
ons in the same page, or anything else a url can address. content within each <a> should indicate the link's destination. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. attributes this element's attributes include the
global attributes. downloadhtml5 prompts the user to save the linked url instead of navigating to it. can be used with or without a value: without a value, the browser will suggest a filename/extension, generated from various sources: the content-disposition http header the final segment in the url path the media type (from the (content-type header, the start of a data: url, or...
...ed by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone numbers with tel: urls email addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotocolhandler() hreflang hints at the human language of the linked url. no built-in functionality. allowed values are the same as the
global lang attribute. ping a space-separated list of urls. when the link is followed, the browser will send post requests with the body ping to the urls. typically for tracking. referrerpolicy how much of the referrer to send when following the link. see referrer-policy for possible values and their effects. rel the relationship of the linked url as space-separated link types. target where to ...
...e is obsolete and should not be used by authors. use the http content-type header on the linked url. coordsobsolete since html5 used with the shape attribute. a comma-separated list of coordinates. nameobsolete since html5 was required to define a possible target location in a page. in html 4.01, id and name could both be used on <a>, as long as they had identical values. note: use the
global attribute id instead. revobsolete since html5 specified a reverse link; the opposite of the rel attribute. deprecated for being very confusing. shapeobsolete since html5 the shape of the hyperlink’s region in an image map. note: use the <area> element for image maps instead. properties content categories flow content, phrasing content, interactive content, palpable con...
itemtype - HTML: Hypertext Markup Language
itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active. 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, musicevent indicates a concert performance, with startdate and location properties specifying the concert's key details. in this case, musicevent would be the url used by itemtype, with startdate and location as itemprop's which musicevent defines. ...
...ined to use the same vocabulary. the itemtype attribute can only be specified on elements which have an itemscope attribute specified. the itemid attribute can only be specified on elements which have both an itemscope attribute and an itemtype attribute specified. ...
... an itemscope attribute specified. the itemid attribute can only be specified on elements which have both an itemscope attribute and an itemtype attribute specified. they must only be specified on elements with an itemscope attribute, whose itemtype attribute specifies a vocabulary not supporting
global identifiers for items, as defined by that vocabulary's specification. the exact meaning of a
global identifier is determined by the vocabulary's specification. it is left to such specifications to define whether multiple items of the same
global identifier (whether on the same page or different pages) are allowed to exist, and what processing rules for that vocabulary are, with respect to handling the case of multiple items with the same id. simple example html <div itemscope itemtype="http...
Numbers and dates - JavaScript
« previousnext » this chapter introduces the concepts, objects and functions used to work with and perform calculations using numbers and dates in javascript. this includes using numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the
global math object to perform a wide variety of mathematical operations on numbers. numbers in javascript, numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a number between ±2−1022 and ±2+1023, or about ±10−308 to ±10+308, with a numeric precision of 53 bits). integer values up to ±253 − 1 can be represented exactly. in addition to being able to represent floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan (not...
...049250313e-16) number.min_safe_integer minimum safe integer in javascript (−253 + 1, or −9007199254740991) number.max_safe_integer maximum safe integer in javascript (+253 − 1, or +9007199254740991) methods of number method description number.parsefloat() parses a string argument and returns a floating point number. same as the
global parsefloat() function. number.parseint() parses a string argument and returns an integer of the specified radix or base. same as the
global parseint() function. number.isfinite() determines whether the passed value is a finite number. number.isinteger() determines whether the passed value is an integer. number.isnan() determines whether the pass...
... number.issafeinteger() determines whether the provided value is a number that is a safe integer. the number prototype provides methods for retrieving information from number objects in various formats. the following table summarizes the methods of number.prototype. ...
Memory Management - JavaScript
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 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: { ...
...otsofdata" property), the memory consumed by this data will never be released and can lead to memory related issues such as the browser becoming increasingly slower. mark-and-sweep algorithm this algorithm reduces the definition of "an object is no longer needed" to "an object is unreachable". this algorithm assumes the knowledge of a set of objects called roots. in javascript, the root is the
global object. periodically, the garbage collector will start from these roots, find all objects that are referenced from these roots, then all objects referenced from these, etc. starting from the roots, the garbage collector will thus find all reachable objects and collect all non-reachable objects. this algorithm is an improvement over the previous one since an object having zero references is effec...
...on) over the last few years are implementation improvements of this algorithm, but not improvements over the garbage collection algorithm itself nor its reduction of the definition of when "an object is no longer needed". cycles are no longer a problem in the first example above, after the function call returns, the two objects are no longer referenced by any resource that is reachable from the
global object. consequently, they will be found unreachable by the garbage collector and have their allocated memory reclaimed. limitation: releasing memory manually there are times when it would be convenient to manually decide when and what memory is released. in order to release the memory of an object, it needs to be made explicitly unreachable. as of 2019, it is not possible to explicitly or pro...
TypeError: "x" is read-only - JavaScript
(technically, it is a non-writable data property.) this error happens only in strict mode code. ...
...signed to is a read-only property. message typeerror: assignment to read-only properties is not allowed in strict mode (edge) typeerror: "x" is read-only (firefox) typeerror: 0 is read-only (firefox) typeerror: cannot assign to read only property 'x' of #<object> (chrome) 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 = obje...
...se 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. ...
arguments.callee - JavaScript
for example: [1, 2, 3, 4, 5].map(function factorial(n) { return !(n > 1) ? 1...
...for example: [1, 2, 3, 4, 5].map(function factorial(n) { return !(n > 1) ? 1 : factorial(n - 1)*n; }); this has numerous benefits: the function can be called like any other from inside your code it d...
...., but even the best code is suboptimal due to checks that would not otherwise be necessary.) the other major issue is that the recursive call will get a different this value, e.g.: var
global = this; var sillyfunction = function(recursed) { if (!recursed) { return arguments.callee(true); } if (this !==
global) { alert('this is: ' + this); } else { alert('this is the
global'); } } sillyfunction(); ecmascript 3 resolved these issues by allowing named function expressions. for example: [1, 2, 3, 4, 5].map(function factorial(n) { return !(n > 1) ? 1 : factorial(n - 1)*n; }); this has numerous benefits: the function can be called like any other from inside your code it does not create a variable in the outer scope (except for ie 8 and below) it has bett...
Function.prototype.bind() - JavaScript
cript programmers is to extract a method from an object, then to later call that function and expect it to use the original object as its this (e.g., by using the method in callback-based code). without special care, however, the original object is usually lost. ...
...riginal object is usually lost. creating a bound function from the function, using the original object, neatly solves this problem: this.x = 9; // 'this' refers to
global 'window' object here in a browser const module = { x: 81, getx: function() { return this.x; } }; module.getx(); // returns 81 const retrievex = module.getx; retrievex(); // returns 9; the function gets invoked at the
global scope // create a new function with 'this' bound to module // new programmers might confuse the //
global variable 'x' with module's property 'x' const boundgetx = retrievex.bind(module); boundgetx(); // returns 81 partially applied functions the next simplest use of bind() is to make a function with pre-specified initial arguments. these arguments (if any) follow the provided this value...
...when working with class methods that require this to refer to class instances, you may explicitly bind this to the callback function, in order to maintain the instance. function latebloomer() { this.petalcount = math.floor(math.random() * 12) + 1; } // declare bloom after a delay of 1 second latebloomer.prototype.bloom = function() { window.settimeout(this.declare.bind(this), 1000)...
Number.isFinite() - JavaScript
is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax number.isfinite(value) parameters value the value to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite number. description in comparison to the
global isfinite() function, this method doesn't forcibly convert the parameter to a number. this means only values of the type number, that are also finite, return true. polyfill if (number.isfinite === undefined) number.isfinite = function(value) { return typeof value === 'number' && isfinite(value); } examples using isfinite number.isfinite(infinity); // false number.isfinite(nan); /...
... ...
... ...
Number.isNaN() - 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 number.isnan(value) parameters value the value to be tested for nan. return value true if the given value is nan and its type is number; otherwise, false. ...
... parameters value the value to be tested for nan. return value true if the given value is nan and its type is number; otherwise, false. description due to both equality operators, == and ===, evaluating to false when checking if nan is nan, the function number.isnan() has become necessary. this situation is unlike all other possible value comparisons in javascript. in comparison to the
global isnan() function, number.isnan() doesn't suffer the problem of forcefully converting the parameter to a number. this means it is now safe to pass values that would normally convert to nan, but aren't actually the same value as nan. this also means that only values of the type number, that are also nan, return true. polyfill the following works because nan is the only value in javascript which i...
...eturn true. polyfill the following works because nan is the only value in javascript which is not equal to itself. number.isnan = number.isnan || function isnan(input) { return typeof input === 'number' && input !== input; } examples using isnan number.isnan(nan); // true number.isnan(number.nan); // true number.isnan(0 / 0); // true // e.g. ...
RegExp.prototype.exec() - JavaScript
/foo/g or /foo/y). they store a lastindex from the previous match. using this internally, exec() can be used to iterate over multiple matches in a string of text (with capture groups), as opposed to getting just the matching strings with string.prototype.match(). a newer function has been proposed to simplify matching multiple parts of a string (with capture groups): string.prototype.matchall(). ...
...the 0-based index of the match in the string. 4 input the original string that was matched against. "the quick brown fox jumps over the lazy dog" re lastindex the index at which to start the next match. if g is absent, this will always be 0. 25 ignorecase indicates if the i flag was used to ignore case. true
global indicates if the g flag was used for a
global match. true multiline indicates if the m flag was used to search across multiple lines. false source the text of the pattern. "quick\s(brown).+?(jumps)" examples finding successive matches if your regular expression uses the "g" flag, you can use the exec() method multiple times to find successive matches i...
... myre.lastindex; console.log(msg); } this script displays the following text: found abb. next match starts at 3 found ab. next match starts at 9 warning: do not place the regular expression literal (or regexp constructor) within the while condition! it will create an infinite loop if there is a match, due to the lastindex property being reset upon each iteration. also, be sure that the
global flag ("g") is set, or it will also cause an infinite loop. using exec() with regexp literals you can also use exec() without creating a regexp object explicitly: let matches = /(hello \s+)/.exec('this is a hello world!'); console.log(matches[1]); this will log a message containing 'hello world!'. specifications specification ecmascript (ecma-262)the definition of 're...
String.prototype.match() - JavaScript
a pull request. syntax str.match(regexp) parameters regexp a regular expression object. if regexp is a non-regexp object, it is implicitly converted to a regexp by using new regexp(regexp). if you don't give any parameter and use the match() method directly, you will get an array with an empty string: [""]. return value an array whose contents depend on the presence or absence of the
global (g) flag, or null if no matches are found. if the g flag is used, all results matching the complete regular expression will be returned, but capturing groups will not. if the g flag is not used, only the first complete match and its related capturing groups are returned. in this case, the returned item will have additional properties as described below. additional properties as explained a...
...put a copy of the search string. description if the regular expression does not include the g flag, str.match() will return the same result as regexp.exec(). other methods if you need to know if a string matches a regular expression regexp, use regexp.test(). if you only want the first match found, you might want to use regexp.exec() instead. if you want to obtain capture groups and the
global flag is set, you need to use regexp.exec() or string.prototype.matchall() instead. examples using match() in the following example, match() is used to find 'chapter' followed by 1 or more numeric characters followed by a decimal point and numeric character 0 or more times. the regular expression includes the i flag so that upper/lower case differences will be ignored. const str = 'for more ...
...// '.1', // index: 22, // input: 'for more information, see chapter 3.4.5.1' ] // 'see chapter 3.4.5.1' is the whole match. // 'chapter 3.4.5.1' was captured by '(chapter \d+(\.\d)*)'. // '.1' was the last value captured by '(\.\d)'. // the 'index' property (22) is the zero-based index of the whole match. // the 'input' property is the original string that was parsed. using
global and ignore case flags with match() the following example demonstrates the use of the
global and ignore case flags with match(). all letters a through e and a through e are returned, each its own element in the array. const str = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'; const regexp = /[a-e]/gi; const matches_array = str.match(regexp); console.log(matches_array); // ['a', 'b', 'c...
String.prototype.replace() - JavaScript
substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with some or all matches of a pattern replaced by a replacement. description this method does not change the calling string object. it simply returns a new string. to perform a
global search and replace, include the g switch in the regular expression. specifying a string as a parameter the replacement string can include the following special replacement patterns: pattern inserts $$ inserts a "$". $& inserts the matched substring. $` inserts the portion of the string that precedes the matched substring. $' inser...
...second parameter. in this case, the function will be invoked after the match has been performed. the function's result (return value) will be used as the replacement string. (note: the above-mentioned special replacement patterns do not apply in this case.) note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is
global. the arguments to the function are as follows: possible name supplied value match the matched substring. (corresponds to $& above.) p1, p2, ... the nth string found by a parenthesized capture group (including named capturing groups), provided the first argument to replace() was a regexp object. (corresponds to $1, $2, etc. above.) for example, if /(\a+)(\...
...eplace() in the following example, the regular expression is defined in replace() and includes the ignore case flag. let str = 'twas the night before xmas...'; let newstr = str.replace(/xmas/i, 'christmas'); console.log(newstr); // twas the night before christmas... this logs 'twas the night before christmas...'. note: see this guide for more explanations about regular expressions. using
global and ignore with replace()
global replace can only be done with a regular expression. in the following example, the regular expression includes the
global and ignore case flags which permits replace() to replace each occurrence of 'apples' in the string with 'oranges'. let re = /apples/gi; let str = 'apples are round, and apples are juicy.'; let newstr = str.replace(re, 'oranges'); console.log(n...
String.prototype.replaceAll() - JavaScript
h match. the original string is left unchanged. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const newstr = str.replaceall(regexp|substr, newsubstr|function) when using a `regexp` you must have to set the
global ("g") flag; otherwise, it will throw a typeerror: "replaceall must be called with a
global regexp". parameters regexp (pattern) a regexp object or literal with the
global flag. the matches are replaced with newsubstr or the value returned by the specified function. a regexp without the
global ("g") flag will throw a typeerror: "replaceall must be called with a
global regexp". substr a str...
...second parameter. in this case, the function will be invoked after the match has been performed. the function's result (return value) will be used as the replacement string. (note: the above-mentioned special replacement patterns do not apply in this case.) note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is
global. the arguments to the function are as follows: possible name supplied value match the matched substring. (corresponds to $& above.) p1, p2, ... the nth string found by a parenthesized capture group, provided the first argument to replace() was a regexp object. (corresponds to $1, $2, etc. above.) for example, if /(\a+)(\b+)/, was given, p1 is the match fo...
...(for example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string the whole string being examined. (the exact number of arguments depends on whether the first argument is a regexp object—and, if so, how many parenthesized submatches it specifies.) examples using replaceall 'aabbcc'.replaceall('b', '.'); // 'aa..cc' non-
global regex throws when using a regular expression search value, it must be
global. this won't work: 'aabbcc'.replaceall(/b/, '.'); typeerror: replaceall must be called with a
global regexp this will work: 'aabbcc'.replaceall(/b/g, '.'); "aa..cc" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.replaceall' in that specification. ...
Symbol.keyFor() - JavaScript
the symbol.keyfor(sym) method retrieves a shared symbol key from the
global symbol registry for the given symbol. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.keyfor(sym); parameters sym symbol, required. the symbol to find a key for. return value a string representing the key for the given symbol if one is found on the
global registry; otherwise, undefined. ...
...u'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.keyfor(sym); parameters sym symbol, required. the symbol to find a key for. return value a string representing the key for the given symbol if one is found on the
global registry; otherwise, undefined. ...
...les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.keyfor(sym); parameters sym symbol, required. the symbol to find a key for. return value a string representing the key for the given symbol if one is found on the
global registry; otherwise, undefined. examples using keyfor var
globalsym = symbol.for('foo'); // create a new
global symbol symbol.keyfor(
globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); // undefined // well-known symbols are not symbols registered // in the
global symbol registry symbol.keyfor(symbol.iterator) // undefined specifications specification ecmascript (ecma-262)the definition of 'symbol.keyfor' in that specification. ...
Symbol - JavaScript
every symbol value returned from symbol() is unique. ...
... symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number). if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo') typeof sym // "symbol" let symobj = object(sym) typeof symobj // "object" shared symbols in the
global symbol 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 meth...
...ng value used for the default description of an object. used by object.prototype.tostring(). symbol.unscopables an object value of whose own and inherited property names are excluded from the with environment bindings of the associated object. static methods symbol.for(key) searches for existing symbols with the given key and returns it if found. otherwise a new symbol gets created in the
global symbol registry with key. symbol.keyfor(sym) retrieves a shared symbol key from the
global symbol registry for the given symbol. instance properties symbol.prototype.description a read-only string containing the description of the symbol. instance methods symbol.prototype.tosource() returns a string containing the source of the symbol object. overrides the object.prototype.tosource(...
<desc> - SVG: Scalable Vector Graphics
id for reference. ...
... html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <circle cx="5" cy="5" r="4"> <desc> i'm a circle and that description is here to demonstrate how i can be described, but is it really necessary to describe a simple circle like me? ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the de...
<g> - SVG: Scalable Vector Graphics
ultiple elements to be referenced later with the <use> element. ...
... be referenced later with the <use> element. ...
...ill="white" stroke="green" stroke-width="5"> <circle cx="40" cy="40" r="25" /> <circle cx="60" cy="60" r="25" /> </g> </svg> attributes this element only includes
global attributes
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, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vecto...
Communicating using "port" - Archive of obsolete content
ntentscript }); worker.port.emit("alert", "message from the add-on"); }); tabs.open("http://www.mozilla.org"); in total, the port object defines four functions: emit(): emit a message. on(): listen to a message. removelistener(): stop listening to a message. once(): listen to only the first occurrence of a message. accessing port accessing port in the content script note that the
global self object is completely different from the self module, which provides an api for an add-on to access its data files and id. in the content script the port object is available as a property of the
global self object. thus, to emit a message from a content script: self.port.emit("mycontentscriptmessage", mycontentscriptmessagepayload); to receive a message from the add-on code: self.port.on...
...criptmessagepayload); to receive a message from the add-on code: self.port.on("myaddonmessage", function(myaddonmessagepayload) { // handle the message }); compare this to the technique used to receive built-in messages in the content script. for example, to receive the context message in a content script associated with a context menu object, you would call the on function attached to the
global self object: self.on("context", function() { // handle the message }); so the port property is essentially used here as a namespace for user-defined messages. accessing port in the add-on script in the add-on code, the channel of communication between the add-on and a particular content script context is encapsulated by the worker object. thus the port object for communicating with a conte...
Two Types of Scripts - Archive of obsolete content
lename. if they are stored in separate files you should store them under the data directory under your add-on's root. to learn all about content scripts read the working with content scripts guide. api access for add-on code and content scripts the table below summarizes the apis that are available to each type of script. api add-on code content script the
global objects defined in the core javascript language, such as math, array, and json. see the reference at mdn. ✔ ✔ the require() and exports
globals defined by version 1.0 of the commonjs module specification. you use require() to import functionality from another module, and exports to export functionality from your module. if require() is available, then so are the module...
...math, array, and json. see the reference at mdn. ✔ ✔ the require() and exports
globals defined by version 1.0 of the commonjs module specification. you use require() to import functionality from another module, and exports to export functionality from your module. if require() is available, then so are the modules supplied in the sdk. ✔ ✘ the console
global supplied by the sdk. ✔ ✔
globals defined by the html5 specification, such as window, document, and localstorage. ✘ ✔ the self
global, used for communicating between content scripts and add-on code. see the guide to communicating with content scripts for more details. ✘ ✔ ...
context-menu - Archive of obsolete content
), cm.item({ label: "item 2", data: "item2" }), cm.item({ label: "item 3", data: "item3" }) ] }); communicating with the add-on often you will need to collect some kind of information in the click listener and perform an action unrelated to content. to communicate to the menu item associated with the content script, the content script can call the postmessage function attached to the
global self object, passing it some json-able data. the menu item's "message" event listener will be called with that data. var cm = require("sdk/context-menu"); cm.item({ label: "edit image", context: cm.selectorcontext("img"), contentscript: 'self.on("click", function (node, data) {' + ' self.postmessage(node.src);' + '});', onmessage: function (imgsrc) { ...
... parameters options : object required options: name type label string the item's label. it must either be a string or an object that implements tostring(). optional options: name type image string the i...
page-mod - Archive of obsolete content
icon: . private windows if your add-on has not opted into private browsing, then your page-mods will not attach content scripts to documents loaded into private windows, even if their urls match the pattern you have specified. 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.
globals constructors pagemod(options) creates a page-mod. parameters options : object required options: name: include type: string, regexp, or array of (string or regexp) a match pattern string or an array of match pattern strings. these define the documents to which the page-mod applies. at least one match pattern must be supplied. you can specify a url exactly: var pagemod = require("sdk/...
...ple/", contentscript: 'window.alert("page matches ruleset");' }); you can specify a number of wildcard forms, for example: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'window.alert("matched!");' }); you can specify a set of urls using a regular expression. the pattern must match the entire url, not just a subset, and has
global, ignorecase, and multiline disabled. var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: /.*developer.*/, contentscript: 'window.alert("matched!");' }); to specify multiple patterns, pass an array of match patterns: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: ["*.foo.org", "*.bar.com"], contentscript: 'window.alert("matched!");' }); see th...
simple-prefs - Archive of obsolete content
the add-on manager. you can also see them and change them programmatically using the prefs property, and listen for changes to a preference using on(). simple-prefs in the preferences system preferences defined using simple-prefs are stored in the firefox preferences system alongside all the other preferences. this means that they're visible in about:config, and they can be accessed using the
global simple-preferences module. by default, simple preferences are stored in a preference like: extensions.<addon-id>.<preference-name> for example, if you had a simple-pref named "somepreference" then you could get its value like so: require('sdk/preferences/service').get(['extensions', require('sdk/self').id, 'somepreference'].join('.')) this would give you the same value as: require('sdk/simpl...
...e ability to change the default preferences branch is new in add-on sdk 1.15. the branch of the preferences tree under which simple-prefs are stored is, by default, the add-on id. sometimes you might need to use a different branch, especially if you are porting an add-on to the sdk. you can change the sub-branch of extensions using the preferences-branch key in your add-on's package.json file.
globals functions on(prefname, listener) registers an event listener that will be called when a preference is changed. the event listener may take an optional parameter that specifies the name of the property which changed. preference change events are triggered for every character typed by the user. they are also triggered once during add-on initialization. example: function onprefchange(prefn...
ui/sidebar - Archive of obsolete content
n update the sidebar's content by setting the sidebar's url property. this will change the sidebar's content across all windows. communicating with sidebar scripts you can't directly access your sidebar's content from your main add-on code, but you can send messages between your main add-on code and scripts loaded into your sidebar. on the sidebar end of the conversation, sidebar scripts get a
global variable addon that contains a port for sending and receiving messages. on the add-on side, you need to get a worker object for the sidebar before you can send or receive messages. there are two events emitted by the sidebar which will give you a worker: attach and ready. listen to attach if the first message in your add-on goes from the sidebar scripts to the main add-on code, and listen to rea...
...dy: function (worker) { worker.port.emit("ping"); worker.port.on("pong", function() { console.log("add-on script got the reply"); }); } }); try running the add-on, and showing the sidebar using the "view->sidebar->my sidebar" menu item. you should see console output like: console.log: add-on: sidebar script got the message console.log: add-on: add-on script got the reply
globals constructors sidebar(options) creates a sidebar. var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html"), onattach: function (worker) { console.log("attaching"); }, onshow: function () { console.log("showing"); }, onhide: function () { console.log("hiding"); }, ondetach: functio...
util/match-pattern - Archive of obsolete content
ttern } = require("sdk/util/match-pattern"); var pattern = new matchpattern(/.*example.*/); the regular expression is subject to restrictions based on those applied to the html5 pattern attribute. in particular: the pattern must match the entire value, not just any subset. for example, the pattern /moz.*/ will not match the url http://mozilla.org. the expression is compiled with the
global, ignorecase, and multiline flags disabled. the matchpattern constructor will throw an exception if you try to set any of these flags. example pattern example matching urls example non-matching urls /.*moz.*/ http://foo.mozilla.org/ http://mozilla.org https://mozilla.org http://foo.com/mozilla http://hemozoon.org mozscheme://foo.org http://foo.
... parameters pattern : string the pattern to use. see patterns above. matchpattern methods test(url) tests a url against the match pattern. parameters url : string the url to test. returns boolean : true if the url matches the pattern and false otherwise. ...
console - Archive of obsolete content
defaults to "error". there are two system preferences that can be used to override this default: extensions.sdk.console.loglevel: if set, this determines the logging level for all installed sdk-based add-ons. extensions.extensionid.sdk.console.loglevel, where extensionid is an add-on's program id. if set, this determines the logging level for the specified add-on. ...
...this means that calls to console.log() will appear in the console output. when you install an add-on into firefox, the logging level will be "error" by default (that is, unless you have set one of the two preferences). ...
Modifying Web Pages Based on URL - Archive of obsolete content
site. the script must be loaded from data. communicating with the content script your add-on script and content scripts can't directly access each other's variables or call each other's functions, but they can send each other messages. to send a message from one side to the other, sender calls port.emit() and receiver listens using port.on(). ...
...self.port.on("replacepage", function(message) { document.body.innerhtml = "<h1>" + message + "</h1>"; }); in the add-on script, we'll send the content script a message inside onattach. ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
f.data.url('second.js')] }); } }); communicating with the content scripts your add-on script and content scripts can't directly access each other's variables or call each other's functions, but they can send each other messages. to send a message from one side to the other, sender calls port.emit() and receiver listens using port.on(). ...
... receiver listens using port.on(). in the content script, port is a property of the
global self object. in the add-on script, tab.attach() returns a worker object containing the port property you use to send messages to the content script. let's rewrite the example above to pass a message from the add-on to the content script. ...
Dialogs and Prompts - Archive of obsolete content
sc and more), which is good for keyboard accessibility. add ok and cancel buttons in an order that is consistent with os default (but the button set and layout is highly customizable, see below). simple dialog code the following xul code defines a simple dialog with two buttons, ok and cancel (buttons="accept,cancel" attribute on dialog). <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/
global.css" type="text/css"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="..." title="..." buttons="accept,cancel" ondialogaccept="return onaccept();" ondialogcancel="return oncancel();"> <script src="chrome://..."/> <!-- content --> </dialog> you need to implement onaccept and oncancel functions in your script. if they return anything but false...
...ribute to them. valid values for dlgtype are the six button types listed above. be sure to use ondialog* attributes on dialog element instead of putting oncommand on the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too. ...
Post data to window - Archive of obsolete content
this offers examples of sending post data to the server and displaying the server response. need more elaborate examples, examples of displaying the response in a new tab, in background tabs, and a link to using xmlhttprequest for post requests. preprocessing post data the apostdata argument of the (
global) loaduri(), opendialog(), and (tab)browser.loaduriwithflags() methods expects the post data in the form of an nsiinputstream (because they eventually call nsiwebnavigation.loaduri()) while post data can be created using nsimimeinputstream. most of the time, post data starts as a data string in the form of "name1=data1&name2=data2&...", so you must convert it before passing the data to one of the methods. here is an example: var datastring = "name1=data1&name2=data2"; // post method reque...
...string.length); var postdata = cc["@mozilla.org/network/mime-input-stream;1"]. ...
StringView - Archive of obsolete content
ns (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats). javascript typed arrays provide a mechanism for accessing raw binary data much more efficiently. the stringview constructor is one level above typed arrays. ...
... is rappresented by a collection of 1-6 uint8 elements for utf-8, 1-2 uint16 elements for utf-16, 1 uint32 element for ucs4, 1 uint8 element for ascii, or something else. byte a collection of 8 bits. null codepoint the character whose codepoint is equal to 0 ('\0'). notes when you include the script stringview.js into a page, no variables other than stringview itself will be added to the
global scope. stringview is a highly extensible library, that anyone can extend by adding methods to the object stringview.prototype. for example, imagine you want to create a method similar to string.replace(), but for stringview objects. maybe you would like to solve a situation like the following: var omystringview = new stringview("hello, strange people!"); // utf-8 var omyregexp = ne...
View Source for XUL Applications - Archive of obsolete content
method overview gviewsourceutils exposes several methods, but the only one you should be using directly is the viewsource method. ...
... method overview gviewsourceutils exposes several methods, but the only one you should be using directly is the viewsource method. ...
Custom about: URLs - Archive of obsolete content
about page for bootstrapped addons. this example creates an about page with url about:myaboutpage which takes a user to a page that writes some text out. make sure to generate a unique aboutpage_id, see this page to learn more about generating uuid's: uuid. it is imported to queryinterface the components.manager otherwise this will not work. this example can be easily modified, just modify the
global const at in the //
globals section. in bug 1254752 things changed for firefox 48 and up. services.io.newchannel was deprecated, and the signature of the newchannel method changed. this change is reflected in the code below. this code will work for all versions of firefox 4 and up. const {classes: cc, interfaces: ci, manager: cm, results: cr, utils: cu, constructor: cc} = components; cm.query...
...wchannel was deprecated, and the signature of the newchannel method changed. this change is reflected in the code below. this code will work for all versions of firefox 4 and up. ...
How to convert an overlay extension to restartless - Archive of obsolete content
ated by microsoft, adopted by mozilla and other vendors, and hacked into a swiss army knife of file loading. you can use it in a web page to fetch a file from your server and you can use it in your add-on to fetch a local file from your installation. the name is a vestigial structure that just makes things confusing. it is nonetheless the "correct" and best way to do things. ...
...'}), 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 will function normally without any extra work needed. components.utils.import("resource://gre/modules/services.jsm"); var stylesheets = ["chrome://myextension/skin/mystylesheet.css"]; function star...
Jetpack Processes - Archive of obsolete content
rent chrome process are the only means by which they can be endowed with any real power. note: the above statement is not currently true, as js-ctypes is now provided to jetpack processes as of bug 588563. a mechanism to optionally disable this feature has been proposed in bug 614351. privileged apis when script is evaluated in a jetpack process via a call to nsijetpack.evalscript(), the script's
global scope is endowed with the following privileged apis: sendmessage(amessagename [, v1 [, v2 [, ...]]]) similar to nsijetpack.sendmessage(), this function asynchronously sends a message to the chrome process. callmessage(amessagename [, v1 [, v2 [, ...]]]) this function is like sendmessage() but sends the message synchronously. it returns an array whose elements are the return values of each receiv...
...function unregisters a callback previously registered with registerreceiver(). unregisterreceivers(amessagename) similar to nsijetpack.unregisterreceivers(), this function unregisters all callbacks for the 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...
Updating addons broken by private browsing changes - Archive of obsolete content
r the identity is classified as private. nsistricttransportsecurityservice: processstsheader, removestsstate, isstshost, and isstsuri now take a flags parameter that understands nsisocketprovider.no_permanent_storage or nothing. nsiprivatebrowsingservice: this service is deprecated, and as of firefox 20 it is now an empty interface. if your code depends on this interface, it will break. the
global private browsing service is actively being removed, and may not even exist as of firefox 21. nsirecentbadcertsservice: this is no longer a
global service, and has been renamed to nsirecentbadcerts. to obtain this, acquire the nsix509certdb service, and use the new getrecentbadcerts method, passing a boolean indicating whether the private bad certificates or public ones are desired. observer not...
...recentbadcerts method, passing a boolean indicating whether the private bad certificates or public ones are desired. observer notifications 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. ...
JXON - Archive of obsolete content
s jxon could represent the most practical way. in this article we will show how to convert a parsed xml document (i.e. an instance of document) to a javascript object tree (i.e. a tree of nested instances of object) and viceversa, with some different algorithms. it could be useful to read the xml introduction article first. if you want a complete bidirectional jxon library (modelled on the json
global object), skip to the dedicated paragraph (but please read the note about the const statement compatibility). note: if you are interested to address only some parts of an xml document (and are not starting in javascript/json for templating purposes), use xpath instead of converting the whole document into json. conversion snippets now imagine you have this sample xml document: example.xml <?x...
...ternet explorer 10. const is going to be defined by ecmascript 6, but with different semantics. similar to variables declared with the let statement, constants declared with const will be block-scoped. we used it only for didactic purpose. if you want a full browser compatibility of this library, please replace all the const statements with the var statements. usage the obtained non-native jxon
global object will have two methods: method description jxon.build(document[, verbosity[, freeze[, nesteattributes]]]) returns a javascript object based on the given xml document. jxon.unbuild(objtree[, namespaceuri[, qualifiednamestr[, documenttype]]]) returns an xml document based on the given javascript object. these methods are inverses of each other. so, ...
List of Mozilla-Based Applications - Archive of obsolete content
l parser used in the platform is based on mozilla code fennec browser for mobiles as mark notes: fennec is not firefox, it’s a completely different application findthatfont! ...
...onchild productions, creator of the pale moon web browser flickr uploadr image upload tool see flickr uploadr: open source and powered by xulrunner foxkeh clock clock frizione javascript development, testing and deployment environment uses mozilla rhino geckofx embeddable gecko gjs javascript bindings for gnome
globalmojo browser that raises money for your favorite causes gluescript a javascript engine which can be used as a general purpose language uses mozilla spidermonkey and formerly called wxjavascript gnome operating system gnome 3 will use spidermonkey through gjs google adwords editor editor google gadgets for linux google’s desktop wid...
Notes on HTML Reflow - Archive of obsolete content
onstraints has occurred. stylechange, when the entire frame hierarchy must be traversed to recover from stylistic change; for example, a change in the default font size. dirty, when a container frame has consolidated several individual incremental reflows that have been targeted at its child frames. initial, incremental, resize, and style change reflows may each be performed as an immediate "
global" reflow from the presentation shell: an initial reflow is performed when the presentation shell is initialized to flow the shell's initial frame hierarchy. incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asynchronously serviced. a resize reflow is performed when the presentation shell's dimensions change; e.g., because th...
... initialized to flow the shell's initial frame hierarchy. incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asynchronously serviced. a resize reflow is performed when the presentation shell's dimensions change; e.g., because the user resized the shell's window. a style change reflow is performed when the presentation shell's
global stylistic information is changed; e.g., addition or removal of a style sheet, a change to the shell's default font. a dirty reflow is never performed directly from the presentation shell. instead, a dirty reflow is detected when an incremental reflow reaches its target frame , described below. reflow metrics the reflow metrics object, nshtmlreflowmetrics, is used to propagate i...
contents.rdf - Archive of obsolete content
state that we work only with major version 1 of this package. --> <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:communicator"/> <...
...me:packages> </rdf:description> <!-- version information. state that we work only with major version 1 of this package. ...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
se the javascript wrapper for drag and drop. the javascript drag and drop wrapper the javascript wrapper to drag and drop simplifies the process by handling all of the xpcom interfaces for you. it works by providing an object which implements the event handlers. all you have to do is write some simpler functions which work with the data being dragged. this drag and drop interface is stored in the
global package, in the file chrome://
global/content/nsdraganddrop.js. you can include this file in your xul file with the script tag in the same way you would include your own scripts. the library also depends on another script library, which you should also include, usually at the top of your xul file. you can look at the contents of these files to see how drag and drop is done at a lower level. note t...
...l file with the script tag in the same way you would include your own scripts. the library also depends on another script library, which you should also include, usually at the top of your xul file. you can look at the contents of these files to see how drag and drop is done at a lower level. note that you can only use these libraries from within xul loaded via a chrome url. <script src="chrome://
global/content/nsdraganddrop.js" /> <script src="chrome://
global/content/nstransferable.js" /> this drag and drop library creates an object stored in the variable nsdraganddrop. the object contains a series of functions, one for each event handler (except for dragenter where it has nothing special to do). each of the functions takes two parameters, the first is the event object and the second is an obs...
GRE Registration - Archive of obsolete content
grehome=c:\path\to\installed-dir feature=value feature2=value2 hklm/software/mozilla.org/gre/1.8_2 version=1.8 grehome=c:\path\to\second-installation when installing a gre via the mozilla suite gre installer, the installer will blindly overwrite any previous gre information in hklm/software/mozilla.org/gre/<version>. when installing a gre via the command line <tt>xulrunner.exe -register-
global</tt>, xulrunner will detect that there is already an installation at hklm/software/mozilla.org/gre/<version> and will try alternate keys <version>_1 _2 until an available key is found. mac on mac, the only gre is the libxul framework xul.framework. this framework is installed either in /library/frameworks/xul.framework/versions/<version> or in ~/library/frameworks/xul.framework/versions/<versi...
... in any of the following locations: /etc/gre.conf /etc/gre.d/*.conf ~/.gre.conf ~/.gre.d/*.conf mozilla has never officially shipped a linux gre based on the mozilla suite. however, some linux distributors including red hat/fedora core ship /etc/gre.d/*.conf files with the mozilla suite rpms. xulrunner rpms/post-install scripts should register xulrunner as a gre by running <tt>xulrunner -register-
global</tt> and not hand-create a .conf file. the <tt>-register-
global</tt> flag has special fallback semantics so that multiple xulrunners of the same version can be installed without overwriting registration files. ...
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. ...
...size_t fd (unix only) negativeone_or_fd (unix only) negativeone_or_nothing (unix only) string (unix only) null_or_string (unix only) handle (windows only) maybe_handle (windows only) dword (windows only) negative_or_dword (windows only) zero_or_dword (windows only) zero_or_nothing (windows only) declareffi() intn_t() uintn_t()instances of os.shared.type convert_from_c() releasewith() attributes
global object os.shared.hollowstructure in_ptr out_ptr inout_ptr ...
Modularization techniques - Archive of obsolete content
emphasis. there really aren't that many. ...
...parameters. if a function changes the value of an interface in-out parameter, it should call release() on the interface passed in and addref() on the interface passed out. nsresult refreshfoo(ifoo **afoo) { if (afoo == null || *afoo == null) { return ns_error_null_parameter; } if ((*afoo)->stale()) { ns_release(*afoo); *afoo = mfoo; ns_addref(*afoo); } return ns_ok; }
global and member variables both
global and member variables have lifetimes that can be changed by any number of functions. therefore one should call addref() on any
global or member variable that is being passed to a function, and call release() afterward. ns_addref(mfoo); tweekfoo(mfoo); ns_release(mfoo); (soon to be) frequently asked questions why are we mimicking com? doesn't com suck? you're ...
Running Tamarin performance tests - Archive of obsolete content
he percentage of the mean 95% of the results were within the range. ...
...t options there are a variety of options available with runtests.py - here is the help text followed by explanations for some options: $ ./runtests.py -h usage: runtests.py [options] [tests] -v --verbose enable additional output -e --avm avmplus command to use -a --asc compiler to use -g --
globalabc deprecated but still works - use builtin.abc (used to be location of
global.abc) -b --builtinabc location of builtin.abc -s --shellabc location of shell_toplevel.abc -x --exclude comma separated list of directories to skip -h --help display help and exit -t --notime do not generate timestamps (cleaner diffs) -f --forcerebuild force rebuild all test files -c --config sets the config string [default os-tvm] -q --quiet display m...
XPJS Components Proposal - Archive of obsolete content
e native module - called the xpjsmanager - which holds this system together. the xpjsmanager is in charge of loading these .js files, helping them register themselves, and acting as an intermediary between the xpcom component manager and the js code. xjs components are not run in browser windows. each .js file (let's call it a module) is started up and run in the context of a relatively 'raw' js
global object. the standard (non-dom) js classes will be available. the xpconnectcomponents object will be available. and some additional yet to be defined objects may be available. the xpconnectcomponents object allows access to the whole repository of native and js xpcom components, so this is not as isolated an environment as it might at first sound. a 'load' or 'import' function will also be provid...
... js universe]. in c if a module gets unloaded when there are still references to objects created by the module then a crash is likely to happen soon after. js does not have this problem. if the xpjsmanager is asked to trim itself back (by whatever means) it will call the nscanunload method (if present) on each module. it the module oks it then the xpjsmanager will release its root of the module's
global object and release any hold over the objects in the module. any subsequent requests from the component manager that would result in nsgetfactory calls into the module will force the xpjsmanager to load up a new instance of the .js file and start over. so, these xpjs component modules are safely unloadable, but have the power (like native modules) to veto any attempt. so when will it be ready? i...
onchange - Archive of obsolete content
e event change. ...
... radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things:
global values/functions i.e. ...
treecol.type - Archive of obsolete content
lls. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked) { /* checked checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x so you should specify a url to an image in your extension or elsewhere. ...
...y a url to an image in your extension or elsewhere. */ list-style-image: url("chrome://
global/skin/checkbox/cbox-check.gif"); } treechildren::-moz-tree-checkbox(disabled) { /* disabled checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x, so you should specify a url to an image in your extension or elsewhere. ...
Introduction to XUL - Archive of obsolete content
there must always be associated stylesheets. mozilla includes a standard stylesheet, "xul.css". you can load as many style sheets as you wish using repeated processing directives, although you should always make sure to load the xul.css file initially. and finally, any namespaces used in the document must be declared. so a xul file will begin <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/xul.css" type="text/css"?> <!doctype window> <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> the html namespace is of course the standard one. the xul namespace is obviously a temporary one, but at least serves to explain the pronunciation. note that the above example is using an implicit xul namespace. this is opti...
...area. the menu bar has a menu, file, with a single menu item that dumps "hello world!" to the debug console when selected. the content area will display the contents of the file contentframe.html. this code introduces several concepts useful for creating real world windows not explicitly covered in this document. follow the links for details. ...
Textbox (XPFE autocomplete) - Archive of obsolete content
e event change. ...
... radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things:
global values/functions i.e. ...
Anonymous Content - Archive of obsolete content
the menupopup will be added to the content in the location specified by the children element. note that to dom functions, the content will appear as it was in the xul file, so the menupopup will be a child of the menu. the xbl content is hidden away so the xul developer doesn't need to...
... that to dom functions, the content will appear as it was in the xul file, so the menupopup will be a child of the menu. the xbl content is hidden away so the xul developer doesn't need to even know it is there. the resulting content would be: <menu class="dropbox"> <menupopup> <menuitem label="1000"/> <menuitem label="2000"/> </menupopup> <textbox flex="1"/> <button src="chrome://
global/skin/images/dropbox.jpg"/> </menu> includes attribute in some cases, you may wish to only include specific types of content and not others. or, you may wish to place different types of content in different places. the includes attribute can be used to allow only certain elements to appear in the content. its value should be set to a single tag name, or to a list of tags separated by vertical bar...
Element Positioning - Archive of obsolete content
ple 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. 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...
...tion. as with the pack attribute, the align attribute applies to the box containing the elements to be aligned, not to the elements themselves. for example, the first box below will have its children stretch, because that is the default. the second box has an align attribute, so its children will be placed centered. ...
colorpicker - Archive of obsolete content
e event change. ...
... radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things:
global values/functions i.e. ...
command - Archive of obsolete content
ste 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. using this function has the advantage that the command will be sent to the part of the ui which will respond to it. typically, this will be the currently focused element. like a broadcaster, commands forward attributes to other elements. more information is available in the xul tutorial...
...cally, this will be the currently focused element. like a broadcaster, commands forward attributes to other elements. more information is available in the xul tutorial. see also: command attribute, commandset element attributes disabled, label, oncommand,reserved examples the following code will send a paste command (cmd_paste) to the currently focused element: // first include chrome://
global/content/
globaloverlay.js godocommand("cmd_paste"); example with two buttons <commandset><command id="cmd_openhelp" oncommand="alert('help');"/></commandset> <button label="help" command="cmd_openhelp"/> <button label="more help" command="cmd_openhelp"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disable...
dialogheader - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a heading row for a dialog box. this element should be placed inside a dialog element. the header may have a title and a description. ...
... « xul reference home [ examples | attributes | properties | methods | related ] a heading row for a dialog box. this element should be placed inside a dialog element. the header may have a title and a description. ...
notificationbox - Archive of obsolete content
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. finding the current notification box within a firefox extension, you can retrieve the current notification box for a specific tab by calling the
global function getnotificationbox(): notifybox = chromewin.getnotificationbox(notifywindow) notifybox = getnotificationbox(notifywindow) // applies to current context's window object here, chromewin is the xul window (usually just window), and notifywindow is the 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 a...
...ficationbox(): notifybox = chromewin.getnotificationbox(notifywindow) notifybox = getnotificationbox(notifywindow) // applies to current context's window object here, chromewin is the xul window (usually just window), and notifywindow is the 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. properties currentnotification, allnotifications, notificationshidden methods appendnotification, getnotificationwithvalue, removeallnotifications, remov...
preference - Archive of obsolete content
e event change. ...
... radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things:
global values/functions i.e. ...
treecol - Archive of obsolete content
/treerow> </treeitem> </treechildren> </tree> to make the checkbox visible on some platforms, the following styles need to be added to the stylesheet (see treecol.type). on firefox 2.x and 3.x, all operating systems other than mac os x already use these styles by default. if targeting firefox for mac os x, be sure to use these styles but include your own checkbox image. however, chrome://
global/skin/checkbox/cbox-check.gif is available in seamonkey on mac os x.. treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked){ /* css for checked cells. cbox-check.gif isn't available in firefox 1, 2, and 3...
...x treecells. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked){ /* css for checked cells. cbox-check.gif isn't available in firefox 1, 2, and 3 on mac os x, so you should specify a url to an image in your extension or elsewhere. */ list-style-image: url("chrome://
global/skin/checkbox/cbox-check.gif"); } for example: create a css file. copy and paste the code above and link the css file to your xul file. reload the page to see the checkbox. if you want, you can also style the tree using css. attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on...
window - Archive of obsolete content
atform-specific frame around it. to set an icon for the window, create a platform-specific icon file <windowid>.ico and/or <windowid>.xpm and place or install these files into the <mozilla-directory>/chrome/icons/default/ directory. the <windowid> is the value of the id attribute on the window. this allows you to have a different icon for each window. without including the css file at "chrome://
global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog. note: starting in gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events. see window activation events. more information is available in the xul tutorial. attributes accelerated, chromemargin, disablechrome, disablefastfin...
... "deactivate" events. see window activation events. more information is available in the xul tutorial. ...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the zip file to a new directory using a archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\1.8.0.1 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.1.en-us.linux-i686.tar.gz. the following directory is recommended: /opt/xulrunner/1.8.0.1 . register xulrunner with the system by running xulrun...
...or all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.1.en-us.linux-i686.tar.gz. the following directory is recommended: /opt/xulrunner/1.8.0.1 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner windows/linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. mac os x if you have multiple versions of xulrunner ins...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
s, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the zip file to a new directory using an archive tool (7zip is recommended). the following directory is recommended: c:\program files\mozilla xulrunner\1.9.2 . to register xulrunner with the system, open a command prompt and run xulrunner.exe --register-
global (to register for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-3.6.26.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9.2 . register xulrunner with the system by running xulrunner --re...
...gister for all users) or xulrunner.exe --register-user (to register for one user only). mac os x open the .pkg file within the installer and follow the directions. linux unpack the tarball to a new directory using tar -xjf xulrunner-3.6.26.en-us.linux-i686.tar.bz2. the following directory is recommended: /opt/xulrunner/1.9.2 . register xulrunner with the system by running xulrunner --register-
global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). uninstalling xulrunner linux from a command prompt, run xulrunner --unregister-
global or xulrunner --unregister-user to unregister xulrunner just as you registered it during installation. remove the xulrunner directory. windows from a command prompt, run xulrunner.exe --unregister-glob...
Windows and menus in XULRunner - Archive of obsolete content
="&file.save;" oncommand="dofilesave();"/> </commandset> ... <menuitem command="cmd_open"/> <menuitem command="cmd_save"/> ... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ... we can add images to the toolbar buttons through the css file. we could hard-code the images in the xul file itself, but css is a better practice. ...
...n"/> <menuitem command="cmd_save"/> ... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ... we can add images to the toolbar buttons through the css file. we could hard-code the images in the xul file itself, but css is a better practice. here’s the css file: /*
global skin --------------------------------------------------- */ @import url(chrome://
global/skin/); /* toolbar ------------------------------------------------------- */ #open { list-style-image: url(chrome://basicapp/skin/open.png); -moz-box-orient: vertical; } #save { list-style-image: url(chrome://basicapp/skin/save.png); -moz-box-orient: vertical; } of course, you need to make sure the png files are included in the application. there are quite a few things xul offers fo...
contents.rdf - Archive of obsolete content
state that we work only with major version 1 of this package. --> <rdf:description chrome:skinversion="1.5" about="urn:mozilla:skin:my_theme:browser"/> <rdf:description chrome:ski...
...q> </chrome:packages> </rdf:description> <!-- version information. state that we work only with major version 1 of this package. ...
Theme changes in Firefox 3.5 - Archive of obsolete content
r.xml, xulscrollbars.css the <gripper> element was removed from the scrollbar thumb button by bug 448704. for the windows and linux native default themes, the gripper is now drawn as a part of the background of the scrollbar thumb widget. third-party themes can still draw a gripper for the scrollbar thumb button by applying a centered background image to the scrollbar's thumb button.
global/checkbox.css,
global/radio.css since bug 394892, radio buttons and checkboxes no longer have a minimum size on mac os x. if your theme uses native checkboxes or radiobuttons (-moz-appearance: radio / checkbox), this can result in distorted controls. you might have to set the width and height of .checkbox-check and .radio-check to 16px to avoid that problem. look at the patch to see what was ch...
...window element of browser.xul named browsingmode. the value of this attribute is normal when the private browsing mode is inactive, and private when it's active. this attribute can be used to style different parts of the browser window inside the private browsing mode. see this blog post for an example. supporting 3.5 features video/audio player: controlbar has to be styled (chrome://
global/skin/media/videocontrols.css) shadow effect for disabled text using text-shadow. greying menus of inactive windows: active windows get attribute 'active="true"'. to do this only for 3.5 use a css selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } private browsing: show private browsing state by coloring the url bar, or...
Scratchpad - Archive of obsolete content
g once you've written your code, select the code you want to run. if you don't select anything, all the code in the window will be run. then choose the way you want the code to run using the buttons along the top, using the execute menu, or using the context menu. the code is executed in the scope of the currently selected tab. any variables you declare outside of a function will be added to the
global object for that tab. there are four execution options available. run when you choose the run option, the selected code is executed. this is what you'd use to execute a function or other code that manipulates the content of your page without needing to see the result. inspect the inspect option executes the code just like the run option; however, after the code returns, an object inspector i...
...er as a whole rather than a specific web page. this is useful if you are working on firefox itself or developing add-ons. to do this check "enable chrome and add-on debugging" in the developer tool settings. once you've done this, the environment menu has a browser option; once that's selected, your scope is the entire browser rather than just the page content, as you will see from examining some
globals: window /* [object chromewindow] */ gbrowser /* [object xulelement] */ the scratchpad execution context is set to browser when a snippet file has // -sp-context: browser on the first line. keyboard shortcuts command windows macos linux open the scratchpad shift + f4 shift + f4 shift + f4 run scratchpad code ctrl + r cmd + r ctrl + r ...
Namespaces - Archive of obsolete content
a = <p>some text</p>; default xml namespace = "http://www.mozilla.org/keymaster/gat...re.is.only.xul"; 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" eleme...
...ame 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 similar to qname. namespace differs in its tostring method, and in that it has a prefix property instead of a localname property. for further information on namespaces in e4x, see processing xml with e4x. next is the
global xml object. « previousnext » ...
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
.prototype.padend() (firefox 48) object.getownpropertydescriptors() (firefox 50) async functions async function (firefox 52) async function expression (firefox 52) asyncfunction (firefox 52) await (firefox 52) trailing commas in function parameter lists (firefox 52) ecmascript 2018 spread in object literals and rest parameters (firefox 55) for await...of (firefox 57)
global_objects/sharedarraybuffer (firefox 57, with flags)
global_objects/promise/finally (firefox 58)
global_objects/regexp/dotall (not yet implemented; in other browsers) regexp lookbehind assertions (not yet implemented; in other browsers) regexp unicode property escapes (not yet implemented; in other browsers) regexp named capture groups (not yet implemented; in other browsers) ecmascript 2019...
... es.next this section needs to be updated to reflect current changes. (may 2019) the following features are already implemented, but only available in the firefox nightly channel and not yet included in a draft edition of an ecmascript specification. additions to the arraybuffer object arraybuffer.transfer() (spec) new typedobject objects based on typed objects draft, and exposed via a
global typedobject object, e.g. typedobject.structtype & typedobject.arraytype. this feature is non-standard and not documented. see https://bugzilla.mozilla.org/show_bug.cgi?id=1336740 and https://bugzilla.mozilla.org/show_bug.cgi?id=578700. new shared memory objects sharedarraybuffer atomics ...
background-size - Archive of obsolete content
safari, chrome (webkit) | 4.0, 2.0 (528). but i'm not able and willing spending time for this. remember you have to test yourself, don't trust online references, don't trust webkit | apple | google homepage, they are wrong. don't trust the internet at alll! ] listing konqueror below the table is a compromise for consistency. feel free to put it inside, nothing is set in stone. konqueror's
global market share is 0.05%, (< 5% of linux users). given the 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) inst...
...) start with -webkit-background-size and investigate support of contain and cover keywords and "omitted second value" behavior. [i assume it's the same as safari, since they just backported a webkit patch into khtml. but we need facts, rather than assumptions.] btw, some time ago i'v listed opera in the property template table and removed netscape because netscape is gecko based and opera has a
global market share of > 2% (> 40% in some european countries). user:jürgen jeka 2009-08-04 <hr> is there anyway to have the -moz-border-image only apply if -moz-background-size is not supported? i'm guessing not, just asking because having both rules in for 3.6 creates a strange effect: -moz-border-image gets inherited by every element on the page user:robertc 2009-08-08 -moz-border-image should not...
Popup Window Controls - Archive of obsolete content
up windows without using popup windows. ...
...meout() or setinterval() what popup windows are not suppressed? any attempt to open a popup window that is the direct result of user action, such as clicking on a hyperlink, should succeed in opening popup windows even if the user has popup controls enabled on your site. detecting suppressed popups windows if a user has popup controls enabled for your site, any attempt to call window.open in
global script, in an onload handler or in settimeout() or setinterval() will return null rather than a reference to the opened window. <html> <head> <title>detecting popup controls</title> <script type="text/javascript"> <!-- // attempt to open an unsolicited window var popup = window.open('about:blank', 'popup'); if (!popup) { // the user has suppressed the popup }...
RDF in Mozilla FAQ - Archive of obsolete content
r some directories based on the odp rdf dumps. what is a datasource? rdf can generally be viewed in two ways: either as a graph with nodes and arcs, or as a "soup" of logical statements. a datasource is a subgraph (or collection of statements, depending on your viewpoint) that are for some reason collected together. some examples of datasources that exist today are "browser bookmarks", "browser
global history", "imap mail accounts", "nntp news servers", and "rdf/xml files". in mozilla, datasources can be composed together using the composite data source. this is like overlaying graphs, or merging collections of statements ("microtheories") together. statements about the same rdf resource can then be intermingled: for example, the "last visit date" of a particular website comes from the "brows...
...story", "imap mail accounts", "nntp news servers", and "rdf/xml files". in mozilla, datasources can be composed together using the composite data source. this is like overlaying graphs, or merging collections of statements ("microtheories") together. statements about the same rdf resource can then be intermingled: for example, the "last visit date" of a particular website comes from the "browser
global history" datasource, and the "shortcut keyword" that you can type to reach that website comes from the "browser bookmarks" datasource. both datasources refer to "website" by url: this is the "key" that allows the datasources to be "merged" effectively. for a more detailed account of how to write a datasource, refer to the rdf datasource how-to. how does mozilla manage datasources? the rdf serv...
Common causes of memory leaks in extensions - Extensions
ing onto window objects or dom nodes (such as window.document) for too long by storing them in a javascript module. for example: var windows = []; function injavascriptcodemodule(window) { // forgetting or failing to pop the window again windows.push(window); } both of these cases can happen if you forget to declare local variables with var or let, which means they end up belonging to the
global scope. for example: function implicitdeclarationleak(window) { // implicit variable declaration in the js
global, holding a strong ref to the document doc = window.document; } implicitly declared variables can be avoided by using ecmascript 5's strict mode. strict mode also excludes several other error-prone code patterns. for some examples found in real-world add-ons, see bug 712733, bu...
...ur code won't accidentally leak content windows. therefore, your add-on should clean up such intervals and timeouts when the corresponding content document is unloaded, by adding an unload event listener or by similar means. another solution would be to use the setinterval()/settimeout() instances content windows provide, but there is a big drawback with this idea: if the user disables javascript
globally or locally (such as by using an add-on like noscript), then using the content window functions won't work. problems in bootstrapped (restartless) add-ons bootstrapped extensions use a bootstrap.js compartment. if you put a reference to anything within this compartment into a long-lived window object (such as browser.xul), javascript module or xpcom component, the bootstrap.js compartment will...
Anatomy of a video game - Game development
discussed here, we schedule a new requestanimationframe before performing our loop contents. that is not by accident and it is considered best practice. calling the next requestanimationframe early ensures the browser receives it on time to plan accordingly even if your current frame misses its vsync window. the above chunk of code has two statements. the first statement creates a function as a
global variable called main(). this function does some work and also tells the browser to call itself next frame with window.requestanimationframe(). the second statement calls the main() function, defined in the first statement. because main() is called once in the second statement and every call of it places itself in the queue of things to do next frame, main() is synchronized to your framerate. of ...
...not immediately assume animations require frame-by-frame control. simple animations can be easily performed, even gpu-accelerated, with css animations and other tools included in the browser. there are a lot of them and they will make your life easier. building a better main loop in javascript there are two obvious issues with our previous main loop: main() pollutes the window object (where all
global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* * starting with the semicolon is in case whatever line of code above this example...
Building up a basic demo with the PlayCanvas engine - Game development
ding on, copy this code to a new text file and save it in your working directory as index.html. playcanvas application to begin developing our game we have to create the playcanvas application first (using the given <canvas> element), and then start the update loop. add the following code to the bottom of your second <script> element: var app = new pc.application(canvas); app.start(); the pc
global object contains all the playcanvas functions available in the engine. next, we'll set the canvas to fill the window, and automatically change its resolution to be the same as the canvas size. again, add the following lines at the bottom of your script. app.setcanvasfillmode(pc.fillmode_fill_window); app.setcanvasresolution(pc.resolution_auto); camera now when the setup code is in place we ne...
...show that it's actually a 3d cube and not a square. the cube is visible, but it is completely. to make it look better we need to shine some light onto it. lights the basic light types in playcanvas are directional and ambient. the first type is a directional light placed somewhere on the scene while the scond one reflects the light from the first type, so it looks more natural; this can be set
globally. again, add the new code below your previous additions. var light = new pc.entity(); light.addcomponent('light'); app.root.addchild(light); light.rotate(45, 0, 0); it will create a light entity component and add it to the scene. we can rotate the light on the x axis to make it shine on more than one side of the cube. it's time to add the ambient light: app.scene.ambientlight = new pc.color(...
Visual typescript game engine - Game development
...
... | | ├── sound.ts | | | ├── system.ts | | | ├── view-port.ts | | | ├── visual-render.ts | | ├── interface/ | | | ├── drawi.ts | | | ├──
global.ts | | | ├── visual-components.ts | | ├── multiplatform/ | | | ├── mobile/ | | | | ├── player-controls.ts | | | ├──
global-event.ts | | ├── types/ | | | ├──
global.ts | | ├── engine-config.ts | | ├── ioc.ts | | ├── starter.ts | ├── icon/ ... | ├── examples/ | | ├── platformer/ | ├── html-components/ | | ├── register.html | | ├── login.html | | ├── games-list.html | | ├── user-profile.html | ...
Object prototypes - Learn web development
empty. now try the following: object.prototype you'll see a large number of methods defined on object's prototype property, which are then available on objects that inherit from object, as shown earlier. you'll see other examples of prototype chain inheritance all over javascript — try looking for the methods and properties defined on the prototype of the string, date, number, and array
global objects, for example. these all have a number of members defined on their prototype, which is why for example when you create a string, like this: let mystring = 'this is my string.'; mystring immediately has a number of useful methods available on it, like split(), indexof(), replace(), etc. note: it is worth reading our more in-depth guide to "using prototypes in javascript", once you've ma...
...ble when defined like this. for example you could add a property like so: person.prototype.fullname = 'bob smith'; this isn't very flexible, as the person might not be called that. it'd be much better to build the fullname out of name.first and name.last: person.prototype.fullname = this.name.first + ' ' + this.name.last; however, this doesn't work. that's because this will be referencing the
global scope in this case, not the function scope. calling this property would return undefined. this worked fine on the method we defined earlier in the prototype because it is sitting inside a function scope, which will be transferred successfully to the object instance scope. so you might define constant properties on the prototype (i.e. ones that never need to change), but generally it works better ...
Beginning our React todo list - Learn web development
-size: 100%; line-height: 1.15; margin: 0; } button, input { overflow: visible; } input[type="text"] { border-radius: 0; } body { width: 100%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 arial, sans-serif; background-color: #f5f5f5; color: #4d4d4d; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ /*
global styles */ .form-group > input[type="text"] { display: inline-block; margin-top: 0.4rem; } .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color...
...1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .stack-small > * + * { margin-top: 1.25rem; } .stack-large > * + * { margin-top: 2.5rem; } @media screen and (min-width: 550px) { .stack-small > * + * { margin-top: 1.4rem; } .stack-large > * + * { margin-top: 2.8rem; } } .stack-exception { margin-top: 1.2rem; } /* end
global styles */ .todoapp { background: #fff; margin: 2rem 0 4rem 0; padding: 1rem; position: relative; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 2.5rem 5rem 0 rgba(0, 0, 0, 0.1); } @media screen and (min-width: 550px) { .todoapp { padding: 4rem; } } .todoapp > * { max-width: 50rem; margin-left: auto; margin-right: auto; } .todoapp > form { max-width: 100%; } .todoapp > h1 ...
Deployment and next steps - Learn web development
https://vercel.link/2f). to change the domain or build command, go to https://zeit.co/opensas/mdn-svelte-tutorial/settings accept all the defaults, and you'll be fine. once it has finished deploying, go to the "production" url in your browser, and you'll see the app deployed! you can also import a svelte git project into vercel from github, gitlab, or bitbucket. note: you can
globally install vercel with npm i -g vercel so you don't have to use npx to run it. automatic deployment to gitlab pages for hosting static files there are several online services that allow you to automatically deploy your site whenever you push changes to a git repository. most of them involve setting up a deployment pipeline that gets triggered on every git push, and takes care of building and de...
...ublic folder. on the last line, we are configuring gitlab to redeploy our app only when there's a push to our master branch. since our app will be published at a subdirectory (like https://your-user.gitlab.io/mdn-svelte-todo), we'll have to make the references to the javascript and css files in our public/index.html file relative. to do this, we just remove the leading slashes (/) from the /
global.css, /build/bundle.css, and /build/bundle.js urls, like this: <title>svelte to-do list</title> <link rel='icon' type='image/png' href='favicon.png'> <link rel='stylesheet' href='
global.css'> <link rel='stylesheet' href='build/bundle.css'> <script defer src='build/bundle.js'></script> do this now. now we just have to commit and push our changes to gitlab. do this by running the follo...
Getting started with Vue - Learn web development
dvantage of bundlers like webpack. to make building apps with vue easier, there is a cli to streamline the development process. to use the npm package & the cli you will need: node.js 8.11+ installed. npm or yarn. note: if you don't have the above installed, find out more about installing npm and node.js here. to install the cli, run the following command in your terminal: npm install --
global @vue/cli or if you'd prefer to use yarn: yarn
global add @vue/cli once installed, to initialize a new project you can then open a terminal in the directory you want to create the project in, and run vue create <project-name>. the cli will then give you a list of project configurations you can use. there are a few preset ones, and you can make your own. these options let you configure things li...
...t sits outside of your vue app. editing this file typically only occurs in advanced use cases. src: this directory contains the core of your vue app. main.js: this is the entry point to your application. currently, this file initializes your vue application and signifies which html element in the index.html file your app should be attached to. this file is often where you register
global components or additional vue libraries. app.vue: this is the top-level component in your vue app. see below for more explanation of vue components. components: this directory is where you keep your components. currently it just has one example component. assets: this directory is for storing static assets like css and images. because these files are in the source directory, they can be p...
Implementing feature detection - Learn web development
tures you are using in your code won't display your sites properly and will just fail, creating a bad user experience. let's recap and look at the example we touched on in our handling common javascript problems — the geolocation api (which exposes available location data for the device the web browser is running on) has the main entry point for its use, a geolocation property available on the
global navigator object. therefore, you can detect whether the browser supports geolocation or not by using something like the following: if ("geolocation" in navigator) { navigator.geolocation.getcurrentposition(function(position) { // show the location on a map, perhaps using the google maps api }); } else { // give the user a choice of static maps instead perhaps } it is probably better t...
...quite happily apply css selectively based on whether the browser supports html or javascript features, if needed. note: if you have trouble getting this to work, check your code against our modernizr-css.html and modernizr-css.css files (see this running live also). javascript modernizr is also equally well-prepared for implementing javascript feature detects too. it does this by making the
global modernizr object available to the page it is applied to, which contains results of the feature detects as true/false properties. for example, load up our modernizr-css.html example in your browser, then try going to your javascript console and typing in modernizr. followed by some of those class names (they are the same here too). for example: modernizr.flexbox modernizr.websqldatabase moderniz...
Handling common JavaScript problems - Learn web development
eries of functions that were invoked to cause the current function to be invoked. at the top, we have showheroes() the function we are currently in, and second we have onload, which stores the event handler function containing the call to showheroes(). under scopes, you'll see the currently active scope for the function we are looking at. we only have three — showheroes, block, and window (the
global scope). each scope can be expanded to show the values of variables inside the scope when execution of the code was stopped. we can find out some very useful information in here. expand the showheroes scope — you can see from this that the heroes variable is undefined, indicating that accessing the members property of jsonobj (first line of the function) didn't work. you can also see that ...
...mine whether a javascript feature is supported in the current browser, and then conditionally run code to provide an acceptable experience both in browsers that do and don't support the feature. as a quick example, the geolocation api (which exposes available location data for the device the web browser is running on) has a main entry point for its use — a geolocation property available on the
global navigator object. therefore, you can detect whether the browser supports geolocation or not by using something like the following: if("geolocation" in navigator) { navigator.geolocation.getcurrentposition(function(position) { // show the location on a map, perhaps using the google maps api }); } else { // give the user a choice of static maps instead perhaps } you could also write suc...
Package management basics - Learn web development
oving all the files again if you want to remove the packages. in addition, package managers handle duplicate dependencies (something that becomes important and common in front-end development). in the case of npm (and javascript- and node-based package managers) you have two options for where you install your dependencies. as we touched on in the previous article, dependencies can be installed
globally or locally to your project. although there tend to be more pros for installing
globally, the pros for installing locally are more important — such as code portability and version locking. for example, if your project relied on webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or returned to it much later on, the configuration wou...
...ge manager and registry to install a command line utility. parcel is a(nother) tool that developers commonly use in their development process. parcel is clever in that it can watch the contents of our code for calls to dependencies and automatically installs any dependencies it sees that our code needs. it can also automatically build our code. in our previous chapter we installed prettier as a
global tool. here however, let’s use npm to install parcel as a local tool, as best practices dictate. we'll install it as part of an experimental app. setting up the app as an npm package first of all, create a new directory to store our experimental app in, somewhere sensible that you’ll find again. we’ll call it parcel-experiment, but you can call it whatever you like: mkdir parcel-experimen...
Browser chrome tests
e/content/test/ or without mach test_path=<path_to_the_tests> make -c <objdir> mochitest-browser-chrome to run tests in debugger the following should work ./mach mochitest -f browser --debugger gdb browser/base/content/test/ run ./mach help mochitest-browser for more options. writing browser chrome tests browser chrome tests are snippets of javascript code that run in the browser window's
global scope. a simple test would look like this: function test() { ok(gbrowser, "gbrowser exists"); is(gbrowser.tabs.length, 1, "browser has 1 tab"); } the test() function is invoked by the test harness when the test is run. the test file can contain other functions, they will be ignored unless invoked by test(). gbrowser is set in browser.js and is a tabbrowser element (the tabbrowser with...
...le running the tests. you should attempt to reduce the side effects of the testing code and "clean up" after yourself, to avoid influencing other tests. the comparison functions are identical to those supported by mochitests, see how the comparison functions work in the mochitest documentation for more details. the eventutils helper functions are available on the eventutils object defined in the
global scope. the test file name must be prefixed with "browser_", and must have a file extension of ".js". files that don't match this pattern will be ignored by the test harness. using a descriptive file name is strongly encouraged instead of just using a bug number. you can collect common utils and helpers in a file called head.js, that must live in the same folder as the browser-chrome tests. this...
Chrome registration
alog is different, as well as the names of some items. the "platform" modifier is only parsed for content registration; it is not recognized for locale or skin registration. however, it applies to content, locale, and skin parts of the package, when specified. to indicate that a package is platform-specific, add the "platform" modifier to the "content" line after the path, for example: content
global-platform jar:toolkit.jar!/toolkit/content/
global-platform/ platform once that is specified in your manifest you then ensure that under the directory
global-platform are subdirectories win (windows/os2), mac (os9/osx), or unix (everything else). anything residing outside of these subdirectories will be ignored. process in electrolysis registrations can be set to only apply in either the main p...
... overlay chrome://navigator/content/pageinfo.xul chrome://pippki/content/pageinfooverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} overlay chrome://communicator/content/pref/preftree.xul chrome://pippki/content/prefoverlay.xul content pippki jar:pippki.jar!/content/pippki/ locale pippki en-us jar:en-us.jar!/locale/pippki/ content
global-platform jar:toolkit.jar!/content/
global-platform/ platform skin
global classic/1.0 jar:classic.jar!/skin/classic/
global/ override chrome://
global/content/neterror.xhtml jar:embedder.jar!/
global/content/neterror.xhtml content inspector jar:inspector.jar!/content/inspector/ instructions supported in bootstrapped add-ons the following instructions are su...
Experimental features in Firefox
r html-based modal dialog boxes. the current implementation is a little inelegant but is basically functional. see bug 840640 for more details. release channel version added enabled by default? nightly 53 yes developer edition 53 no beta 53 no release 53 no preference name dom.dialog_element.enabled
global attribute: inputmode our implementation of the inputmode
global attribute has been updated as per the whatwg spec (bug 1509527), but we still need to make other changes too, like making it available on contenteditable content. see also bug 1205133 for details. release channel version added enabled by default? nightly 75 yes developer edition 75 n...
... unit (gpu) of the user's device or computer. the specification is still a work-in-progress. see bug 1602129 for our progress on this api. release channel version added enabled by default? nightly 73 no developer edition 73 no beta 73 no release 73 no preference name dom.webgpu.enabled html dom api
global event: beforeinput the
global beforeinput event is sent to an <input> element—or any element whose contenteditable attribute is enabled—immediately before the element's value changes. release channel version added enabled by default? nightly 74 no developer edition 74 no beta 74 no release 74 no preferen...
ChromeWorker
be large incompatibilities between implementations and the behavior may change in the future. summary if you're developing privileged code, and would like to create a worker that can use js-ctypes to perform calls to native code, you can do so by using chromeworker instead of the standard worker object. it works exactly like a standard worker, except that it has access to js-ctypes via a
global ctypes object available in the
global scope of the worker. examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below. to use a postmessage with callback version of chromeworker that features promises, see promiseworker. addons must use absolute urls to load their workers, and those urls have to be using a chrome:// or resource:// protocol...
...ource://my-cool-addon/worker.js'); more references: you can use chromeworker from javascript code modules. see using workers in javascript code modules for details. you can use chromeworker modules in chromeworkers. see using web workers for examples and details. see also using web workers using workers in javascript code modules worker sharedworker web workers specification worker
globalscope github :: chromeworker - a fully working demo addon using js-ctypes from a chrome worker. uses winapi example. promiseworker github :: promiseworker - shows how to uses promises as an twist on postmessage feature of chromeworker ...
CustomizableUI.jsm
sumer for more details, see api-provided widgets. 'special' widgets: these are the representations of xul <toolbarseparator>, <toolbarspring> and <toolbarspacer> elements. customizableui provides apis to add, move and remove all these different widgets, and mostly abstracts the dom away from you. the lifetime of your widget should be identical to the lifetime of the add-on - it's process-
global, so if you call createwidget on bootstrap's "startup" and destroywidget on bootstrap's "shutdown", that's enough. listeners customizableui provides a way to listen for various bits of customization happening. this can be useful if other parts of the code need to react to changes in the customization of the user interface. in order to use this facility, you should create a plain js object which...
... list-style-image: url("chrome://branding/content/icon32.png");'; //a 32px x 32px icon for when in toolbar css += ' }'; css += '}'; var cssenc = encodeuricomponent(css); var newuriparam = { aurl: 'data:text/css,' + cssenc, aorigincharset: null, abaseuri: null } var cssuri = services.io.newuri(newuriparam.aurl, newuriparam.aorigincharset, newuriparam.abaseuri); //store this in a
global var so you can call it when removing the widget sss.loadandregistersheet(cssuri, sss.author_sheet); /**************/ // when you want to remove this widget run this code: // sss.unregistersheet(cssuri, sss.author_sheet); //remove the style sheet we applied // customizableui.destroywidget('id_of_my_widget_within_customizableui_and_dom'); //remove the widget /**************/ createwidget - custom...
OS.File.Info
instances of os.file.info represent file metadata, such as the size of the file, its last modification date, etc. due to differences between operating systems, the information available depends on the platform. instances of os.file.info may be obtained by: calling
global method os.file.stat() either from the main thread or from a worker thread; calling instance method stat() of os.file either from the main thread or from a worker thread. using os.file.info example: determining if a file is a regular file the following snippet uses the main thread api to determine (asynchronously) whether some path is a regular file, or a directory, or a symbolic link: let promise = os.file.stat(somepath); promise.then( function onsuccess(info) { // |info| is an instance of |os.file.info| ...
...promise.then( function onsuccess(info) { if ("unixowner" in info) { // info.unixowner holds the owner of the file } else { // information is not available on this platform } } ); evolution of this example bug 802534 will introduce the ability to check whether field unixowner appears in os.file.info.prototype, which will make it possible to write faster code.
global object os.file.info methods object tomsg(in os.file.info value) os.file.tomsg convert an instance of os.file.info to a form that can be serialized and transmitted between threads or processes. object tomsg( in os.file.info value ) arguments returns an object with the same fields as value but that may be serialized and transmitted between threads or processes. value an...
Using JavaScript code modules
a javascript code module is simply some javascript code located in a registered location. the module is loaded into a specific javascript scope, such as xul script or javascript xpcom script, using components.utils.import() or components.utils["import"](). ...
...bol'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 variables in a wrapper class and export the wrapper (such as bar in the above example). unloading code modules requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) components.utils.unload() allows you to unload a previously imported code module. once this method has been called, references to the module w...
Using workers in JavaScript code modules
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. ...
...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. ...
XPCOMUtils.jsm
ainterfacename the name of the interface to query the service to. generatensgetfactory() generates the nsgetfactory() function along with the factory definition. function generatensgetfactory( componentsarray ); parameters componentsarray an array of component constructors. return value a function that will return the factory for the components 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, classdescri...
...pports. for example, if your component implements nsistreamconverter: mycomponent.prototype = { queryinterface: xpcomutils.generateqi([ components.interfaces.nsirequestobserver, components.interfaces.nsistreamlistener, components.interfaces.nsistreamconverter, ]), // ...methods... } importrelative() imports a javascript code module given the calling javascript code module's
global object (you should specify this) and a path relative to that module. this lets modules bundled in a package load one another without having to hard-code full paths. void importrelative( that, path, scope ); parameters that the javascript object of the calling javascript code module's
global scope. you should simply pass this. path the relative path of the javascript code module to ...
Localizing with Mozilla Translator
ale |-- 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: toolkit |-- locales | |-- en-us | | |-- chrome | | | |-- alerts | | | | `-- notificationnames.properties | | | |-- autoconfig | | | | `-- autoconfig.properties | | | |-- cookie | | | ...
... . browser |-- locales | |-- en-us | | |-- readme.txt | | |-- chrome | | | |-- branding | | | | |-- brand.dtd | | | | `-- brand.properties | | | |-- browser | | | | |-- aboutdialog.dtd as you see, there is ''link'' point, usually at chrome (in cvs & mozilla...
Leak-hunting strategies and tips
ng leaks when trying to make a particular testcase not leak, i recommend focusing first on the largest object graphs (since these entrain many smaller objects), then on smaller reference-counted object graphs, and then on any remaining individual objects or small object graphs that don't entrain other objects. because (1) large graphs of leaked objects tend to include some objects pointed to by
global variables that confuse gc-based leak detectors, which can make leaks look smaller (as in bug 99180) or hide them completely and (2) large graphs of leaked objects tend to hide smaller ones, it's much better to go after the large graphs of leaks first. a good general pattern for finding and fixing leaks is to start with a task that you want not to leak (for example, reading email). start finding ...
...y running part of the task under nstracerefcnt logging, gradually building up from as little as possible to the complete task, and fixing most of the leaks in the first steps before adding additional steps. (by most of the leaks, i mean the leaks of large numbers of different types of objects or leaks of objects that are known to entrain many non-logged objects such as js objects. seeing a leaked
globalwindowimpl, nsxulpd
globalobject, nsxbldoc
globalobject, or nsxpcwrappedjs is a sign that there could be significant numbers of js objects leaked.) for example, start with bringing up the mail window and closing the window without doing anything. then go on to selecting a folder, then selecting a message, and then other activities one does while reading mail. once you've done this, and it doesn't ...
Memory reporting
nctions) should look like for this class. size_t mystring::sizeofexcludingthis(mozilla::mallocsizeof amallocsizeof) const { return amallocsizeof(mbuffer); } size_t mystring::sizeofincludingthis(mozilla::mallocsizeof amallocsizeof) const { return amallocsizeof(this) + sizeofexcludingthis(amallocsizeof); } (note that sizeofexcludingthis and sizeofincludingthis aren't overrides of methods on a
global base class that is common to all reporters. these names are just a convention that is commonly followed. that said, note that for some classes these methods may be virtual.) mfbt/memoryreporting.h defines mozilla::mallocsizeof as follows: typedef size_t (*mallocsizeof)(const void* p); functions with this signature measure the size of p by asking the heap allocator how big it is (via moz_mall...
..."amount" is a bytes measurement. so it's best to mostly use size_t and convert to int64_t as late as possible. you don't always need both sizeofexcludingthis and sizeofincludingthis. implement one or both as needed. if you have both, sizeofexcludingthis is the interesting one; sizeofincludingthis always has the same basic form. and here's how you'd write a memory reporter if there was a single
global mystring object. mystring *gmystring; class mystringreporter moz_final : public nsimemoryreporter { moz_define_malloc_size_of(mallocsizeof) public: ns_decl_isupports ns_method collectreports(nsihandlereportcallback* ahandlereport, nsisupports* adata) { // btw: if gmystring wasn't a pointer, you'd use // |gmystring.sizeofexcludingthis(mallocsizeof)| instead. return moz_co...
Threads
ding functions most of the functions described here accept a pointer to the thread as an argument. nspr does not check for the validity of the thread. it is the caller's responsibility to ensure that the thread is valid. the effects of these functions on invalid threads are undefined. creating, joining, and identifying threads controlling thread priorities interrupting and yielding setting
global thread concurrency getting a thread's scope creating, joining, and identifying threads pr_createthread creates a new thread. pr_jointhread blocks the calling thread until a specified thread terminates. pr_getcurrentthread returns the current thread object for the currently running code. pr_attachthread associates a prthread object with an existing native thread. pr_detachthread disa...
...terrupting and yielding pr_interrupt requests an interrupt of another thread. once the target thread has been notified of the request, the request stays with the thread until the notification either has been delivered exactly once or is cleared. pr_clearinterrupt clears a previous interrupt request. pr_sleep causes a thread to yield to other threads for a specified number of ticks. setting
global thread concurrency pr_setconcurrency sets the number of
global threads used by nspr to create local threads. getting a thread's scope pr_getthreadscope gets the scoping of the current thread. ...
Index
re is a classic engine that is very stable and works fine in all simple scenarios, for example if all (b) candidate issuer certificates have the same subject and issuer names and differ by validity period; however, it works only in a limited amount of more advanced scenarios. unfortunately, the world of certificates has become more complex in the recent past. new certificate authorities enter the
global pki market, and in order to get started with their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it w...
...ta control file. metadata is signed information attached either to the jar archive itself or to files within the archive. this metadata can be any ascii string, but is used mainly for specifying an installer script. ...
NSS_3.12_release_notes.html
cu_parsecommandline bug 161326: need api to convert dotted oid format to/from octet representation bug 376737: cert_importcerts routinely sets valid_peer or valid_ca override trust flags bug 390381: libpkix rejects cert chain when root ca cert has no basic constraints bug 391183: rename libpkix error string number type to pkix error number types bug 397122: nss 3.12 alpha treats a key3.db with no
global salt as having no password bug 405966: unknown signature oid 1.3.14.3.2.29 causes sec_error_bad_signature, 3.11 ignores it bug 413010: cert_comparerdn may return a false match bug 417664: false positive crl revocation test on ppc/ppc64 nss_enable_pkix_verify=1 bug 404526: glibc detected free(): invalid pointer bug 300929: certificate policy extensions not supported bug 129303: nss needs to expose...
...rsa performance on amd64 bug 352439: reference leaks in modutil bug 369144: certutil needs option to generate subjectkeyid extension bug 391771: pk11_config_name and pk11_config_strings leaked on shutdown bug 401194: crash in lg_findobjects on win64 bug 405652: in the tls clienthello message the gmt_unix_time is incorrect bug 424917: performance regression with studio 12 compiler bug 391770: ocsp_
global.monitor is leaked on shutdown bug 403687: move pkix functions to certvfypkix.c, turn off ev_test_hack bug 428105: cert_setocsptimeout is not defined in any public header file bug 213359: enhance pk12util to extract certs from p12 file bug 329067: nss encodes cert distinguished name attributes with wrong string type bug 339906: sec_pkcs12_install_bags passes uninitialized variables to functions bu...
NSS 3.16.3 release notes
ven a human readable string. this function was already added in nss 3.16.2, however, it wasn't declared in a public header file. ...
... ca 沃通根证书 sha1 fingerprint: 16:32:47:8d:89:f9:21:3a:92:00:85:63:f5:a4:a7:d3:12:40:8a:d6 cn = digicert assured id root g2 sha1 fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f cn = digicert assured id root g3 sha1 fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 cn = digicert
global root g2 sha1 fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 cn = digicert
global root g3 sha1 fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e cn = digicert trusted root g4 sha1 fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 cn = quovadis root ca 1 g3 ...
NSS 3.17.3 release notes
source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_3_rtm/src/ new in nss 3.17.3 new functionality support for tls_fallback_scsv has been added to the ssltap and tstclnt utilities. notable changes in nss 3.17.3 the quickder decoder now decodes lengths robustly (cve-2014-1569). ...
...uthority sha1 fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 cn = usertrust rsa certification authority sha1 fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e cn = usertrust ecc certification authority sha1 fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 cn =
globalsign ecc root ca - r4 sha1 fingerprint: 69:69:56:2e:40:80:f4:24:a1:e7:19:9f:14:ba:f3:ee:58:ab:6a:bb cn =
globalsign ecc root ca - r5 sha1 fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa the version number of the updated root ca list has been set to 2.2 bugs fixed in nss 3.17.3 this bugzilla query returns all the bugs fixed ...
NSS 3.39 release notes
the digestinfo structure was missing the null parameter. starting with version 3.39, nss requires the encoding to contain the null parameter. the tstclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a previous nss version. the ca certificates list was updated to version 2.26. ...
...stclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a previous nss version. the ca certificates list was updated to version 2.26. ...
NSS 3.54 release notes
73e0 the following ca certificates were removed: bug 1645199 - addtrust class 1 ca root sha-256 fingerprint: 8c7209279ac04e275e16d07fd3b775e80154b5968046e31f52dd25766324e9a7 bug 1645199 - addtrust external ca root sha-256 fingerprint: 687fa451382278fff0c8b11f8d43d576671c6eb2bceab413fb83d965d06d2ff2 bug 1641718 - luxtrust
global root 2 sha-256 fingerprint: 54455f7129c20b1447c418f997168f24c58fc5023bf5da5be2eb6e1dd8902ed5 bug 1639987 - staat der nederlanden root ca - g2 sha-256 fingerprint: 668c83947da63b724bece1743c31a0e6aed0db8ec5b31be377bb784f91b6716f bug 1618402 - symantec class 2 public primary certification authority - g4 sha-256 fingerprint: fe863d0822fe7a2353fa4...
...r hacl* curve25519 on windows. bug 1645186 - add "certsign root ca g2" root certificate. bug 1645174 - add microsec's "e-szigno root ca 2017" root certificate. bug 1641716 - add microsoft's non-ev root certificates. bug 1621151 - disable email trust bit for "o=government root certification authority; c=tw" root. bug 1645199 - remove addtrust root certificates. bug 1641718 - remove "luxtrust
global root 2" root certificate. bug 1639987 - remove "staat der nederlanden root ca - g2" root certificate. bug 1618402 - remove symantec root certificates and disable email trust bit. bug 1640516 - nss 3.54 should depend on nspr 4.26. bug 1642146 - fix undefined reference to `port_zalloc_stub' in seed.c. bug 1642153 - fix infinite recursion building nss. bug 1642638 - fix fuzzing assertion crash...
Rhino JavaScript compiler
ns available to the shell (such as print) are not available to compiled scripts when they are run outside the shell. compiler command line java org.mozilla.javascript.tools.jsc.main [options] file1.js [file2.js...] where options are: -extends java-class-name specifies that a java class extending the java class java-class-name should be generated from the incoming javascript source file. ...
... -debug -g specifies that debug information should be generated. may not be combined with optimization at an optlevel greater than zero. ...
Scripting Java
at requires a java string and rhino will perform the conversion. we actually saw this feature in action on the call to the java.lang.string constructor in the preceding example. rhino also makes the javascript methods available to java strings if the java.lang.string class doesn't already define them. ...
...ngle, java.awt.dimension); ... with (swinggui) { var mybutton = new jbutton(test); var mypoint = new point(10, 10); var myframe = new jframe(); ... } previously such functionality was available only to embeddings that used org.mozilla.javascript.importertoplevel class as the top level scope. the class provides additional importpackage() and importclass()
global functions for scripts but their extensive usage has tendency to pollute the
global name space with names of java classes and prevents loaded classes from garbage collection. see bugzilla 245882 for details. java exceptions exceptions thrown by java methods can be caught by javascript code using try...catch statement. rhino wraps java exceptions into error objects with the following properties:...
SpiderMonkey compartments
only a special object type can cross the compartment boundaries. we call these objects cross-compartment wrappers. spidermonkey tracks the creation of these cross-compartment wrappers and thus it knows at all times what objects from a compartment are kept alive by outside references (through cross-compartment wrappers). this allows the garbage collecting of individual compartments, in addition to
global collection. spidermonkey simply assumes that all objects referenced from outside the compartment are live, and then walks the object graph inside the compartment. objects that are found to be disconnected from the graph are discarded. with this new per-compartment garbage collection we shortcut having to walk unrelated heap areas of a window or tab that triggered a garbage collection. see a...
...mply assumes that all objects referenced from outside the compartment are live, and then walks the object graph inside the compartment. objects that are found to be disconnected from the graph are discarded. ...
Hacking Tips
ith reftest to break on the write of a differing pixel: find the x/y of a pixel that differs use 'run z' where z is the mark in the log for test-start. for example in '[rr 28496 607198]reftest test-start | file:///home/bgirard/mozilla-central/tree/image/test/reftest/bmp/bmpsuite/b/wrapper.html?badpalettesize.bmp' z would be 607198. ...
...e js shell, you can use performance.now() in the javascript code of a page. dumping the javascript heap from the shell, you can call the dumpheap before firefox function to dump out all gc things (reachable and unreachable) that are present in the heap. by default the function writes to stdout, but a filename can be specified as an argument. example output might look as follows: 0x1234abcd b
global object ========== # zone 0x56789123 # compartment http://gmail.com [in zone 0x56789123] # compartment http://gmail.com/iframe [in zone 0x56789123] # arena allockind=3 size=64 0x1234abcd b object > 0x1234abcd b prop1 > 0xabcd1234 w prop2 0xabcd1234 w object > 0xdeadbeef b prop3 # arena allockind=5 size=72 0xdeadbeef w object > 0xabcd1234 w prop4 the output is textual. the first section of the fi...
Property cache
x has shape s and x' has shape s'; and no shape-regenerating gc occurred; then at t1 the lookup for p in x still finds the same property on x'. (informally: if another variable or property shadows x'.p, the shape of x' will change.) o this object is x, perhaps a call object. ↓ o ----> o a block object and its proto. ↓ o another call object. ↓ o ----> o ----> o ----> o ^
global ^x' (----> indicates proto as before; downward arrows ↓ indicate the parent relation) method guarantee — if at time t0 the object x has shape s; and x has an own property p that is a method property (transparently joined function); and at time t1 an object y has shape s; and no shape-regenerating gc occurred; then at time t1 y's own property p is the same method property. (the ...
... ...
JS_ExecuteScript
dded in spidermonkey 31, obsoleted since jsapi 39 name type description cx jscontext * the context in which to execute the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the scope in which to execute the script. in the simplest cases, this should just be the embedding's
global object. obsolete since jsapi 39 obj must not be an array, an e4x xml object, a with object, or a proxy. in ecmascript terms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2. instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's p...
...then its parent's parent, etc. until null is reached. variable initialization is performed. if the jsoption_varobjfix option is in effect (recommended), then the last object in the scope chain is used as the variable object. otherwise obj is used. the this value is obj. scopechain js::autoobjectvector & an explicit scope chain. scopechain must not include the
global object on it; that's implicit. it needs to contain the other objects that should end up on the scripts's scope chain. objects in the vector should be ordered from inner to the outer scope. script js::handlescript the compiled script to execute. rval js::mutablehandlevalue out parameter. on success, rval receives the value from the last executed expression statement p...
JS_GetArrayPrototype
this article covers features introduced in spidermonkey 24 retrieves the original, canonical array.prototype for an object's
global object. syntax jsobject * js_getarrayprototype(jscontext *cx, js::handleobject forobj); name type description cx jscontext * pointer to a javascript context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose array.prototype is being retrieved. ...
... in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose array.prototype is being retrieved. description js_getarrayprototype() retrieves the original array.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the
global array property is modified, but this method returns only the original value. see also mxr id search for js_getarrayprototype bug 872043 ...
JS_GetFunctionPrototype
this article covers features introduced in spidermonkey 17 retrieves the original, canonical function.prototype for an object's
global object. syntax jsobject * js_getfunctionprototype(jscontext *cx, js::handleobject forobj); name type description cx jscontext * pointer to a javascript context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose function.prototype is being retrieved. description js_getfunctionprototype() retrieves the original function.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time...
...threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose function.prototype is being retrieved. description js_getfunctionprototype() retrieves the original function.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the
global function property is modified, but this method returns only the original value. see also mxr id search for js_getfunctionprototype bug 726182 ...
JS_GetObjectPrototype
this article covers features introduced in spidermonkey 17 retrieves the original, canonical object.prototype for an object's
global object. syntax jsobject * js_getobjectprototype(jscontext *cx, js::handleobject forobj); name type description cx jscontext * pointer to a javascript context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose object.prototype is being retrieved. ...
... a js_threadsafe build, the caller must be in a request on this jscontext. forobj js::handleobject an object from the
global whose object.prototype is being retrieved. description js_getobjectprototype() retrieves the original object.prototype of a specified object, obj. if an error occurs, it returns null. note: this expression might have different values over time if the
global object property is modified, but this method returns only the original value. see also mxr id search for js_getobjectprototype bug 725888 ...
JS_InitClass
rtyspec *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. obj js::handleobject pointer to the "
globals" object to use for initializing the class. this must not be null. once js_initclass creates the new class's constructor, it stores the constructor as a property in this object. so, for example, if this object is js_get
globalobject(cx), then javascript code will be able to see the new class as a
global name. parent_proto js::handleobject pointer to an object to be used as a prototy...
...ample, if the finalizer calls js_getprivate(), expecting that the constructor called js_setprivate(), it may find that the private data is null. the jsclass_construct_prototype flag is one way to avoid this inconsistency. warning: if the class is a jsextendedclass, make sure that the additional reserved fields at the end of the jsextendedclass are null. jsextendedclass structs should usually be
global, and in this case the compiler automatically initializes these fields to null. (this is a feature of the c and c++ languages.) otherwise, use memset. see also mxr id search for js_initclass js_getclass js_instanceof ...
Web Replay
d are generally at the system call and the system library level. in general, any function which is not compiled as part of gecko is fair game. acquisition order of locks is recorded in a data stream for each lock. some locks which are associated with non-deterministic components are not recorded, such as the js gc and helper threads locks. accesses on atomic variables/fields are recorded in a
global data stream, as if they were all protected by a
global lock. some atomics are related to non-deterministic components and are excluded from this stream. threads use file descriptors to wait on locks and notify each other, instead of using the native implementation for locking and condition variables. at least on mac, pthreads locks/cvars seem to use a mix of process-local and kernel state, and...
...e recording. the recorded data streams which specify the acquisition order for each lock are read from and used so that locks are acquired in the same order. when a thread tries to acquire a lock, it first waits until it is next in line to do so. similarly, atomic accesses which were included in the recording will occur in the same order during replay, as if they were all protected by a single
global lock. note that while this could potentially be a big drag on performance during both replay and recording, many of the hottest atomics (refcounts, gc counters, and so forth) are associated with non-deterministic components and are not recorded. ipc integration communication between the chrome process and a recording or replaying process — hereafter referred to as the child process — is m...
Places utilities for JavaScript
/utils.js this file includes utility functions used by a lot of the bookmarking, tagging, and annotation services that are built into firefox. by default its only included in browser.xul. its not an interface, and as such it will never be frozen, but it provides some easy to use functions that can save you from reinventing the wheel and cluttering up your own classes/functions when you need it.
global objects there are a few
global objects and constants defined in utils.js. these are: qi_node qi_node(anode, aiid) runs a query interface on a bookmark node to expose the interface available to that type. if the interface isn't available to that node, null is returned. anode - the bookmark aiid - the return interface wanted. there are several predefined versions of this for common calls. ...
..."] .getservice(components.interfaces.nsinavbookmarksservice); with places utils all you need to write is: placesutils.bookmarks this should save on the number of references to the service that are needed, and can help clean up interfaces that are already fairly cluttered. there are currently 11 services defined in here. bookmarks nsinavbookmarksservice history nsinavhistoryservice
globalhistory nsibrowserhistory livemarks nsilivemarkservice annotations nsiannotationservice favicons nsifaviconservice microsummaries nsimicrosummaryservice tagging nsitaggingservice rdf nsirdfservice ptm nsiplacestransactionsservice clipboard nsiclipboard urifixup nsiurifixup special places these are essentially references to the id's of special folders within places. they can s...
Components.utils.createObjectIn
note that this function is now mostly obsolete when you are using sandbox, because you can create an object in a different compartment using new. for example, to create a new object in the compartment identified by contentwindow: var newobject = new contentwindow.object(); but it is really needeed from firefox 30 onwards when trying to manipulate the dom window. ...
... ...
Components.utils.evalInSandbox
rticle 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/"); mysandbox.y = 5; // insert property 'y' with value 5 into
global scope. m...
...ox instance var mysandbox = new components.utils.sandbox("http://www.example.com/"); mysandbox.y = 5; // insert property 'y' with value 5 into
global scope. mysandbox.double = double; var result = components.utils.evalinsandbox("x = y + 2; double(x) + 3", mysandbox); console.log(result); // 17 console.log(mysandbox.x); // 7 operations on objects you insert into this sandbox
global scope do not carry privileges into the sandbox: mysandbox.foo = components; // this will give a "permission denied" error components.utils.evalinsandbox("foo.classes", mysandbox); optional arguments you can optionally specify the js version, filename, and line number of the code being evaluated. for instance: var x = components.utils.evalinsandbox( "let x = 1;", sandbox, "1.8", // "late...
Components.utils.import
even those inside jar archives. syntax components.utils.import(url [, scope]); // or, if you use a tool such as jslint which reports compiler errors for the above, components.utils["import"](url [, scope]); parameters url a string of the url of the script to be loaded. the url must point to a file on the disk, possibly in a jar. scope an optional object to import onto; if omitted, the
global object is used. under boot2gecko, the scope is not optional. if your code is meant to work on all platforms, you should always provide a scope. in case of doubt, this is generally a good scope. return value the module's
global object. use of the return value is discouraged since it grants access to the module's internal properties which are not part of its public api. import throws if...
...unters 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 evaluates the specified code each time it is invoked, with the caller's
global object. components.utils.import evaluates the code of each module only once, in its own scope. for example: var scope1 = {}, scope2 = {}; components.utils.import("resource://gre/modules/json.jsm", scope1); components.utils.import("resource://gre/modules/json.jsm", scope2); assert(scope2.xpcomutils === scope1.xpcomutils); ...returns true, whereas: var someurl = "resource://gre/modules/json.
Components.utils
cle collection cycle. forceshrinkinggc() forces a shrinking garbage collection cycle. getcomponentsforscope() this seemingly-paradoxical api allows privileged code to explicitly give unprivileged code a reference to its own components object (whereas it's normally hidden away on a scope chain visible only to xbl methods). see also specialpowers.getcomponents. get
globalforobject() returns the
global object with which 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 scr...
...h which 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. import
globalproperties() 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 proper...
Components object
utils.createobjectin creates a n...
... property in the javascript environment. utils.createobjectin creates a new object in the scope of the specified object's compartment. may only be called from javascript code. utils.evalinsandbox runs javascript code in a sandbox, usually used to run code with restricted privileges. utils.forcegc forces a garbage collection cycle. utils.get
globalforobject returns the
global object with which a given object is associated (through its prototype chain at birth, for example). utils.getweakreference gets a weak reference for the object passed in. utils.import loads a javascript module into the current script, without sharing a scope. utils.lookupmethod looks up a native (i.e. declared ...
nsMemory
« xpcom api reference summary the nsmemory class provides static helper routines to manage memory. these routines allow easy access to xpcom's
global nsimemory implementation without having to go through the service manager to get it. #include "nsmemory.h" class nsmemory { ... }; methods alloc the alloc function allocates a block of memory of a particular size. realloc the realloc function reallocates a block of memory to a new size. free the free function frees a block of memory that was allocated by xpcom's memory manager. ...
...realloc the realloc function reallocates a block of memory to a new size. free the free function frees a block of memory that was allocated by xpcom's memory manager. heapminimize the heapminimize function attempts to shrink the size of the heap. clone the clone function creates a copy of an existing memory block up to the size specified. get
globalmemoryservice the get
globalmemoryservice function returns a reference to xpcom's
global nsimemory object. remarks to use the methods in this class, you must link your component or application against the xpcom glue library. the static methods defined on this class are not frozen. however, if you use these functions in your xpcom component, and if you link to the xpcom glue library, then yo...
mozIJSSubScriptLoader
t must be a local chrome:, resource: or file: url (see bug 307686 and bug 418356). note: in versions of gecko prior to gecko 1.9, you could use data: urls as well, but this introduced security concerns, and is no longer permitted. targetobj the object to use as the scope object for the script being executed. this is where var declarations in the script will be placed. it defaults to the
global object of the caller. note that let and const declarations in the script will be placed on a syntactic scope that is not an object at all, and will not be available to the caller of loadsubscript. note: undeclared variables in the loaded script will be created as
global variables in the caller (ie.: in the caller's
global object). this object will be searched for variables that cannot be resolv...
...twithoptions( in string url, in object options ); parameters url the url pointing to the script to load. it must be a local chrome:, resource: or file: url. options an object that may include any of these parameters: property type description target object the object to use as the scope object for the script being executed. it defaults to the
global object of the caller. note: undeclared variables in the loaded script will be created as
global variables in the caller (ie.: in the caller's
global object). this object will be searched for variables that cannot be resolved in the subscript scope. charset string an optional string to specify the character encoding of the file. if absent, the file is interpreted as ascii. ...
GetKeyBindings
exceptions thrown ns_error_invalid_arg the given index doesn't correspond to default action (not zero). remark key bindings are supported for default action only. ...
... exceptions thrown ns_error_invalid_arg the given index doesn't correspond to default action (not zero). remark key bindings are supported for default action only. ...
nsIAccessible
rdinates of the accessible. layout oriented methods nsiaccessible.getchildatpoint() to get child accessible from point nsiaccessible.getaccessibletoleft(), nsiaccessible.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. getchildat...
...sing the valuenow attribute. description accessible description -- long text associated with this node. keyboardshortcut provides localized string of accesskey name, such as alt+d. the modifier may be affected by user and platform preferences. usually alt+letter, or just the letter alone for menu items. defaultkeybinding provides localized string of
global keyboard accelerator for default action, such as ctrl+o for open file. role enumerated accessible role for the associated element. help help text associated with node. focusedchild focused accessible child of node. attributes attributes of accessible. relationscount returns the number of accessible relations for this ...
nsIClipboard
the kselectionclipboard is peculiar to the x windows system, where it refers to the primary selection, which is the one that simple mouse selection and middle-click paste operations are using. constant value description kselectionclipboard 0 clipboard for selection. ...
...ipboard, which is the one also used by the typical control-c/control-v keyboard shortcuts. the kselectionclipboard is peculiar to the x windows system, where it refers to the primary selection, which is the one that simple mouse selection and middle-click paste operations are using. constant value description kselectionclipboard 0 clipboard for selection. k
globalclipboard 1 clipboard for
global use. kfindclipboard 2 clipboard for find strings. methods emptyclipboard() this method empties the clipboard and notifies the clipboard owner. it empties the "logical" clipboard. it does not clear the native clipboard. void emptyclipboard( in long awhichclipboard ); parameters awhichclipboard specifies the clipboard to which t...
nsIComponentRegistrar
ed by classid, and creates an association of class name and contractid with the class. void registerfactory( in nscidref aclass, in string aclassname, in string acontractid, in nsifactory afactory ); parameters aclass the classid of the class being registered. aclassname the name of the class being registered. this value is intended as a human-readable name for the class and need not be
globally unique. (unused) acontractid the contractid of the class being registered. may be null if no contractid is needed. afactory the nsifactory instance of the class being registered. if afactory is null, the contract will be associated with a previously registered classid. registerfactorylocation() registers a factory to be used to instantiate a particular class identified by classid, and creates ...
...pecified instead of the factory instance. void registerfactorylocation( in nscidref aclass, in string aclassname, in string acontractid, in nsifile afile, in string aloaderstr, in string atype ); parameters aclass the classid of the class being registered. aclassname the name of the class being registered. this value is intended as a human-readable name for the class and need not be
globally unique. acontractid the contractid of the class being registered. afile a component file. this file must have an associated loader and export the required symbols, which the loader specifies. aloaderstr opaque loader specific string. this value is passed into the nsimodule.registerself() callback and must be forwarded unmodified when registering factories via their location. atype component typ...
nsIContentPrefObserver
void oncontentprefset(in astring agroup, in astring aname, in nsivariant avalue); methods oncontentprefremoved() called when a content preference is removed. void oncontentprefremoved( in astring agroup, in astring aname ); parameters agroup the group to which the removed preference belonged; this may be the uri of a web site. this value is null if the preference was
global, applying to all web sites. aname the name of the preference that was removed. oncontentprefset() called when the value of a preference is set (either by changing its current value or by creating the preference). void oncontentprefset( in astring agroup, in astring aname, in nsivariant avalue ); parameters agroup the group to which the preference belongs; this may be the uri of ...
... preference that was removed. oncontentprefset() called when the value of a preference is set (either by changing its current value or by creating the preference). void oncontentprefset( in astring agroup, in astring aname, in nsivariant avalue ); parameters agroup the group to which the preference belongs; this may be the uri of a web site. this value is null if the preference is
global, applying to all web sites. aname the name of the preference whose value has changed. avalue the preference's new value. see also nsicontentprefservice using content preferences ...
nsINavBookmarksService
the id of the item whose added date time is to be retrieved. return value returns the date added time for the given item. getitemguid() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)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. this method retrieves a
globally unique identifier for an item, meant to be used in sync scenarios. even if their contents are exactly the same (including an item in a different profile with the same itemid), the guid would be different. astring getitemguid( in long long aitemid ); parameters aitemid the id of the item to get the guid for. return value returns the guid string. getitemidforguid() obsolete since ...
...dded ); parameters aitemid the id of the item whose added date time is to be set. adateadded the added date of the item. setitemguid() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)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. this method sets a
globally unique identifier. this can be useful when a sync algorithm deems two independently created items (on different profiles) to be the same item. void setitemguid( in long long aitemid, in astring aguid ); parameters aitemid the id of the item to set the guid of. aguid the guid string. setitemindex() this method changes the index for a item. this method does not change the indices ...
nsIPushService
omponents.issuccesscode(code)) { cu.reporterror("error unsubscribing: " + code); return; } // `ok === true` if the subscription was removed, or `false` if the // `(scope, principal)` pair didn't have a subscription. } ); receiving push messages subscriptions created from privileged code use xpcom observer notifications instead of service worker events. you can use the
global nsiobserverservice to listen for these notifications. messages sent to system subscriptions are broadcasted to all push-message observers. your nsiobserver should ensure the data parameter matches your subscription scope. otherwise, your code may try to handle messages meant for other subscriptions. topic subject data description push api counterpart push-message...
...uld ensure the data parameter matches your subscription scope. otherwise, your code may try to handle messages meant for other subscriptions. topic subject data description push api counterpart push-message nsipushmessage if the message has a payload; null for blank messages. scope fired when a push message is sent to a system subscription. serviceworker
globalscope.onpush push-subscription-change null scope fired when the push server drops a subscription, or the subscription identifier changes. serviceworker
globalscope.onpushsubscriptionchange please make sure you listen for push-subscription-change. if the subscription is lost, and your code isn't listening for this notification, you won't be able to receive messages until...
nsIServiceManager
the service manager depends on the repository to find and instantiate factories to obtain services. ...
...ervice hasn't been instantiated. ns_nointerface indicates that the iid given isn't supported. remarks the service manager depends on the repository to find and instantiate factories to obtain services. because services are instantiated lazily, methods are provided to test whether or not a service has already been instantiated. users of the service manager must first obtain a pointer to the
global service manager by calling ns_getservicemanager. after that, they can request specific services by calling getservice(). when they are finished they should call nsisupports.release() on the service as they would with any interface pointer. in some language bindings, such as javascript, this step is unnecessary. and, moreover such languages typically offer more convenient mechanisms to acquire ref...
nsIStringBundleService
tring aurlspec); 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 t...
...strykey ); 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 received by a nsiprogresseventsink's onstatus method. wstring formatstatusmessage( in nsresult astatus, in wstring astatusarg ); parameters astatus the status code. this is mapped into a string id and an...
Creating a gloda message query
see the gloda page for background on the component. see gloda examples for more code samples. creating your first message query... import gloda gloda's api is exposed in the "gloda" object that is contributed to your namespace. ...
...each message is a glodamessage, whose database-row attributes are implemented/defined in gloda's datamodel.js. however, many attributes are dynamically contributed by built-in logic (fundattr.js and explattr.js) as well as other exte...
Using Objective-C from js-ctypes
reates a c block instance from a js function. * blocks are regular objective-c objects in obj-c, and can be sent messages; * thus block instances need are creted using the core.wrapid() function. */ // apple docs :: working with blocks - https://developer.apple.com/library/ios/documentation/cocoa/conceptual/programmingwithobjectivec/workingwithblocks/workingwithblocks.html var _nsconcrete
globalblock = ctypes.open(ctypes.libraryname('objc')).declare('_nsconcrete
globalblock', ctypes.voidptr_t); // //github.com/realityripple/uxp/blob/master/js/src/ctypes/library.cpp?offset=0#271 /** * the "block descriptor" is a static singleton struct. probably used in more * complex block scenarios involving actual closure variables needing storage * (in `nodobjc`, javascript closures are levera...
...uct is seen here in docs: http://clang.llvm.org/docs/block-abi-apple.html var block_literal_1 = ctypes.structtype('block_literal_1', [ { isa: ctypes.voidptr_t }, { flags: ctypes.int32_t }, { reserved: ctypes.int32_t }, { invoke: ctypes.voidptr_t }, { descriptor: block_descriptor_1.ptr } ]); var block_const = { block_has_copy_dispose: 1 << 25, block_has_ctor: 1 << 26, block_is_
global: 1 << 28, block_has_stret: 1 << 29, block_has_signature: 1 << 30 }; // based on work from here: https://github.com/trueinteractions/tint2/blob/f6ce18b16ada165b98b07869314dad1d7bee0252/modules/bridge/core.js#l370-l394 var bl = block_literal_1(); // set the class of the instance bl.isa = _nsconcrete
globalblock; //
global flags bl.flags = block_const.block_has_stret; bl.reserved = 0; ...
Plug-in Side Plug-in API - Plugins
out to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. np_getvalue allows the browser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. np_initialize provides
global initialization for a plug-in. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print requests a platform-specific print operation for an embedded or full-screen plug-in. npp_setvalue sets information about the plug-in. npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed. np_shutdown provid...
...itialization for a plug-in. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print requests a platform-specific print operation for an embedded or full-screen plug-in. npp_setvalue sets information about the plug-in. npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed. np_shutdown provides
global deinitialization for a plug-in. npp_streamasfile provides a local file name for the data from a stream. npp_urlnotify notifies the instance of the completion of a url request. npp_write delivers data to a plug-in instance. npp_writeready determines maximum number of bytes that the plug-in can consume. « previousnext » ...
Debugger.Frame - Firefox Developer Tools
invocation. accessor properties of the debugger.frame prototype object a debugger.frame instance inherits the following accessor properties from its prototype: type a string describing what sort of frame this is: "call": a frame running a function call. (we may not be able to obtain frames for calls to host functions.) "eval": a frame running code passed to eval. "
global": a frame running
global code (javascript that is neither of the above). "module": a frame running code at the top level of a module. "wasmcall": a frame running a webassembly function call. "debugger": a frame for a call to user code invoked by the debugger (see the eval method below). implementation a string describing which tier of the javascript engine this ...
...ation created this frame, as a debuggee value, or null if this is not a "call" frame. generator true if this frame is a generator frame, false otherwise. constructing true if this frame is for a function called as a constructor, false otherwise. arguments the arguments passed to the current frame, or null if this is not a "call" frame. when non-null, this is an object, allocated in the same
global as the debugger, with array.prototype on its prototype chain, a non-writable length property, and properties whose names are array indices. each property is a read-only accessor property whose getter returns the current value of the corresponding parameter. when the referent frame is popped, the argument value’s properties’ getters throw an error. handler methods of debugger.frame instances...
Debugger.Memory - Firefox Developer Tools
nstance, 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 instancedbg; and dbg.memory.trackingallocationsites is set to true. a bernoulli trial succeeds, with probability equal to the maximum of d.memory.allocationsamplingprobability of all debugger instances d that are observing the
global that this object is allocated within the scope of. given a debugger.object instancedobj referring to some ...
...ationsamplingprobability a number between 0 and 1 that indicates the probability with which each new allocation should be entered into the allocations log. 0 is equivalent to “never”, 1 is “always”, and .05 would be “one out of twenty”. the default is 1, or logging every allocation. note that in the presence of multiple debugger instances observing the same allocations within a
global’s scope, the maximum allocationsamplingprobability of all the debuggers is used. maxallocationsloglength the maximum number of allocation sites to accumulate in the allocations log at a time. this accessor can be both fetched and stored to. its default value is 5000. allocationslogoverflowed returns true if there have been more than [maxallocationsloglength][#max-alloc-log] allocations si...
Debugger.Script - Firefox Developer Tools
f this is a function’s script, this is the index of the start of the function token in the source code. if the instance refers to webassembly code, throw a typeerror. sourcelength if the instance refers to a jsscript, the length, in characters, of this script’s code within the debugger.source instance given by source. if the instance refers to webassembly code, throw a typeerror.
global if the instance refers to a jsscript, a debugger.object instance referring to the
global object in whose scope this script runs. the result refers to the
global directly, not via a wrapper or a windowproxy (“outer window”, in firefox). if the instance refers to webassembly code, throw a typeerror. format if the instance refers to a jsscript, "js". if the instance refers to webass...
...ct. breakpoint handler method calls are cross-compartment, intra-thread calls: the call takes place in the same thread that hit the breakpoint, and in the compartment containing the handler function (typically the debugger’s compartment). the new breakpoint belongs to the debugger instance to which this script belongs. disabling the debugger instance disables this breakpoint; and removing a
global from the debugger instance’s set of debuggees clears all the breakpoints belonging to that debugger instance in that
global’s scripts. getbreakpoints([offset]) if the instance refers to a jsscript, return an array containing the handler objects for all the breakpoints set atoffset in this script. ifoffset is omitted, return the handlers of all breakpoints set anywhere in this script. if...
Tutorial: Set a breakpoint - Firefox Developer Tools
appear at the top of the toolbox alongside the console, debugger, and memory panels. click on the scratchpad panel and enter the following code: components.utils.import("resource://gre/modules/jsdebugger.jsm"); components.utils.import("resource://gre/modules/console.jsm"); // this simply defines 'debugger' in this scratchpad; // it doesn't actually start debugging anything. adddebuggerto
global(this); // create a 'debugger' instance. var dbg = new debugger; // make the tab's top window a debuggee, and get a // debugger.object referring to the window. var windowdo = dbg.adddebuggee(tabs[0].content); // get a debugger.object referring to the window's `report` // function. var reportdo = windowdo.getownpropertydescriptor('report').value; // set a breakpoint at the entry point of `repor...
...reakpoint in report, and it will trigger along with the first two. keep in mind, however, that when multiple debuggers share a debuggee, the order in which their handlers run is not specified. if more than one tool tries to influence the debuggee’s behavior, their combined behavior could be unpredictable. close the web page and the browser content toolbox. since both the scratchpad’s
global object and the debuggee window are now gone, the debugger instances will be garbage collected, since they can no longer have any visible effect on firefox’s behavior. the debugger api tries to interact with garbage collection as transparently as possible; for example, if both a debugger.object instance and its referent are not reachable, they will both be collected, even while the debugger inst...
Debugger-API - Firefox Developer Tools
a debugger.frame represents a running stack frame. you can use these to walk the stack and find each frame’s script and environment. you can also set onstep and onpop handlers on frames. a debugger.environment represents an environment, associating variable names with storage locations. environments may belong to a running stack frame, captured by a function 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. o...
...ome of debugger’s features: setting a breakpoint in a page, running a handler function when it is hit that evaluates an expression in the page’s context. showing how many objects different call paths allocate. gecko-specific features while the debugger core api deals only with concepts common to any javascript implementation, it also includes some gecko-specific features: [
global tracking][
global] supports debugging all the code running in a gecko instance at once—the ‘chrome debugging’ model. [object wrapper][wrapper] functions help manipulate object references that cross privilege boundaries. source metadata generated from file: js/src/doc/debugger/debugger-api.md watermark: sha256:6ee2381145a0d2e53d2f798f3f682e82dd7ab0caa0ac4dd5e56601c2e49913a7 change...
Migrating from Firebug - Firefox Developer Tools
functions). to improve the ui of the devtools, there is also a request to add an events side panel to them like the one in firebug (see bug 1226640). stop script execution on dom mutation in firebug you can break on dom mutations, that means that when an element is changed, the script execution is stopped at the related line within the javascript file, which caused the change. this feature can
globally be enabled via the break on mutate button, or individually for each element and for different types of changes like attribute changes, content changes or element removal. unfortunately, the devtools do not have this feature yet (see bug 1004678). to stop the script execution there, you need to set a breakpoint on the line with the modification within the debugger panel. search for elements via...
...ug displays the function call stack within its stack side panel. in there the functions are listed together with their call parameters. in the devtools the function call stack is shown within the call stack side panel. to see the call parameters in the devtools, you need to have a look at the variables side panel. examine variables the watch side panel in firebug displays the window object (the
global scope) by default. with the script execution halted it shows the different variable scopes available within the current call stack frame. furthermore, it allows you to add and manipulate watch expressions. the devtools have a variables side panel, which works basically the same. the main difference is that it is empty when the script execution is not stopped, i.e. it doesn't display the window ob...
Network request details - Firefox Developer Tools
ns; preload" }, { "name": "vary", "value": "accept-encoding,treat-as-untrusted,x-forwarded-proto,cookie,authorization,x-seven" }, { "name": "via", "value": "1.1 varnish (varnish/5.1), 1.1 varnish (varnish/5.1)" }, { "name": "x-analytics", "value": "ns=-1;special=badtitle;wmf-last-access=11-jun-2019;wmf-last-access-
global=11-jun-2019;https=1" }, { "name": "x-cache", "value": "cp1075 pass, cp1075 pass" }, { "name": "x-cache-status", "value": "pass" }, { "name": "x-client-ip", "value": "204.210.158.136" }, { "name": "x-content-type-options", "value": "nosniff" }, { "name": "x-firefox-sp...
... "name": "accept", "value": "*/*" }, { "name": "accept-encoding", "value": "gzip, deflate, br" }, { "name": "accept-language", "value": "en-us,en;q=0.5" }, { "name": "connection", "value": "keep-alive" }, { "name": "cookie", "value": "wmf-last-access=11-jun-2019; wmf-last-access-
global=11-jun-2019; mwphp7seed=5c9; geoip=us:ny:port_jervis:41.38:-74.67:v4" }, { "name": "dnt", "value": "1" }, { "name": "host", "value": "en.wikipedia.org" }, { "name": "referer", "value": "https://www.wikipedia.org/" }, { "name": "te", "value": "trailers" }, { "name": "...
Console messages - Firefox Developer Tools
isclosure triangle lets you display it, in an embedded panel that is identical to the network monitor request details. uri the target uri. summary the http version, response code, and time taken to complete. clicking the response code takes you to the reference page for that code. the context menu for network messages includes a few extra items in addition the
globally-available ones: copy link location acts as you would expect, copying the url into the clipboard open in network panel switches context to the network tab, selects the request and shows you the details resend request sends the network request again. open url in new tab opens the url in a new browser tab. if the resource is an image, the image will be opened in a new tab. if the resou...
...ode, see the chrome logger documentation. interpreter input/output commands sent to the browser using the web console's javascript interpreter, and the corresponding responses, are logged in the console messages. for responses that contain objects or variables, the following context menu options are available: reveal in inspector shows the selected dom node in the inspector pane. store as
global variable creates a
global variable (with a name like temp0, temp1, etc.) whose value is the selected object. the name of the variable appears as an input to the interpreter, and its value appears as a response. copy object copies the selected object to the clipboard. filtering and searching filtering by category you can use the toolbar along the top to constrain the results displayed. to ...
The JavaScript input interpreter - Firefox Developer Tools
the cd() function to change the console's scope to a specific iframe, and then you can execute functions defined in the document hosted by that iframe. ...
... $(selector, element) looks up a css selector string selector , returning the first node descended from element that matches. if unspecified, element defaults t...
AbstractRange - Web APIs
the browser simply isn't thinking in terms of html. once it's been loaded, the page is a tree of dom node objects, so you need to specify the beginning and ending locations of a range in terms of nodes and positions within nodes. second, in order to support the mutability of the dom tree as much as possible, you need a way to represent positions relative to nodes in the tree, rather than simply
global positions within the entire document. by defining points within the document as offsets within a given node, those positions remain consistent with the content even as nodes are added to, removed from, or moved around within the dom tree—within reason. there are fairly obvious limitations (such as if a node is moved to be after the endpoint of a range, or if the content of a node is heavily alt...
...he dom tree—within reason. there are fairly obvious limitations (such as if a node is moved to be after the endpoint of a range, or if the content of a node is heavily altered), but it's far better than nothing. third, using node-relative positions to define the start and end positions will generally be easier to make perform well. rather than having to negotiate the dom figuring out what your
global offset refers to, the user agent (browser) can instead go directly to the node indicated by the starting position and start from there, working its way forward until it reaches the given offset into the ending node. to illustrate this, consider the html below: <div class="container"> <div class="header"> <img src="" class="sitelogo"> <h1>the ultimate website</h1> </div> <article> ...
AudioWorklet - Web APIs
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. ...
... 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. ...
AudioWorkletProcessor - Web APIs
in turn, an audioworkletnode based on it runs on the main thread. constructor the audioworkletprocessor and classes that derive from it cannot be instantiated directly from a user-supplied code. instead, they are created only internally by the creation of an associated audioworkletnodes. ...
...l be passed into the process() method of the processor for you to shape the node output accordingly. processing audio an example algorithm of creating a custom audio processing mechanism is: create a separate file; in the file: extend the audioworkletprocessor class (see "deriving classes" section) and supply your own process() method in it; register the processor using audioworklet
globalscope.registerprocessor() method; load the file using addmodule() method on your audio context's audioworklet property; create an audioworkletnode based on the processor. the processor will be instantiated internally by the audioworkletnode constructor. connect the node to the other nodes. examples in the example below we create a custom audioworkletnode that outputs white noise. first...
Beacon API - Web APIs
ed during the unload. another technique is to create a no-op loop for several seconds within the unload handler to delay the unload and submit data to a server. not only do these techniques represent poor coding patterns, some of them are unreliable and result in the perception of poor page load performance for the next navigation. the beacon api provides a standard way to address these issues.
global context the beacon api's navigator.sendbeacon() method is used to send a beacon of data to the server in the
global browsing context. the method takes two arguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns "true" ...
...rguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns "true" and returns "false" otherwise. worker context the beacon api's navigator.sendbeacon() method is used to send a beacon of data to the server from the worker
global scope. the method takes two arguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns "true" and otherwise returns "false". ...
CanvasRenderingContext2D - Web APIs
nsform() multiplies the current transformation matrix with the matrix described by its arguments. canvasrenderingcontext2d.settransform() resets the current transform to the identity matrix, and then invokes the transform() method with the same arguments. canvasrenderingcontext2d.resettransform() resets the current transform by the identity matrix. compositing canvasrenderingcontext2d.
globalalpha alpha value that is applied to shapes and images before they are composited onto the canvas. default 1.0 (opaque). canvasrenderingcontext2d.
globalcompositeoperation with
globalalpha applied this sets how shapes and images are drawn onto the existing bitmap. drawing images canvasrenderingcontext2d.drawimage() draws the specified image. this method is available in multiple formats, pr...
...is are deprecated and were removed shortly after chrome 36. canvasrenderingcontext2d.clearshadow() removes all shadow settings like canvasrenderingcontext2d.shadowcolor and canvasrenderingcontext2d.shadowblur. canvasrenderingcontext2d.drawimagefromrect() this is redundant with an equivalent overload of drawimage. canvasrenderingcontext2d.setalpha() use canvasrenderingcontext2d.
globalalpha instead. canvasrenderingcontext2d.setcompositeoperation() use canvasrenderingcontext2d.
globalcompositeoperation instead. canvasrenderingcontext2d.setlinewidth() use canvasrenderingcontext2d.linewidth instead. canvasrenderingcontext2d.setlinejoin() use canvasrenderingcontext2d.linejoin instead. canvasrenderingcontext2d.setlinecap() use canvasrenderingcontext2d.linecap ...
Basic animations - Web APIs
w image(); var earth = new image(); function init() { sun.src = 'https://mdn.mozillademos.org/files/1456/canvas_sun.png'; moon.src = 'https://mdn.mozillademos.org/files/1443/canvas_moon.png'; earth.src = 'https://mdn.mozillademos.org/files/1429/canvas_earth.png'; window.requestanimationframe(draw); } function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.
globalcompositeoperation = 'destination-over'; ctx.clearrect(0, 0, 300, 300); // clear canvas ctx.fillstyle = 'rgba(0, 0, 0, 0.4)'; ctx.strokestyle = 'rgba(0, 153, 255, 0.4)'; ctx.save(); ctx.translate(150, 150); // earth var time = new date(); ctx.rotate(((2 * math.pi) / 60) * time.getseconds() + ((2 * math.pi) / 60000) * time.getmilliseconds()); ctx.translate(105, 0); ctx.fillrec...
... var x = math.random() * (innerwidth - 2 * r) + r; var y = math.random() * (innerheight - 2 * r) + r; var t = new ob(innerwidth / 2,innerheight / 2,5,"red",math.random() * 200 + 20,2); a.push(t); } //cn.style.backgroundcolor = "#700bc8"; c.linewidth = "2"; c.
globalalpha = 0.5; resize(); anim() } window.onresize = function() { resize(); } function resize() { cn.height = innerheight; cn.width = innerwidth; for (var i = 0; i < 101; i++) { var r = 30; var x = math.random() * (in...
Transformations - Web APIs
the canvas. restore() restores the most recently saved canvas state. canvas states are stored on a stack. every time the save() method is called, the current drawing state is pushed onto the stack. a drawing state consists of the transformations that have been applied (i.e. translate, rotate and scale – see below). the current values of the following attributes: strokestyle, fillstyle,
globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor,
globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. the current clipping path, which we'll see in the next section. you can call the save() method as many times as you like. each time the restore() method is called, the last saved state i...
...); ctx.fillrect(0, 0, 150, 150); // draw a rectangle with default settings ctx.save(); // save the default state ctx.fillstyle = '#09f'; // make changes to the settings ctx.fillrect(15, 15, 120, 120); // draw a rectangle with new settings ctx.save(); // save the current state ctx.fillstyle = '#fff'; // make changes to the settings ctx.
globalalpha = 0.5; ctx.fillrect(30, 30, 90, 90); // draw a rectangle with new settings ctx.restore(); // restore previous state ctx.fillrect(45, 45, 60, 60); // draw a rectangle with restored settings ctx.restore(); // restore original state ctx.fillrect(60, 60, 30, 30); // draw a rectangle with restored settings } <canvas id="canvas" width="150" height="1...
console - Web APIs
it's exposed as window.console, and can be referenced as simply console. ...
...it's exposed as window.console, and can be referenced as simply console. ...
Content Index API - Web APIs
content index api defines the object used to represent the contentdelete event. service worker additions the following additions to the serviceworker have been specified in the content index api spec to provide an entry point for using content indexing. serviceworkerregistration.index read only returns a reference to the contentindex interface for indexing cached pages. serviceworker
globalscope.oncontentdelete an event handler fired whenever a contentdelete event occurs. this happens when content is removed by the user agent. examples all the following examples assume a service worker has been registered. for more information see the service worker api. feature detection and interface access here we get a reference to the serviceworkerregistration, then check for the index p...
... function unregistercontent(article) { // reference registration const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) return; // unregister content from index await registration.index.delete(article.id); } all the above methods are available within the scope of the service worker. they are accessible from the worker
globalscope.self property: // service worker script self.registration.index.add(item); self.registration.index.delete(item.id); const contentindexitems = self.registration.index.getall(); contentdelete event when an item is removed from the user agent interface, a contentdelete event is received by the service worker. self.addeventlistener('contentdelete', (event) => { console.log(event.id); ...
DOMHighResTimeStamp - Web APIs
f milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. the starting time can be either a specific time determined by the script for a site or app, or the time origin. the time origin the time origin is a standard time which is considered to be the beginning of the current document's lifetime. it's calculated like this: if the script's
global object is a window, the time origin is determined as follows: if the current document is the first one loaded in the window, the time origin is the time at which the browser context was created. if during the process of unloading the previous document which was loaded in the window, a confirmation dialog was displayed to let the user confirm whether or not to leave the previous page, the...
...mation dialog was displayed to let the user confirm whether or not to leave the previous page, the time origin is the time at which the user confirmed that navigating to the new page was acceptable. if neither of the above determines the time origin, then the time origin is the time at which the navigation responsible for creating the window's current document took place. if the script's
global object is a worker
globalscope (that is, the script is running as a web worker), the time origin is the moment at which the worker was created. in all other cases, the time origin is undefined. methods this type has no methods. usage notes you can get the current timestamp value—the time that has elapsed since the context was created—by calling the performance method now(). this method i...
Document: transitioncancel event - Web APIs
you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitioncancel. ...
...you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitioncancel. ...
FetchEvent.respondWith() - Web APIs
the respondwith() method of fetchevent prevents the browser's default fetch handling, and allows you to provide a promise for a response yourself. in most cases you can provide any response that the receiver understands. for example, if an <img> initiates the request, the response body needs to be image data. for security reasons, there are a few
global rules: you can only return response objects of type "opaque" if the fetchevent.request object's mode is "no-cors". this prevents the leaking of private data. you can only return response objects of type "opaqueredirect" if the fetchevent.request object's mode is "manual". you cannot return response objects of type "cors" if the fetchevent.request object's mode is "same-origin". specifying the final url of a resource from firefox 59 onw...
...respondwith( // promise that resolves to a response. ); parameters a response or a promise that resolves to a response. otherwise, a network error is returned to fetch. return value undefined. exceptions exception notes networkerror a network error is triggered on certain combinations of fetchevent.request.mode and response.type values, as hinted at in the "
global rules" listed above. invalidstateerror the event has not been dispatched or respondwithwith() has already been invoked. examples this fetch event tries to return a response from the cache api, falling back to the network otherwise. addeventlistener('fetch', event => { // prevent the default, and handle the request ourselves. event.respondwith(async function() { // try...
Fetch API - Web APIs
ify requests and responses, or any kind of use case that might require you to generate your responses programmatically (that is, the use of computer program or personal programming instructions). it also defines related concepts such as cors and the http origin header semantics, supplanting their separate definitions elsewhere. for making a request and fetching a resource, use the windoworworker
globalscope.fetch() method. it is implemented in multiple interfaces, specifically window and worker
globalscope. this makes it available in pretty much any context you might want to fetch resources in. the fetch() method takes one mandatory argument, the path to the resource you want to fetch. it returns a promise that resolves to the response to that request, whether it is successful or not. you can a...
...using the fetch api features in using fetch, and study concepts in fetch basic concepts. aborting a fetch browsers have started to add experimental support for the abortcontroller and abortsignal interfaces (aka the abort api), which allow operations like fetch and xhr to be aborted if they have not already completed. see the interface pages for more details. fetch interfaces windoworworker
globalscope.fetch() the fetch() method used to fetch a resource. headers represents response/request headers, allowing you to query them and take different actions depending on the results. request represents a resource request. response represents the response to a request. fetch mixin body provides methods relating to the body of the response/request, allowing you to declare what its cont...
Introduction to the File and Directory Entries API - Web APIs
in either the document or webworkers context, while the synchronous api is for use with webworkers only. callbacks. the asynchronous api doesn't give you data by returning values; instead, you have to pass a callback function. you send requests for operations to happen, and get notified by callbacks. in contrast, the synchronous api does not use callbacks because the api methods return values.
global methods of the asynchronous and synchronous apis. the asynchronous api has the following
global methods: requestfilesystem() and resolvelocalfilesystemurl(). these methods are members of both the window object and the worker
global scope. the synchronous api, on the other hand, uses the following methods: requestfilesystemsync() and resolvelocalfilesystemsyncurl(). these synchronous methods are...
... the synchronous api can be simpler for some tasks. its direct, in-order programming model can make code easier to read. the drawback of synchronous api has to do with its interactions with web workers, which has some limitations. ...
File and Directory Entries API - Web APIs
ling filesystemdirectoryentry.createreader(), this interface provides the functionality which lets you read the contents of a directory. filesystemflags defines a set of values which are used when specifying option flags when calling certain methods in the file and directory entries api. fileerror represents an error which is generated by asynchronous file system calls. there are also two
global functions (which are not part of the specification at this time and are implemented only by google chrome). they're available on the window object and implemented in localfilesystem: requestfilesystem() and resolvelocalfilesystemurl(). synchronous api the synchronous api is should only be used in workers; these calls block until they're finished executing, and simply return the results instead ...
...ile in a file system. filesystemdirectoryentrysync represents a single directory in a file system. filesystemdirectoryreadersync created by calling filesystemdirectoryentrysync.createreader(), this interface provides the functionality which lets you read the contents of a directory. fileexception represents an error which is generated by synchronous file system calls. there are also two
global functions (which are not part of the specification at this time and are implemented only by google chrome). they're available on the worker object and implemented in localfilesystemsync: requestfilesystemsync() and resolvelocalfilesystemsyncurl(). other interfaces localfilesystem gives you access to a sandboxed file system. localfilesystemsync lockedfile provides tools to deal with a gi...
HTMLElement: transitioncancel event - Web APIs
the transitioncancel event is fired when a css transition is canceled. see
globaleventhandlers.ontransitioncancel for more information. ...
... the transitioncancel event is fired when a css transition is canceled. see
globaleventhandlers.ontransitioncancel for more information. ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
script promises and the mutation observer api both use the microtask queue to run their callbacks, but there are other times when the ability to defer work until the current event loop pass is wrapping up. in order to allow microtasks to be used by third-party libraries, frameworks, and polyfills, the queuemicrotask() method is exposed on the window and worker interfaces through the windoworworker
globalscope mixin. tasks vs microtasks to properly discuss microtasks, it's first useful to know what a javascript task is and how microtasks differ from tasks. this is a quick, simplified explanation, but if you would like more details, you can read the information in the article in depth: microtasks and the javascript runtime environment. tasks a task is any javascript code which is scheduled to b...
... the callback are reported as rejected promises rather than being reported as standard exceptions. also, creating and destroying promises takes additional overhead both in terms of time and memory that a function which properly enqueues microtasks avoids. simply pass the javascript function to call while the context is handling microtasks into the queuemicrotask() method, which is exposed on the
global context as defined by either the window or worker interface, depending on the current execution context. queuemicrotask(() => { /* code to run in the microtask here */ }); the microtask function itself takes no parameters, and does not return a value. when to use microtasks in this section, we'll take a look at scenarios in which microtasks are particularly useful. generally, it's about ca...
The HTML DOM API - Web APIs
ment 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 the node interface are also available to html elements, allowing them to be nested within each other...
... provides the ability for web sites to store data either temporarily or permanently on the user's device for later re-use. storage storageevent web workers interfaces these interfaces are used by the web_workers_api both to establish the ability for workers to interact with an app and its content, but also to support messaging between windows or apps. broadcastchannel dedicatedworker
globalscope messagechannel messageevent messageport sharedworker sharedworker
globalscope worker worker
globalscope workerlocation workernavigator websocket interfaces these interfaces, defined by the html specification, are used by the websockets_api. closeevent websocket server-sent events interfaces the eventsource interface represents the source which sent or is sending server-s...
File drag and drop - Web APIs
es are welcome). note: html drag and drop defines two different apis to support dragging and dropping files. one api is the datatransfer interface and the second api is the datatransferitem and datatransferitemlist interfaces. this example illustrates the use of both apis (and does not use any gecko specific interfaces). define the drop zone the target element of the drop event needs an ondrop
global event handler. the following code snippet shows how this is done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior. to add this handler, you need to include...
.... the following code snippet shows how this is done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior. to add this handler, you need to include a ondragover
global event handler: <div id="drop_zone" ondrop="drophandler(event);" ondragover="dragoverhandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> lastly, an application may want to style the drop target element to visually indicate the element is a drop zone. in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: ...
HTML Drag and Drop API - Web APIs
op uses the dom event model and drag events inherited from mouse events. a typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element. during drag operations, several event types are fired, and some events might fire many times, such as the drag and dragover events. each drag event type has an associated
global event handler: event on event handler fires when… drag ondrag …a dragged item (element or text selection) is dragged. dragend ondragend …a drag operation ends (such as releasing a mouse button or hitting the esc key; see finishing a drag.) dragenter ondragenter …a dragged item enters a valid drop target. (see specifying drop...
...ormation, 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. ...
InstallEvent - Web APIs
as a child of extendableevent, it ensures that functional events such as fetchevent are not dispatched during installation. this interface inherits from the extendableevent interface. ...
...nt 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 serviceworker
globalscope.oninstall and delays treating the serviceworkerregistration.installing worker as installed until the passed promise resolves successfully. the promise resolves when all resources have been fetched and cached, or when any exception occurs. the code snippet also shows a best practice for versioning caches used by the service worker. although this example has only one cache, you can use this a...
LocalFileSystemSync - Web APIs
plemented by worker objects. about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011. this specification is more or less abandonned, failing to get significant traction. basic concepts you can request access to a sandboxed file system by requesting localfilesystemsync object from within a web worker. the
global methods in the window object requestfilesystemsync() and resolvelocalfilesystemsyncurl() methods are exposed to the worker's
global scope. calling window.requestfilesystemsync() for creates new storage for your web app. for more concepts, see the counterpart article for the asynchronous api. example //taking care of the browser-specific prefix window.requestfilesystemsync = window.requestfile...
... 0 transient storage that can be be removed by the browser at its discretion. persistent 1 storage that stays in the browser unless the user or the app expunges it. methods requestfilesystemsync() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystemsync object from within a web worker using this
global method, window.requestfilesystemsync(). [ research ] filesystemsync requestfilesystemsync( in unsigned short type, in unsigned long long size ); parameters type the storage type of the file system. the values can be either temporary or persistent. size the storage space—in bytes—that you need for your app. returns filesystemsync an object that represents the file system. e...
MathMLElement - Web APIs
the mathmlelement interface represents any mathml element. ...
... the mathmlelement interface represents any mathml element. ...
Recording a media element - Web APIs
let preview = document.getelementbyid("preview"); let recording = document.getelementbyid("recording"); let startbutton = document.getelementbyid("startbutton"); let stopbutton = document.getelementbyid("stopbutton"); let downloadbutton = document.getelementbyid("downloadbutton"); let logelement = document.getelementbyid("log"...
...} .left { margin-right: 10px; float: left; width: 160px; padding: 0px; } .right { margin-left: 10px; float: left; width: 160px; padding: 0px; } .bottom { clear: both; padding-top: 10px; } javascript content now let's have a look at the javascript code; this is where the majority of the action happens, after all! setting up
global variables we start by establishing some
global variables we'll need. let preview = document.getelementbyid("preview"); let recording = document.getelementbyid("recording"); let startbutton = document.getelementbyid("startbutton"); let stopbutton = document.getelementbyid("stopbutton"); let downloadbutton = document.getelementbyid("downloadbutton"); let logelement = document.getelementbyid("log"); let recordingtimems = 5000; most of these ...
MessageEvent - Web APIs
n: server-sent events (see eventsource.onmessage). web sockets (see the onmessage property of the websocket interface). cross-document messaging (see window.postmessage() and window.onmessage). channel messaging (see messageport.postmessage() and messageport.onmessage). cross-worker/document messaging (see the above two entries, but also worker.postmessage(), worker.onmessage, serviceworker
globalscope.onmessage, etc.) broadcast channels (see broadcastchannel.postmessage()) and broadcastchannel.onmessage). webrtc data channels (see rtcdatachannel.onmessage). the action triggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). note: this feature is available in web workers. <div id="i...
...the ports associated with that worker are accessible in the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { ...
NotificationEvent - Web APIs
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. ...
...return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment notifications apithe definition of 'notificationevent' in that specification. living standard living standard. note: this interface is specified in the notifications api, but accessed through serviceworker
globalscope. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnotificat...
Multi-touch interaction - Web APIs
ent multi-touch interactions. define touch targets the application uses <div> to define three different touch target areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: 1px solid black; } #target2 { background: white; border: 1px solid black; } #target3 { background: white; border: 1px solid black; } </style>
global state to support multi-touch interaction, preserving a pointer's event state during various event phases is required. this application uses three arrays to cache event state, one cache per target element. // log events flag var logevents = false; // event caches, one per touch target var evcache1 = new array(); var evcache2 = new array(); var evcache3 = new array(); register event handlers ...
... me 3</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved with the event flow. cache management these functions manage the
global event caches evcache1, evcache2 and evcache3. function get_cache(ev) { // return the cache for this event's target element switch(ev.target.id) { case "target1": return evcache1; case "target2": return evcache2; case "target3": return evcache3; default: log("error with cache handling",ev); } } function push_event(ev) { // save this event in the target's cache var cache = get_ca...
Pinch zoom gestures - Web APIs
ement's background color to lightblue. the pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the target element's background color to pink. define touch target the application uses <div> to define the pointers' target areas. <style> div { margin: 0em; padding: 2em; } #target { background: white; border: 1px solid black; } </style>
global state supporting a two-pointer gesture requires preserving a pointer's event state during various event phases. this application uses two
global variables to cache the event state. //
global vars to cache event state var evcache = new array(); var prevdiff = -1; register event handlers event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup. the...
...ut).</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved in the event flow. cache management this function helps manage the
global event caches evcache. function remove_event(ev) { // remove this event from the target's cache for (var i = 0; i < evcache.length; i++) { if (evcache[i].pointerid == ev.pointerid) { evcache.splice(i, 1); break; } } } event logging these functions are used to send event activity to the application's window (to support debugging and learning about the event flow). // log eve...
Pointer events - Web APIs
vices are mouse, pen/stylus, and touch contacts. pointer capture pointer capture allows the events for a pointer to be retargeted to a particular element other than the normal hit test result of the pointer's location. pointer event a dom event fired for a pointer. interfaces the primary interface 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 ...
...ne containing both the pointer (e.g. pen stylus) axis and the x axis. twist the clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees, with a value in the range 0 to 359. pointertype indicates the device type that caused the event (mouse, pen, touch, etc.) isprimary indicates if the pointer represents the primary pointer of this pointer type. event types and
global event handlers pointer events have ten event types, seven of which have similar semantics to their mouse event counterparts (down, up, move, over, out, enter, and leave). below is a short description of each event type and its associated
global event handler. event on event handler description pointerover onpointerover fired when a pointer is moved into an ele...
Request - Web APIs
e request() constructor (for an image file in the same directory as the script), then return some property values of the request: const request = new request('https://www.mozilla.org/favicon.ico'); const url = request.url; const method = request.method; const credentials = request.credentials; you could then fetch this request by passing the request object in as a parameter to a windoworworker
globalscope.fetch() call, for example: fetch(request) .then(response => response.blob()) .then(blob => { image.src = url.createobjecturl(blob); }); in the following snippet, we create a new request using the request() constructor with some initial data and body content for an api request which need a body payload: const request = new request('https://example.com', {method: 'post', body: '{"...
...od = request.method; const credentials = request.credentials; const bodyused = request.bodyused; note: the body type can only be a blob, buffersource, formdata, urlsearchparams, usvstring or readablestream type, so for adding a json object to the payload you need to stringify that object. you could then fetch this api request by passing the request object in as a parameter to a windoworworker
globalscope.fetch() call, for example and get the response: fetch(request) .then(response => { if (response.status === 200) { return response.json(); } else { throw new error('something went wrong on api server!'); } }) .then(response => { console.debug(response); // ... }).catch(error => { console.error(error); }); specifications specification ...
onnotificationclose - Web APIs
the serviceworker
globalscope.onnotificationclose property is an event handler called whenever the notificationclose event is dispatched on the serviceworker
globalscope object, that is when a user closes a displayed notification spawned by serviceworkerregistration.shownotification(). notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a close event on the notification object itself. note: trying to create a notification inside the serviceworker
globalscope using the notification() constructor will throw an error. syntax serviceworker
globalscope.onnotificationclose = function(notificationevent) { ... }; serviceworker
globalscope.addeventlistener('notificationclose', function(notificationevent) { ... });...
...r. self.onnotificationclose = function(event) { console.log('on notification close: ', event.notification.tag); }; specifications specification status comment notifications apithe definition of 'onnotificationclick' in that specification. living standard initial definition. this property is specified on the notifications_api even though it's part of serviceworker
globalscope. ...
SharedWorker() - Web APIs
/ seamonkey 2.7) and later accept data uris, that's not the case in all other browsers. syntax var myworker = new sharedworker(aurl, name); var 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 sharedworker
globalscope 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 dom...
...f worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the sharedworker
globalscope representing the scope of the worker, which is mainly useful for debugging purposes. return value the created worker. exceptions a securityerror is raised if the document is not allowed to start workers, for example if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should alwa...
WebGL best practices - Web APIs
nt between shaders, and you need it to have 32-bits, you must use highp or you will have portability problems. ...
... while you can use mediump float instead, but be aware that this often results in cor...
Starting up and shutting down a WebXR session - Web APIs
ed to create and set up the webxr session, and you should know how to shut it down properly as well. you will learn how to do these things in this article. accessing the webxr api your app's access to the webxr api begins with the xrsystem object. this object represents the overall webxr device suite available to you through the hardware and drivers available on the user's equipment. there is a
global xrsystem object available for use by your document through the the navigator property xr, which returns the xrsystem object if suitable xr hardware is available for your use given the hardware available and your document's environment. thus the simplest code that fetches the xrsystem object is: const xr = navigator.xr; the value of xr will be null or undefined if webxr isn't available. webxr ...
...": default: tempxr = navigator.xr; break; } return tempxr; } const xr = getxr("no"); // get the native xrsystem object const xr = getxr("yes"); // always returns an xrsystem from the polyfill const xr = getxr("if-needed"); // use the polyfill only if navigator.xr missing the returned xrsystem object can then be used according to the documentation provided here on mdn. the
global variable webxrpolyfill is used only to retain a reference to the polyfill in order to ensure that it remains available until you no longer need it. setting it to null signals that the polyfill can be garbage collected when no objects depending on it are using it anymore. of course, you can simplify this depending on your needs; since your app is probably not going to go back and forth much on wh...
Example and tutorial: Simple synth keyboard - Web APIs
te; right: 0; display: table-cell; vertical-align: middle; } .right span { vertical-align: middle; } .right input { vertical-align: baseline; } javascript the javascript code begins by initializing a number of variables. let audiocontext = new (window.audiocontext || window.webkitaudiocontext)(); let osclist = []; let mastergainnode = null; audiocontext is set to reference the
global audiocontext object (or webkitaudiocontext if necessary). osclist is set up to be ready to contain a list of all currently-playing oscillators. it starts off empty, since there are none playing yet. mastergainnode is set to null; during the setup process, it will be configured to contain a gainnode which all playing oscillators will connect to and play through to allow the overall volume to be ...
...s we'll need access to are obtained: keyboard is the container element into which the keys will be placed. wavepicker is the <select> element used to choose the waveform to use for the notes. volumecontrol is the <input> element (of type "range") used to control the master audio volume. let notefreq = null; let customwaveform = null; let sineterms = null; let cosineterms = null; finally,
global variables that will be used when constructing waveforms are created: notefreq will be an array of arrays; each array represents one octave, each of which contains one entry for each note in that octave. the value for each is the frequency, in hertz, of the note's tone. customwaveform will be set up as a periodicwave describing the waveform to use when the user selects "custom" from the wavefo...
Web Audio API - Web APIs
ct's audioworklet, and lets you add modules to the audio worklet to be executed off the main thread. audioworkletnode the audioworkletnode interface represents an audionode that is embedded into an audio graph and can pass messages to the corresponding audioworkletprocessor. ...
...e interface represents an audionode that is embedded into an audio graph and can pass messages to the corresponding audioworkletprocessor. audioworkletprocessor the audioworkletprocessor interface represents audio processing code running in a audioworklet
globalscope that generates, processes, or analyses audio directly, and can pass messages to the corresponding audioworkletnode. audioworklet
globalscope the audioworklet
globalscope interface is a worklet
globalscope-derived object representing a worker context in which an audio processing script is run; it is designed to enable the generation, processing, and analysis of audio data directly using javascript in a worklet thread rather than on the main thread. obsolete: script processor nodes before audio worklets were defined, the web au...
Web Authentication API - Web APIs
asymmetric key pair and safely store the private key for future reference. the public key will become part of the attestation, which the authenticator will sign over with a private key that was burned into the authenticator during its manufacturing process and that has a certificate chain that can be validated back to a root of trust. ...
...validated back to a root of trust. authenticator returns data to browser - the new public key, a
globally unique credential id, and other attestation data are returned to the browser where they become the attestationobject. browser creates final data, application sends response to server - the create() promise resolves to 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 finali...
Window.self - Web APIs
the window.self read-only property returns the window itself, as a windowproxy. it can be used with dot notation on a window object (that is, window.self) or standalone (self). the advantage of the standalone notation is that a similar notation exists for non-window contexts, such as in web workers. by using self, you can refer to the
global scope in a way that will work not only in a window context (self will resolve to window.self) but also in a worker context (self will then resolve to worker
globalscope.self). example uses of window.self like the following could just as well be replaced by window. if (window.parent.frames[0] != window.self) { // this window is not the first frame in the list } furthermore, when executing in the active document of a browsing context, window is a refe...
...indow.self) but also in a worker context (self will then resolve to worker
globalscope.self). example uses of window.self like the following could just as well be replaced by window. if (window.parent.frames[0] != window.self) { // this window is not the first frame in the list } furthermore, when executing in the active document of a browsing context, window is a reference to the current
global object and thus all of the following are equivalent: var w1 = window; var w2 = self; var w3 = window.window; var w4 = window.self; // w1, w2, w3, w4 all strictly equal, but only w2 will function in workers specifications specification status comment html living standardthe definition of 'window.self' in that specification. living standard no difference from the l...
Window: transitioncancel event - Web APIs
you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitioncancel. ...
...you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitioncancel. ...
Window.window - Web APIs
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'...
...le, "window.open('http://google.com/')". you'd have to use "open('http://google.com/')" instead. yet another reason to use this property, is for libraries which wish to offer oop-versions, and non-oop versions (especially javascript modules). for example, if we refer to "this.window.location.href", a javascript module could define a property called "window" inside of a class it defined (since no
global "window" variable exists for it by default) which could be created after passing in a window object to the module class' constructor. thus, "this.window" inside of its functions would refer to that window object. in the non-namespaced version, "this.window" would refer back to "window", and also be able to readily get the document location. another advantage, is that the objects of such a class ...
init() - Web APIs
initializes the object for use from c++ code. warning: this method must not be called from javascript. [noscript] void init( in nsiprincipal principal, in nsiscriptcontext scriptcontext, in nsi
globalobject
globalobject, in nsiuri baseuri, [optional] in nsiloadgroup loadgroup ); parameters principal the principal to use for the request; this must not be null. scriptcontext the script context to use for the request; this must not be null.
globalobject the object to use as the
global for our request. often, this is the outer window, but it may also be a sandbox or backstage pass. this may be null, but if it is, the request cannot create a document. prior to firefox 23, this was always a window. baseuri the base uri to use when resolving relative uris when handling t...
...ndow, but it may also be a sandbox or backstage pass. this may be null, but if it is, the request cannot create a document. prior to firefox 23, this was always a window. baseuri the base uri to use when resolving relative uris when handling the request. this may be null. loadgroup optional an optional load group used when performing the request. if this is specified, it is used even if the
global has a window with a load group already established. ...
ARIA Screen Reader Implementors Guide - Accessibility
o try different things. the intention is to strike a balance between providing useful guidance on how to use the markup's intended meaning while supporting live regions as an area for screen readers to innovate and compete. interpreting wai-aria live region markup live changes are hints: in general live region markup is provided by the author as hints, and the assistive technology may allow for
global, site or even region-specific settings, as well as heuristics to help with live changes on pages that have no wai-aria hints. optionally, create a second, additional queue if the user configures a second hardware channel: if there are two channels for presentation (e.g. text to speech and a braille display), then two queues can be maintained to allow for parallel presentation. the channels could...
...settings and heuristics allow for a different voice (in text-to-speech) or other varying presentational characteristics to set live changes apart. when no wai-aria markup is present, automatically present some changes unless the user configures all live changes to off. for example, automatically speak changes that are caused by the user's own input, as part of the context of that input. allow
global settings to turn off the presentation of live changes, present all live changes, use markup, or be "smart" (use heuristics) details for processing via platform accessibility apis we hope browser manufacturers will work to provide consistent implementations. the most complete implementation of live regions currently is in firefox 3. here is how wai-aria live regions are exposed in firefox 3. ...
Understandable - Accessibility
ure receives focus, it should not change the context in a way that may confuse or disorientate the user. this is a matter of sensible design — people don't want interfaces to surprise them; they want things to be intuitive and behave as expected. for example, focusing a navigation menu option should not change the displayed page — it should be activated before the display changes.
globaleventhandlers.onfocus contains some useful information. also see building keyboard accessibility back in for some useful implementation ideas. 3.2.2 on input (a) when data is inputted into a control, or a setting is changed, context should not be changed unexpectedly. the user should be warned/advised of the impending change before it occurs. again, sensible design should be ...
...is inputted into a control, or a setting is changed, context should not be changed unexpectedly. the user should be warned/advised of the impending change before it occurs. again, sensible design should be implemented. for example, if pressing a button causes the application to exit the current view, the user should be asked to confirm this action, save their work if appropriate, etc.
globaleventhandlers.oninput is useful here. 3.2.3 consistent navigation (aa) navigation menu/control style and positioning should be consistent between different pages or views of a web page, and the existing items should appear in the same order, even if for example new iteam are added. if the user has initiated a change, e.g. choosing a different color scheme or position for the navig...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
css authors that contain specific values to be reused throughout a document. they are set using custom property notation (e.g., --main-color: black;) and are accessed using the var() function (e.g., color: var(--main-color);). complex websites have very large amounts of css, often with a lot of repeated values. for example, the same color might be used in hundreds of different places, requiring
global search and replace if that color needs to change. custom properties allow a value to be stored in one place, then referenced in multiple other places. an additional benefit is semantic identifiers. for example, --main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts. custom properties are subject to the cascade and inherit their value ...
...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 earlier, you use the custom property value by specifying your c...
<custom-ident> - CSS: Cascading Style Sheets
same identifiers. forbidden values a <custom-ident> must not be placed between single or double quotes as this would be identical to a <string>. moreover, the first character must not be a decimal digit, nor a hyphen (-) followed by a decimal digit or another hyphen. to prevent ambiguity, each property that uses <custom-ident> forbids the use of specific values: animation-name forbids the
global css values (unset, initial, and inherit), as well as none. counter-reset counter-increment forbids the
global css values (unset, initial, and inherit), as well as none. @counter-style list-style-type forbids the
global css values (unset, initial, and inherit), as well as the values none, inline, and outside. also, quite a few predefined values are implemented by the different browsers: disc...
...rean-hanja-formal, korean-hanja-informal, lao, lower-armenian, malayalam, mongolian, myanmar, oriya, persian, simp-chinese-formal, simp-chinese-informal, tamil, telugu, thai, tibetan, trad-chinese-formal, trad-chinese-informal, upper-armenian, disclosure-open, and disclosure-close. grid-row-start grid-row-end grid-column-start grid-column-end forbids the span value. will-change forbids the
global css values (unset, initial, and inherit), as well as the values will-change, auto, scroll-position, and contents. examples valid identifiers nono79 a mix of alphanumeric characters and numbers ground-level a mix of alphanumeric characters and a dash -test a dash followed by alphanumeric characters _internal an underscore followed by alphanumeric characters ...
mix-blend-mode - CSS: Cascading Style Sheets
formal definition initial valuenormalapplies toall elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax <blend-mode>where <blend-mode> = normal | multiply | screen | overlay | darken | li...
...x"></div> <svg viewbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item b" cx="75" cy="75" rx="25" ry="70"></ellipse> </svg> </div> </div> </div> </div> <div class="note">blending
globally (blend with the background)</div> <div class="row"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx="25" ry="70"></el...
text-underline-position - CSS: Cascading Style Sheets
ike to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* single keyword */ text-underline-position: auto; text-underline-position: under; text-underline-position: left; text-underline-position: right; /* multiple keywords */ text-underline-position: under left; text-underline-position: right under; /*
global values */ text-underline-position: inherit; text-underline-position: initial; text-underline-position: unset; syntax values auto the user agent uses its own algorithm to place the line at or under the alphabetic baseline. from-font if the font file includes information about a preferred position, use that value. if the font file doesn't include this information, behave as if auto was set...
...mple we set both the paragraphs to have a thick underline. in the horizontal text we use text-underline-position: under; to put the underline below all the descenders. in the text with a vertical writing-mode set, we can then use values of left or right to make the underline appear on the left or right of the text as required. the live example looks like this: setting text-underline-position
globally because the text-underline-position property inherits and is not reset by the text-decoration shorthand property, it may be appropriate to set its value at a
global level. for example, the under value may be appropriate for a document with lots of chemical and mathematical formulas, which make a large use of subscripts. :root { text-underline-position: under; } specifications spe...
regexp:match() - EXSLT
ar expression matching on a string, returning the submatches found as a result. syntax regexp:match(targetstring, regexpstring[, flagsstring]) parameters targetstring the string to perform regular expression matching upon. regexpstring the javascript style regular expression to evaluate. flagsstringoptional an optional string containing character flags. the character flags are: g
global match the submatches from every match in the string are returned. if this flag isn't specified, only the submatches from the first match are returned. i case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns a node set of match elements, each of which has the string value equal to a portion of the first parameter string as captured b...
...string are returned. if this flag isn't specified, only the submatches from the first match are returned. i case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns a node set of match elements, each of which has the string value equal to a portion of the first parameter string as captured by the regular expression. if the match isn't a
global one, the first match element has the value of the portion of the string matched by the entire regular expression. for example: <xsl:for-each select="regexp:match('http://developer.mozilla.org/en/docs/firefox_3_for_developers', '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"> part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> thi...
<area> - HTML: Hypertext Markup Language
permitted parents any element that accepts phrasing content. the <area> element must have an ancestor <map>, but it need not be a direct parent. implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles no role permitted dom interface htmlareaelement attributes this element's attributes include the
global attributes. alt a text string alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the n...
...rel="noopener". deprecated attributes name define a names for the clickable area so that it can be scripted by older browsers. nohref indicates that no hyperlink exists for the associated area. note: since html5, omitting the href attribute is sufficient. tabindex a numeric value specifying the position of the defined area in the browser tabbing order. this attribute is
global in html5. type no effect. browsers ignore it. (the w3c 5.3 fork of the html specification defines it as valid, but the canonical html specification doesn’t, and it has no effect in any user agents.) examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html" alt="click to go left"> <area shape="circle" coords="275,75,75" href="right.html" alt="click to go ri...
<dl>: The Description List element - HTML: Hypertext Markup Language
th <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles group, list, none, presentation dom interface htmldlistelement attributes this element only includes the
global attributes. examples single term and description <dl> <dt>firefox</dt> <dd> a free, open source, cross-platform, graphical web browser developed by the mozilla corporation and hundreds of volunteers. </dd> <!-- other terms and descriptions --> </dl> multiple terms, single description <dl> <dt>firefox</dt> <dt>mozilla firefox</dt> <dt>fx</dt> <dd> a fre...
...dt>born</dt> <dd>1952</dd> <dt>birthplace</dt> <dd>japan</dd> <dt>color</dt> <dd>green</dd> </dl> tip: it can be handy to define a key-value separator in the css, such as: dt::after { content: ": "; } wrapping name-value groups in <div> elements whatwg html allows wrapping each name-value group in a <dl> element in a <div> element. this can be useful when using microdata, or when
global attributes apply to a whole group, or for styling purposes. <dl> <div> <dt>name</dt> <dd>godzilla</dd> </div> <div> <dt>born</dt> <dd>1952</dd> </div> <div> <dt>birthplace</dt> <dd>japan</dd> </div> <div> <dt>color</dt> <dd>green</dd> </div> </dl> notes do not use this element (nor <ul> elements) to merely create indentation on a page. although ...
<input type="button"> - HTML: Hypertext Markup Language
stablish a function that will be run when click events occur on the button. adding keyboard shortcuts to buttons keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. to add a keyboard shortcut to a button — just as you would with any <input> for which it makes sense — you use the accesskey
global attribute. in this example, s is specified as the access key (you'll need to press s plus the particular modifier keys for your browser/os combination; see accesskey for a useful list of those). <form> <input type="button" value="start machine" accesskey="s"> </form> <p>the machine is stopped.</p> const button = document.queryselector('input'); const paragraph = document.queryselector('p...
...problem with the above example of course is that the user will not know what the access key is! in a real site, you'd have to provide this information in a way that doesn't intefere with the site design (for example by providing an easily accessible link that points to information on what the site accesskeys are). disabling and enabling a button to disable a button, simply specify the disabled
global attribute on it, like so: <input type="button" value="disable me" disabled> you can enable and disable buttons at run time by simply setting disabled to true or false. in this example our button starts off enabled, but if you press it, it is disabled using button.disabled = true. a settimeout() function is then used to reset the button back to its enabled state after two seconds. hidden cod...
<input type="reset"> - HTML: Hypertext Markup Language
l> <input id="example" type="text"> </div> <div> <input type="reset" value="reset the form"> </div> </form> this renders like so: try entering some text into the text field, and then pressing the reset button. adding a reset keyboard shortcut to add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey
global attribute. in this example, r is specified as the access key (you'll need to press r plus the particular modifier keys for your browser/os combination; see accesskey for a useful list of those). <form> <div> <label for="example">type in some sample text</label> <input id="example" type="text"> </div> <div> <input type="reset" value="reset the form" accesskey="r"> </div>...
... a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are). adding a tooltip to the button (using the title attribute) can also help, although it's not a complete solution for accessibility purposes. disabling and enabling a reset button to disable a reset button, simply specify the disabled
global attribute on it, like so: <input type="reset" value="disabled" disabled> you can enable and disable buttons at run time by simply setting disabled to true or false; in javascript this looks like btn.disabled = true or btn.disabled = false. note: see the <input type="button"> page for more ideas about enabling and disabling buttons. validation buttons don't participate in constraint valid...
<input type="submit"> - HTML: Hypertext Markup Language
the configuration of the <form>; see sending form data for more details. adding a submit keyboard shortcut keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. to add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey
global attribute. in this example, s is specified as the access key (you'll need to press s plus the particular modifier keys for your browser/os combination. in order to avoid conflicts with the user agent's own keyboard shortcuts, different modifier keys are used for access keys than for other shortcuts on the host computer. see accesskey for further details. here's the previous example with the s a...
... way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are). adding a tooltip to the button (using the title attribute) can also help, although it's not a complete solution for accessibility purposes. disabling and enabling a submit button to disable a submit button, simply specify the disabled
global attribute on it, like so: <input type="submit" value="disabled" disabled> you can enable and disable buttons at run time by simply setting disabled to true or false; in javascript this looks like btn.disabled = true or btn.disabled = false. see the <input type="button"> page for more ideas about enabling and disabling buttons. validation submit buttons don't participate in constraint val...
<input type="text"> - HTML: Hypertext Markup Language
input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how many can be seen at a time. to set an upper limit on the length of the input data, use the maxlength attribute. spellcheck spellcheck is a
global attribute which is used to indicate whether or not to enable spell checking for an element. it can be used on any editable content, but here we consider specifics related to the use of spellcheck on <input> elements. the permitted values for spellcheck are: false disable spell checking for this element. true enable spell checking for this element. "" (empty string) or no value follow the ...
...le automatic correction and text substitutions. mozactionhint a mozilla extension, supported by firefox for android, which provides a hint as to what sort of action will be taken if the user presses the enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the
global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. using text inputs <input> elements of type text create basic, single-line inputs. you should use them anywhere you want the us...
<input type="url"> - HTML: Hypertext Markup Language
input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how many can be seen at a time. to set an upper limit on the length of the input data, use the maxlength attribute. spellcheck spellcheck is a
global attribute which is used to indicate whether or not to enable spell checking for an element. it can be used on any editable content, but here we consider specifics related to the use of spellcheck on <input> elements. the permitted values for spellcheck are: false disable spell checking for this element. true enable spell checking for this element. "" (empty string) or no value follow the ...
...le automatic correction and text substitutions. mozactionhint a mozilla extension, supported by firefox for android, which provides a hint as to what sort of action will be taken if the user presses the enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the
global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. using url inputs when you create a url input with the proper type value, url, you get automatic validation that the entered te...
<time> - HTML: Hypertext Markup Language
permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmltimeelement attributes like all other html elements, this element supports the
global attributes. datetime this attribute indicates the time and/or date of the element and must be in one of the formats described below. usage notes this element is for presenting dates and times in a machine readable format. for example, this can help a user agent offer to add an event to a user's calendar. this element should not be used for dates prior to the introduction of the gregorian ...
...dants, and the datetime value is the element’s child text content. ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
te; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc. the content inside the opening and closing <video></video> tags is shown as a fallback in browsers that don't support the element. attributes like all other html elements, this element supports the
global attributes. autoplay a boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data. note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. if you must offer autoplay functionality, you should make it opt-in (req...
...u can fix this problem for the apache web server by adding the extension used by your video files (".webm" is the most common one) to the mime type "video/webm" via the "mime.types" file in "/etc/apache" or via the "addtype" configuration directive in httpd.conf. addtype video/webm .webm your web host may provide an easy interface to mime type configuration changes for new technologies until a
global update naturally occurs. accessibility concerns videos should provide both captions and transcripts that accurately describe its content (see adding captions and subtitles to html5 video for more information on how to implement these). captions allow people who are experiencing hearing loss to understand a video's audio content as the video is being played, while transcripts allow people who ne...
class - HTML: Hypertext Markup Language
classes allow css and javascript to select and access specific elements via the class selectors or functions like the dom method document.getelementsbyclassname. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. though the specification doesn't put requirements on the name of classes, web developers are encouraged to use names that describe the semantic purpose of the element, rather than the presentation of the element. ...
...ss' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'class' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'class' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, class is now a true
global attribute. html 4.01 specificationthe definition of 'class' in that specification. recommendation supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. ...
dir - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like english); rtl, which means right to left and is to be used for languages that are written from the right to the left (like arabic); auto, which lets the user agent decide. ...
...ication. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'dir' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'dir' in that specification. recommendation snapshot of html living standard, from html 4.01 specification it added the auto value, and is now a true
global attribute. html 4.01 specificationthe definition of 'dir' in that specification. recommendation supported on all elements but <applet>, <base>, <basefont>, <bdo>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. ...
id - HTML: Hypertext Markup Language
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this attribute's value is an opaque string: this means that web authors should not rely on it to convey human-readable information (although having your ids somewhat human-readable can be useful for code comprehension, e.g. consider ticket-18659 versus r45tgfe-freds&$@). id's value must not contain whitespace (spaces, tabs etc.). ...
.... living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'id' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'id' in that specification. recommendation snapshot of html living standard, now accept '_', '-' and '.' if not at the beginning of the id. it is also a true
global attribute. html 4.01 specificationthe definition of 'id' in that specification. recommendation supported on all elements but <base>, <head>, <html>, <meta>, <script>, <style>, and <title>. ...
itemscope - HTML: Hypertext Markup Language
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. ...
... itemprop name avatar itemprop https://youtu.be/0ay1xikx7by trailer itemscope id attributes when you specify the itemscope attribute for an element, a new item is created. the item consists of a group of name-value pairs. for elements with an itemscope attribute and an itemtype attribute, you may also specify an id attribute. you can use the id attribute to set a
global identifier for the new item. a
global identifier allows the item to relate to other items found on pages across the web. example there are four itemscope attributes in the following example. each itemscope attribute sets the scope of its corresponding itemtype attribute. the itemtypes, recipe, aggregaterating, and nutritioninformation in the following example are part of the schema.org structur...
lang - HTML: Hypertext Markup Language
the attribute contains a single “language tag” in the format defined in tags for identifying languages (bcp47). the default value of lang is unknown, therefore it is recommended to always specify this attribute with the appropriate value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...g standard no change from latest snapshot, html 5.1 html 5.1the definition of 'lang' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'lang' in that specification. recommendation snapshot of html living standard, behavior with xml:lang and language determination algorithm defined. it also is a true
global attribute. html 4.01 specificationthe definition of 'lang' in that specification. recommendation supported on all elements but <applet>, <base>, <basefont>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. ...
style - HTML: Hypertext Markup Language
note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. usage note: this attribute must not be used to convey semantic information. even if all styling is removed, a page should remain semantically correct. typically it shouldn't be used to hide irrelevant information; this should be done using the hidden attribute. ...
...style' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'style' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'style' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, it is now a true
global attribute. html 4.01 specificationthe definition of 'style' in that specification. recommendation supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. css style attributes recommendation defines the content of the style attribute. ...
tabindex - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it accepts an integer as a value, with different results depending on the integer's value: a negative value (usually tabindex="-1") means that the element is not reachable via sequential keyboard navigation, but could be focused with javascript or visually by clicking with the mouse. it's mostly useful to create accessible widgets with javascript. ...
... standard no change from latest snapshot, html 5.1. html 5.1the definition of 'tabindex' in that specification. recommendation snapshot of html living standard, no change from html5. html5the definition of 'tabindex' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, the attribute is now supported on all elements (
global attributes). html 4.01 specificationthe definition of 'tabindex' in that specification. recommendation only supported on <a>, <area>, <button>, <input>, <object>, <select>, and <textarea>. ...
title - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. some typical uses: labeling <iframe> elements for assistive technology providing a programmatically associated label for an <input> element as a fallback for a real <label> labeling controls in data tables additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. multiline titles the title attribute may contain several lines. ...
...title' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'title' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'title' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, it is now a true
global attribute. html 4.01 specificationthe definition of 'title' in that specification. recommendation supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, and <title>. ...
Content Security Policy (CSP) - HTTP
g the domains that the browser should consider to be valid sources of executable scripts. a csp compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling html attributes). as an ultimate form of protection, sites that want to never allow scripts to be executed can opt to
globally disallow script execution. mitigating packet sniffing attacks in addition to restricting the domains from which content can be loaded, the server can specify which protocols are allowed to be used; for example (and ideally, from a security standpoint), a server can specify that all content must be loaded using https. a complete data transmission security strategy includes not only enforcing h...
... the directive whose enforcement caused the violation. original-policy the original policy as specified by the content-security-policy http header. referrer the referrer of the document in which the violation occurred. script-sample the first 40 characters of the inline script, event handler, or style that caused the violation. status-code the http status code of the resource on which the
global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. content-security-policy: default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports the html of signup...
Details of the object model - JavaScript
k around a quirk of how xml objects are represented in recent versions of javascript. see bug 634150 if you want the nitty-gritty details. using the instanceof function defined above, these expressions are true: instanceof(chris, engineer) instanceof(chris, workerbee) instanceof(chris, employee) instanceof(chris, object) but the following expression is false: instanceof(chris, salesperson)
global information in constructors when you create constructors, you need to be careful if you set
global information in the constructor. for example, assume that you want a unique id to be automatically assigned to each new employee. you could use the following definition for employee: var idcounter = 1; function employee(name, dept) { this.name = name || ''; this.dept = dept || 'general'; ...
...t you want a unique id to be automatically assigned to each new employee. you could use the following definition for employee: var idcounter = 1; function employee(name, dept) { this.name = name || ''; this.dept = dept || 'general'; this.id = idcounter++; } with this definition, when you create a new employee, the constructor assigns it the next id in sequence and then increments the
global id counter. so, if your next statement is the following, victoria.id is 1 and harry.id is 2: var victoria = new employee('pigbert, victoria', 'pubs'); var harry = new employee('tschopik, harry', 'sales'); at first glance that seems fine. however, idcounter gets incremented every time an employee object is created, for whatever purpose. if you create the entire employee hierarchy shown in this ...
Regular expressions - JavaScript
*b") create the same expression, which searches for "a" followed by a literal "*" followed by "b". if escape strings are not already part of your pattern you can add them using string.replace: function escaperegexp(string) { return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string } the "g" after the regular expression is an option or flag that performs a
global search, looking in the whole string and returning all matches. it is explained in detail below in advanced searching with flags. why isn't this built into javascript? there is a proposal to add such a function to regexp, but it was rejected by tc39. using parentheses parentheses around any part of the regular expression pattern causes that part of the matched substring to be remembered. once r...
... occurrences of /d(b+)d/g in the two statements are different regular expression objects and hence have different values for their lastindex property. if you need to access the properties of a regular expression created with an object initializer, you should first assign it to a variable. advanced searching with flags regular expressions have six optional flags that allow for functionality like
global and case insensitive searching. these flags can be used separately or together in any order, and are included as part of the regular expression. regular expression flags flag description corresponding property g
global search. regexp.prototype.
global i case-insensitive search. regexp.prototype.ignorecase m multi-line search. regexp...
Using Promises - JavaScript
, e.g. dosomething() is the same function as before. you can read more about the syntax here. promises solve a fundamental flaw with the callback pyramid of doom, by catching all errors, even thrown exceptions and programming errors. this is essential for functional composition of asynchronous operations. promise rejection events whenever a promise is rejected, one of two events is sent to the
global scope (generally, this is either the window or, if being used in a web worker, it's the worker or other worker-based interface). the two events are: rejectionhandled sent when a promise is rejected, after that rejection has been handled by the executor's reject function. unhandledrejection sent when a promise is rejected but there is no rejection handler available. in both cases, the even...
...ejection handler available. in both cases, the event (of type promiserejectionevent) has as members a promise property indicating the promise that was rejected, and a reason property that provides the reason given for the promise to be rejected. these make it possible to offer fallback error handling for promises, as well as to help debug issues with your promise management. these handlers are
global per context, so all errors will go to the same event handlers, regardless of source. one case of special usefulness: when writing code for node.js, it's common that modules you include in your project may have unhandled rejected promises. these get logged to the console by the node runtime. you can capture these for analysis and handling by your code—or just to avoid having them cluttering up ...
ReferenceError: "x" is not defined - JavaScript
var num1 = 2, num2 = 3; function numbers() { return num1 + num2; } console.log(numbers()); // 5 ...
... var num1 = 2, num2 = 3; function numbers() { return num1 + num2; } console.log(numbers()); // 5 ...
AsyncFunction - JavaScript
it can be obtained with the following code: object.getprototypeof(async function(){}).constructor syntax new asyncfunction([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascript identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". ...
...t within your code, because such functions are parsed with the rest of the code. all arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed. note: async functions created with the asyncfunction constructor do not create closures to their creation contexts; they are always created in the
global scope. when running them, they will only be able to access their own local variables and
global ones, not the ones from the scope in which the asyncfunction constructor was called. this is different from using eval with code for an async function expression. invoking the asyncfunction constructor as a function (without using the new operator) has the same effect as invoking it as a constructo...
Function.prototype.apply() - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax func.apply(thisarg, [ argsarray]) parameters thisarg the value of this provided for the call to func. note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the
global object, and primitive values will be boxed. this argument is required. argsarray optional an array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function. starting with ecmascript 5 these arguments can be a generic array-like object instead of an array. see below for browser compatibility information.
...en = arr.length; i < len; i += quantum) { var submin = math.min.apply(null, arr.slice(i, math.min(i+quantum, len))); min = math.min(submin, min); } return min; } let min = minofarray([5, 6, 2, 3, 7]); using apply to chain constructors you can use apply to chain constructors for an object (similar to java). in the following example we will create a
global function method called construct, which will enable you to use an array-like object with a constructor instead of an arguments list. function.prototype.construct = function(aargs) { let onew = object.create(this.prototype); this.apply(onew, aargs); return onew; }; note: the object.create() method used above is relatively new. for alternative methods, please consider one of the following...
Function.prototype.call() - JavaScript
please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax func.call([thisarg[, arg1, arg2, ...argn]]) parameters thisarg optional the value to use as this when calling func. caution: in certain cases, thisarg may not be the actual value seen by the method. if the method is a function in non-strict mode, null and undefined will be replaced with the
global object, and primitive values will be converted to objects. arg1, arg2, ...argn optional arguments for the function. return value the result of calling the function with the specified this value and arguments. description the call() allows for a function/method belonging to one object to be assigned and called for a different object. call() provides a new value of this to the function/...
...); console.log(reply); } const obj = { animal: 'cats', sleepduration: '12 and 16 hours' }; greet.call(obj); // cats typically sleep between 12 and 16 hours using call to invoke a function and without specifying the first argument in the example below, we invoke the display function without passing the first argument. if the first argument is not passed, the value of this is bound to the
global object. var sdata = 'wisen'; function display() { console.log('sdata value is %s ', this.sdata); } display.call(); // sdata value is wisen caution: in strict mode, the value of this will be undefined. see below. 'use strict'; var sdata = 'wisen'; function display() { console.log('sdata value is %s ', this.sdata); } display.call(); // cannot read the property of 'sdata' of undefined...
GeneratorFunction - JavaScript
it could be obtained by evaluating the following code. object.getprototypeof(function*(){}).constructor syntax new generatorfunction ([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. ...
...n your code, because such functions are parsed with the rest of the code. all arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed. note: generator function created with the generatorfunction constructor do not create closures to their creation contexts; they are always created in the
global scope. when running them, they will only be able to access their own local variables and
global ones, not the ones from the scope in which the generatorfunction constructor was called. this is different from using eval with code for a generator function expression. invoking the generatorfunction constructor as a function (without using the new operator) has the same effect as invoking it as a...
Infinity - JavaScript
the initial value of infinity is number.positive_infinity. the value infinity (positive infinity) is greater than any other number. ...
...inity writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description infinity is a property of the
global object. in other words, it is a variable in
global scope. the initial value of infinity is number.positive_infinity. the value infinity (positive infinity) is greater than any other number. this value behaves slightly differently than mathematical infinity; see number.positive_infinity for details. as defined by the ecmascript 5 specification, infinity is read-only (implemented in javascript 1...
NaN - JavaScript
the initial value of nan is not-a-number — the same as the value of number.nan. in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. ...
...tes of nan writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description nan is a property of the
global object. in other words, it is a variable in
global scope. the initial value of nan is not-a-number — the same as the value of number.nan. in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. it is rather rare to use nan in a program. there are five different types of operations that return nan: number cannot be parsed (e...
TypedArray - JavaScript
on the following pages you will find common properties and methods that can be used with any typed array containing elements of any type. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. 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 particularl...
instanceof - JavaScript
of test can change based on changes to the prototype property of constructors. it can also be changed by changing an object's prototype using object.setprototypeof. it is also possible using the non-standard __proto__ property. instanceof and multiple context (e.g. frames or windows) different scopes have different execution environments. this means that they have different built-ins (different
global object, different constructors, etc.). this may result in unexpected results. for instance, [] instanceof window.frames[0].array will return false, because array.prototype !== window.frames[0].array and arrays inherit from the former. this may not make sense at first, but for scripts dealing with multiple frames or windows, and passing objects from one context to another via functions, this will...
...iew.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). however, objects created with the object literal notation are an exception ...
const - JavaScript
ase clone https://github.com/mdn/interactive-examples and send us a pull request. syntax 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...
... this throws an error too let my_fav = 20; block scoping it's important to note the nature of block scoping. if (my_fav === 7) { // this is fine and creates a block scoped my_fav variable // (works equally well with let to declare a block scoped non const variable) let my_fav = 20; // my_fav is now 20 console.log('my favorite number is ' + my_fav); // this gets hoisted into the
global context and throws an error var my_fav = 20; } // my_fav is still 7 console.log('my favorite number is ' + my_fav); const needs to be initialized // throws an error // uncaught syntaxerror: missing initializer in const declaration const foo; const in objects and arrays const also works on objects and arrays. const my_object = {'key': 'value'}; // attempting to overwrite the object thr...
SVG Event Attributes - SVG: Scalable Vector Graphics
es 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. for every event type that the browser supports, svg supports that as an event attribute, following the same requirements as for html event attributes. ...
...t attributes. the
global event attributes are available on all svg elements. other event attributes are available on a case by case basis for each elements. all event attribute are not animatable. ...
<a> - SVG: Scalable Vector Graphics
value type: _self|_parent|_top|_blank|<name> ; default value: _self; animatable: yes type a mime type for the linked url. value type: <string> ; default value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. ...
...since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. ...
<altGlyph> - SVG: Scalable Vector Graphics
ered instead of the character(s) that are inside of the <altglyph> element. if the reference is to an <altglyphdef> element, then if an appropriate set of alternate glyphs is located from processing the <altglyphdef> element, then those alternate glyphs are rendered instead of the character(s) that are inside of the <altglyph> element. ...
...ing the <altglyphdef> element, then those alternate glyphs are rendered instead of the character(s) that are inside of the <altglyph> element. ...
<animate> - SVG: Scalable Vector Graphics
accessibility concerns blinking and flashing animation can be problematic for people with cognitive concerns such as attention deficit hyperactivity disorder (adhd).
... accessibility concerns blinking and flashing animation can be problematic for people with cognitive concerns such as attention deficit hyperactivity disorder (adhd). additionally, certain kinds of motion can be a trigger for vestibular disorders, epilepsy, and migraine and...
<animateMotion> - SVG: Scalable Vector Graphics
specifications specification status comment svg animations level 2the definition of '<animatemotion>' in that specification. edi...
... specifications specification status comment svg animations level 2the definition of '<animatemotion>' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<ani...
<circle> - SVG: Scalable Vector Graphics
ower 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. ...
... <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. ...
<ellipse> - SVG: Scalable Vector Graphics
llipse 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. ...
...umber> ; 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. ...
<foreignObject> - SVG: Scalable Vector Graphics
imatable: 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. ...
...e> ; 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. ...
<line> - SVG: Scalable Vector Graphics
defines the y-axis coordinate of the line starting point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
...ue type: <length>|<percentage>|<number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
<linearGradient> - SVG: Scalable Vector Graphics
; animatable: yes y1 this attribute defines the y coordinate of the starting point of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
...along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
<metadata> - SVG: Scalable Vector Graphics
the <metadata> svg element adds metadata to svg content. metadata is structured information about data. the contents of <metadata> should be elements from other xml namespaces such as rdf, foaf, etc. usage context categoriesdescriptive elementpermitted contentany elements or character data attributes
global attributes core attributes
global event attributes specific attributes none dom interface this element implements the svgmetadataelement interface. example <svg width="400" viewbox="0 0 400 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <metadata> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:connect="http://www.w3.org/1999/08/29-svg-connections-in-rdf#"> <rdf:description about="#cablea"> ...
...-- draw cable n. --> <g id="cablen" transform="translate(242 88)"> <title>cable n</title> <desc>10baset twisted pair cable</desc> <path d="m0,0c0,-70 20,-50 60,-50"/> </g> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of '<metadata>' in that specification. candidate recommendation allowed
global event attributes on the element. scalable vector graphics (svg) 1.1 (second edition)the definition of '<metadata>' in that specification. recommendation initial definition ...
<path> - SVG: Scalable Vector Graphics
a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z"/> </svg> attributes d this attribute defines the shape of the path. value type: <string> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
...> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
<polygon> - SVG: Scalable Vector Graphics
200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
...<number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
<polyline> - SVG: Scalable Vector Graphics
200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
...<number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
<radialGradient> - SVG: Scalable Vector Graphics
lue: 50%; animatable: yes spreadmethod this attribute indicates how the gradient behaves if it starts or ends inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. ...
...nds inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. ...
<rect> - SVG: Scalable Vector Graphics
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. ...
...lt 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. ...
<set> - SVG: Scalable Vector Graphics
e duration of the animation. the value must match the requirements of the target attribute. ...
... editor's draft scalable vector graphics (svg) 1.1 (seco...
<stop> - SVG: Scalable Vector Graphics
<percentage>; default value: 0; animatable: yes stop-color this attribute defines the color of the gradient stop. it can be used as a css property. value type: currentcolor|<color>|<icccolor>; default value: black; animatable: yes stop-opacity this attribute defines the opacity of the gradient stop. it can be used as a css property. ...
...t stop. it can be used as a css property. value type: currentcolor|<color>|<icccolor>; default value: black; animatable: yes stop-opacity this attribute defines the opacity of the gradient stop. it can be used as a css property. ...
<svg> - SVG: Scalable Vector Graphics
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. ...
...ength>|<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. ...
<symbol> - SVG: Scalable Vector Graphics
width this attribute determines the width of the symbol. value type: <length>|<percentage> ; default value: auto; animatable: yes x this attribute determines the x coordinate of the symbol. value type: <length>|<percentage> ; default value: 0; animatable: yes y this attribute determines the y coordinate of the symbol. ...
...: auto; animatable: yes x this attribute determines the x coordinate of the symbol. value type: <length>|<percentage> ; default value: 0; animatable: yes y this attribute determines the y coordinate of the symbol. ...
<text> - SVG: Scalable Vector Graphics
ually. value type: <list-of-number> ; default value: none; animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
... should be scaled to fit. ...
<textPath> - SVG: Scalable Vector Graphics
led. value type: auto|exact ; default value: exact; animatable: yes startoffset how far the beginning of the text should be offset from the beginning of the path. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
...umber> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
<tspan> - SVG: Scalable Vector Graphics
ually. value type: <list-of-number> ; default value: none; animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
...ng|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
<use> - SVG: Scalable Vector Graphics
nt. 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. ...
...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. ...
<view> - SVG: Scalable Vector Graphics
a view is a defined way to view the image, like a zoom level or a detail view. ...
... a view is a defined way to view the image, like a zoom level or a detail view. ...
Web Components
t connected to the document's dom. disconnectedcallback: invoked when the custom element is disconnected from the document's dom. adoptedcallback: invoked when the custom element is moved to a new document. attributechangedcallback: invoked when one of the custom element's attributes is added, removed, or changed. extensions for creating custom built-in elements the is
global html attribute: allows you to specify that a standard html element should behave like a registered custom built-in element. the "is" option of the document.createelement() method: allows you to create an instance of a standard html element that behaves like a given registered custom built-in element. css pseudo-classes pseudo-classes relating specifically to custom elements: :defined:...
...ocument is initially loaded, but can be displayed at runtime using javascript, mainly used as the basis of custom element structures. the associated dom interface is htmltemplateelement. <slot> a placeholder inside a web component that you can fill with your own markup, which lets you create separate dom trees and present them together. the associated dom interface is htmlslotelement. the slot
global html attribute assigns a slot in a shadow dom shadow tree to an element. slotable a mixin implemented by both element and text nodes, defining features that allow them to become the contents of an <slot> element. the mixin defines one attribute, slotable.assignedslot, which returns a reference to the slot the node is inserted in. element extensions extensions to the element interface rela...
Index - XSLT: Extensible Stylesheet Language Transformations
aracteristics of the output document. to function correctly in netscape, this element, with the method attribute, must be used. as of 7.0, method="text" works as expected. 42 <xsl:param> element, reference, xslt, param the <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. when used as a top-level element, the parameter is
global . when used inside an <xsl:template> element, the parameter is local to that template. in this case it must be the first child element of the template. 43 <xsl:preserve-space> element, reference, xslt, preserve-space the <xsl:preserve-space> element defines the elements in the source document for which whitespace should be preserved. if there is more than one element, separat...
... the <xsl:transform> element is exactly equivalent to the <xsl:stylesheet> element. 51 <xsl:value-of> element, reference, xslt, value-of the <xsl:value-of> element evaluates an xpath expression, converts it to a string, and writes that string to the result tree. 52 <xsl:variable> element, reference, xslt, variable the <xsl:variable> element declares a
global or local variable in a stylesheet and gives it a value. because xslt permits no side-effects, once the value of the variable has been established, it remains the same until the variable goes out of scope 53 <xsl:when> element, reference, xslt, when the <xsl:when> element always appears within an <xsl:choose> element, acting like a case statement. 54 <xsl:with-param...
WebAssembly
. this is the low-level textual representation of a .wasm module shown in browser developer tools when debugging. converting webassembly text format to wasm this article provides a guide on how to convert a webassembly module written in the text format into a .wasm binary. api reference webassembly this object acts as the namespace for all webassembly related functionality. webassembly.
global() a webassembly.
global object 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.module() a webassembly.module object contains stateless webassembly code that has already been compiled by the browser and can be efficiently shared with worke...
... 52notes notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0
globalchrome full support 69edge no support nofirefox full support 62ie no support noopera no support nosafari full support 13.1webview ...
port - Archive of obsolete content
this article documents the port object, which is used to communicate between a content script and the main add-on code. the port object provides message sending and receiving api enabling conversations between a content script and the main add-on code. each end of the conversation has access to a port: the content script via the
global self property, and the main add-on code via a worker object associated with the sdk module you've used to attach the content script, such as page-mod or page-worker. for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. it may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. the payload c...
self - Archive of obsolete content
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. ...
Communicating using "postMessage" - Archive of obsolete content
ontent modules support the built-in message event. in most cases port is preferable to message events. however, the context-menu module does not support port, so to send messages from a content script to the add-on via a context menu object, you must use message events. handling message events in the content script to send a message from a content script, you use the postmessage function of the
global self object: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. to receive a message from the add-on script, use self's on function: self.on("message", function(addonmessage) { // handle the message }); like all event-registration functions, this takes two parameters: the name of the event, and the handler...
Content Processes - Archive of obsolete content
i, which allows scripts to send messages to each other using the postmessage function. this function uses the same pipe internally, and causes a 'message' event to be emitted on the other side. as explained earlier, firefox doesn't yet use separate processes for tabs or add-ons, so instead, each content script is loaded in a sandbox. sandboxes were explained this article. accessing the dom the
global for the content sandbox has the window object as its prototype. this allows the content script to access any property on the window object, even though that object lives outside the sandbox. recall that the window object inside the sandbox is actually a wrapper to the real object. a potential problem with the content script having access to the window object is that a malicious page could ...
Porting the Library Detector - Archive of obsolete content
ough the process of porting a xul-based add-on to the sdk. it's a very simple add-on and a good candidate for porting because there are suitable sdk apis for all its features. the add-on is paul bakaus's library detector. the library detector tells you which javascript frameworks the current web page is using. it does this by checking whether particular objects that those libraries add to the
global window object are defined. for example, if window.jquery is defined, then the page has loaded jquery. for each library that it finds, the library detector adds an icon representing that library to the status bar. it adds a tooltip to each icon, which contains the library name and version. you can browse and run the ported version in the sdk's examples directory. how the library detector works ...
base64 - Archive of obsolete content
parameters data : string the data to encode charset : string the charset of the string to encode (optional). the only accepted value is "utf-8". ...
clipboard - Archive of obsolete content
s image, it can be done by specifying a different flavor, like text. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + "aabzenr0aaaasuleqvryhe3o0qkaiawd0eyqe3q993aq3cbsukpygfsnty" + "n5ugbqpk0baadgp0brdwxwlweaaaaagpsa3rzdaaaaahgpcgrpganzq2fg" + "bwrr9aaaaabjru5erkjggg%3d%3d", "text");
globals functions set(data, datatype) replace the contents of the user's clipboard with the provided data. parameters 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...
hotkeys - Archive of obsolete content
eady defined, choose one which makes sense for the operation it will perform. for example, accel-s is typically used to save a file, but if you use it for something completely different, then it would be extremely confusing for users. no matter what you choose, it's likely to annoy some people, and to clash with some other add-on, so consider making the combination you choose user-configurable.
globals constructors hotkey(options) creates a hotkey whose onpress listener method is invoked when key combination defined by hotkey is pressed. if more than one hotkey is created for the same key combination, the listener is executed only on the last one created. parameters options : object required options: name type combo string any function key: "f1,...
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. ...
l10n - Archive of obsolete content
localize strings appearing in the add-on's javascript code. usage to learn how to use this module to write localizable code, read the localization tutorial. note that you can't currently use localize strings appearing in content scripts or html files, but you can share the localized strings you want by assigning it's values to a json serializable object.
globals functions get(identifier, count, placeholder1...n) this function takes a string parameter which it uses as an identifier to look up and return a localized string in the locale currently set for firefox. localized strings are supplied by the add-on developer in .properties files stored in the add-ons "locale" directory. the gettext tools uses "_" for the name of the function that retrieves localized strings. for compatibility...
notifications - Archive of obsolete content
an icon!", iconurl: myiconurl }); this module depends on the underlying system's notification service. if the user's system does not support desktop notifications or if its notifications service is not running: if firefox was started normally, notifications are logged to firefox's error console if the user launched firefox from the command line, notifications are logged to the terminal.
globals functions notify(options) displays a transient notification to the user. parameters options : object optional options: name type title string a string to display as the message's title. text string a string to display as the body of the message. iconurl string the url of an icon to display inside the ...
page-worker - Archive of obsolete content
elf to addon. for example, self.port.emit("my-event") becomes addon.port.emit("my-event"). in the html page itself: add a <script> tag to load the script. so if your content script is saved under data as "my-script.js", you need a line like <script src="my-script.js"></script> in the page header. in the "main.js" file: remove the contentscriptfile option in the page() constructor.
globals constructors page(options) creates an uninitialized page worker instance. parameters options : object optional options: name type contenturl string the url of the content to load in the panel. allow object an object with keys to configure the permissions on the page worker. the boolean key script controls if scripts from the...
panel - Archive of obsolete content
an't embed flash (bug 952578). you can't provide tooltips using title attributes (bug 918600). security warning pages (the "this connection is untrusted" warning) does not work, so panels which trigger it will be broken (bug 1031554). mouse button shortcuts, such as using the middle button to open a link in a new page, don't work. scrolling using keyboard doesn't work properly (bug 1001914)
globals constructors panel(options) creates a panel. parameters options : object optional options: name type width number the width of the panel in pixels. optional. height number the height of the panel in pixels. optional. position object, button, widget the position of the panel. ignored if the pa...
passwords - Archive of obsolete content
r. oncomplete is called when the operation has completed successfully and onerror is called when the function encounters an error. because the search function is expected to return a list of matching credentials, its oncomplete option is mandatory. because the other functions don't return a value in case of success their oncomplete options are optional. for all functions, onerror is optional.
globals functions search(options) this function is used to retrieve a credential, or a list of credentials, stored in the password manager. you pass it any subset of the possible properties a credential can contain. credentials which match all the properties you supplied are returned as an argument to the oncomplete callback. so if you pass in an empty set of properties, all stored credentials are ...
private-browsing - Archive of obsolete content
y all downloads while there are still some private windows open, then clean out all the private data when all private windows have closed. to do this with the sdk, you can listen to the system event named "last-pb-context-exited": var events = require("sdk/system/events"); function listener(event) { console.log("last private window closed"); } events.on("last-pb-context-exited", listener);
globals functions isprivate(object) function to check whether the given object is private. it takes an object as an argument, and returns true only if the object is: a private browserwindow or a tab belonging to a private window, or a worker that's associated with a document hosted in a private window parameters object : any the object to check. this may be a browserwindow, tab, or worker. ...
querystring - Archive of obsolete content
separator : string the string to use as a separator between each name:value pair. by default this is "&". assignment : string the string to use between each name and its corresponding value. ...
selection - Archive of obsolete content
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 iscont...
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. it comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). ...
simple-storage - Archive of obsolete content
1) ss.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 qu...
system - Archive of obsolete content
e = " + system.name); // host application version console.log("version = " + system.version); // host application vendor console.log("vendor = " + system.vendor); // host application profile directory console.log("profile directory = " + system.pathfor("profd")); quit the host application to quit the host application, use the exit() function. var system = require("sdk/system"); system.exit();
globals functions exit(code) quits the host application with the specified code. if code is omitted, exit() uses the success code 0. to exit with failure use 1. var system = require("sdk/system"); system.exit(); parameters code : integer to exit with failure, set this to 1. to exit with success, omit this argument. pathfor(id) firefox enables you to get the path to certain "special" directories...
tabs - Archive of obsolete content
the high-level tab back from the xul tab var highleveltab = modelfor(lowleveltab); console.log(highleveltab.url); } tabs.on("ready", maphighleveltolowlevel); note that directly accessing xul objects and web content like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis. in particular, your code might not work with multiprocess firefox.
globals functions open(options) opens a new tab. the new tab will open in the active window or in a new window, depending on the innewwindow option. example var tabs = require("sdk/tabs"); // open a new tab on active window and make tab active. tabs.open("http://www.mysite.com"); // open a new tab in a new window and make it active. tabs.open({ url: "http://www.mysite.com", innewwindow: true ...
timers - Archive of obsolete content
any additional arguments are passed straight through to the callback. parameters callback : function function to be called. ms : integer interval in milliseconds after which the function will be called. returns integer : an id that can later be used to undo this scheduling, if callback hasn't yet been called. example var { settimeout } = require("sdk/timers"); settimeout(function() { // do something in 0 ms }, 0) cleartimeout(id) given an id returned from settimeout(), prevents the callback with the id from being called (if it hasn't yet been called). ...
url - Archive of obsolete content
any api in the sdk which has a url parameter will accept url objects, not raw strings, unless otherwise noted. parameters source : string a string to be converted into a url. if source is not a valid uri, this constructor will throw an exception. base : string an optional string used to resolve relative source urls into absolute ones. dataurl(uri) the dataurl constructor creates an object that represents a data: url, verifying that the provided string is a valid data: url in the process. ...
widget - Archive of obsolete content
the widget is immediately added to the add-on bar. parameters options : object required options: name type label string a string description of the widget used for accessibility, title bars, and error reporting. id string a string used to identify your widget in order to sav...
windows - Archive of obsolete content
e sdk's high-level window api console.log(highlevelwindow.title); } browserwindows.on("open", converttochromeandback); note that directly accessing low-level chrome objects like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis. in particular, depending on what you do with these objects, your code might not work with multiprocess firefox.
globals functions open(options) open a new window. var windows = require("sdk/windows").browserwindows; // open a new window. windows.open("http://www.example.com"); // open a new window and set a listener for "open" event. windows.open({ url: "http://www.example.com", onopen: function(window) { // do stuff like listen for content // loading. } }); returns the window that was opened...
chrome - Archive of obsolete content
you should avoid using the api if at all possible. we intend to deprecate it in future releases. if you use this api you can expect your add-on to get an extra security review by addons.mozilla.org. this module should not be confused with the "chrome"
global variable that webextensions can use to access apis. the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis. chrome is a built-in pseudo module of the toolkit loader. see the chrome authority tutorial for more details. you can see an example of using this api in the xul migration guide. ...
console/plain-text - Archive of obsolete content
constructor for a console instance. usage the plain-text console is a constructor for creating a console object to be used for traditional logging purposes. it's implemented using console.jsm, and is prefixed with the addon's name, and log levels set based off of startup instruction. an instance of the console is injected
globally into addon's contexts.
globals constructors plaintextconsole(print) creates a console instance. all of its methods are inherited from console.jsm (resource://gre/modules/devtools/console.jsm). parameters print : function an optional function to process the arguments passed in before printing to stdout. ...
console/traceback - Archive of obsolete content
owing keys: filename the name of the file that the stack frame takes place in. lineno the line number is being executed at the stack frame. funcname the name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or module. see nsiexception for more information.
globals functions fromexception(exception) attempts to extract the traceback from exception. parameters exception : exception exception where exception is an nsiexception. returns traceback : json representation of the traceback or null if not found. get() returns json : returns the json representation of the stack at the point that this function is called. format(tborexception) given a jso...
content/mod - Archive of obsolete content
for example, the following code applies a style to a content window, adding a border to all divs in page: var attachto = require("sdk/content/mod").attachto; var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); parameters modification : object the modification we want to apply to the target. window : nsidomwindow the window to be modified. ...
content/symbiont - Archive of obsolete content
m the worker. var { symbiont } = require('sdk/content/content'); var thing = symbiont.resolve({ constructor: '_init' }).compose({ constructor: function thing(options) { // `getmyframe` returns the host application frame in which // the page is loaded. this._frame = getmyframe(); this._init(options) } }); see the panel module for a real-world example of usage of this module.
globals constructors symbiont(options) creates a content symbiont. parameters options : object optional options: name type frame object the host application frame in which the page is loaded. if frame is not provided hidden one will be created. contentscriptwhen string when to load the content scripts. this may take one of the follo...
content/worker - Archive of obsolete content
use content scripts to interact with web content. it exports the worker trait, which enables content scripts and the add-on code to exchange messages using the port or postmessage apis. the worker is similar to the web worker interface defined by the w3c. but unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the ui.
globals constructors worker(options) creates a content worker. parameters options : object required options: name type window object the content window to create javascript sandbox for communication with. optional options: name type contentscriptfile string,array the local file urls of content scripts to...
dev/panel - Archive of obsolete content
buggee = event.ports[0]; volcan.connect(debuggee). then(listtabs). then(writetablist); }); function listtabs(root) { return root.listtabs(); } function writetablist(tablist) { content.textcontent = tablist.tabs[tablist.selected].url; } we don't have detailed documentation for volcan.js, but it's coming soon. in the meantime, here's a quick guide. connecting volcan.js provides a
global connect() function that takes a messageport connected to the debugger server, and returns a promise which is fulfilled with an object representing the root actor: volcan.connect(debuggee).then(gotroot); function gotroot(root) { // can use root actor here } actors actors in the remote debugging protocol are volcan.js objects. the messages actors can accept are methods of those objects. the me...
event/core - Archive of obsolete content
t, 'load', function() { console.log('ready'); }); emit(target, 'load') // info: 'ready' emit(target, 'load') there are also convenient ways to remove registered listeners. all listeners of the specific type can be easily removed (only two argument must be passed): off(target, 'message'); also, removing all registered listeners is possible (only one argument must be passed): off(target);
globals functions on(target, type, listener) registers an event listener that is called every time events of the specified type is emitted on the given event target. parameters target : object event target object. type : string the type of event. listener : function the listener function that processes the event. once(target, type, listener) registers an event listener that is called only on...
frame/hidden-frame - Archive of obsolete content
let hiddenframe = hiddenframes.add(hiddenframes.hiddenframe({ onready: function() { this.element.contentwindow.location = "http://www.mozilla.org/"; let self = this; this.element.addeventlistener("domcontentloaded", function() { console.log(self.element.contentdocument.title); }, true, true); } })); see the panel module for a real-world example of usage of this module.
globals constructors hiddenframe(options) creates a hidden frame. parameters options : object required options: name type onready function,array functions to call when the frame is ready to load content. you must specify an onready callback and refrain from using the hidden frame until the callback gets called, because hidden frames are not always ready to...
frame/utils - Archive of obsolete content
optionally create can be passed set of options to configure created frame even further. execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowjavascript: true }); }
globals functions create(document, options) creates a xul browser element in a privileged document. parameters document : nsidomdocument options : object optional options: name type type string string that defines access type of the document loaded into it. defaults to "content". for more details and other possible values see documentation on mdn ...
io/byte-streams - Archive of obsolete content
you can also create bytereader objects using io/file's open() function. parameters inputstream : stream the backing stream, an nsiinputstream. bytewriter(outputstream) creates a binary output stream that writes bytes to a backing stream. you can also create bytewriter objects usin...
io/file - Archive of obsolete content
with join. for now, you need to require("chrome") and use the xpcom directory service as described in this article about file i/o. note that if you do decide to hardcode windows-style paths, be sure to escape backslashes in strings. for example, to specify the file at c:\users\myk, you need to use the string "c:\\users\\myk", not "c:\users\myk". read more about escaping characters in strings.
globals functions basename(path) the path parameter must be an absolute path, relative paths will cause an error. use the fs/path module for relative path support. returns the last component of the given path. for example, basename("/foo/bar/baz") returns "baz". if the path has no components, the empty string is returned. parameters path : string the path of a file. returns string : the last...
io/text-streams - Archive of obsolete content
you can also create textreader objects using io/file's open() function. parameters inputstream : stream the backing stream, an nsiinputstream. it must already be opened. charset : string inputstream is expected to be in the character encoding n...
lang/functional - Archive of obsolete content
when the method is invoked on an instance of the object, the original function is called. it is passed the object instance (i.e. this) as the first parameter, followed by any parameters passed into the method. ...
lang/type - Archive of obsolete content
let { isundefined } = require('sdk/lang/type'); var foo; isundefined(foo); // true isundefined(0); // false parameters value : mixed the variable to check. returns boolean : boolean indicating if value is undefined. isnull(value) returns true if value is null, false otherwise. let { isnull } = require('sdk/lang/type'); isnull(null); // true isnull(false); // false parameters value : mixed the variable to check. returns boolean : boolean indicating if value is null. isstring(value) returns true if value is a string, false otherwise. ...
loader/sandbox - Archive of obsolete content
of javascript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in js 1.5. load scripts this module provides a limited api for loading scripts from local urls. data: urls are supported. load(scope, 'resource://path/to/my/script.js'); load(scope, 'file:///path/to/script.js'); load(scope, 'data:,var a = 5;');
globals functions sandbox(source) make a new sandbox that inherits principals from source. parameters source : string|window|null an object that determines the privileges that will be given to the sandbox. this argument can be: a uri string, giving the sandbox the same privileges as a script loaded from that url a dom window object, giving the sandbox the same privileges as the dom window nul...
net/url - Archive of obsolete content
parameters uri : string the url, as a string, to load. options : object optional options: name type sync boolean if this option is set to true, the promise returned will be resolved synchronously. defaults to false if not provided. charset string the character set to use when read the content of the uri given. defaults to utf-8 if not provided. ...
net/xhr - Archive of obsolete content
ost securely by white-listing the protocols that can be used in the url passed to the open() method, and limiting them to http:, https:, and possibly a special scheme that can be used to access the add-on's packaged, read-only resources. finally, we need to also consider attenuating http/https requests such that they're "sandboxed" and don't communicate potentially sensitive cookie information.
globals constructors xmlhttprequest() creates an xmlhttprequest. this is a constructor, so its use should always be preceded by the new operator. for more information about xmlhttprequest objects, see the mdn page on using xmlhttprequest and the security concerns section in this page. functions forceallowthirdpartycookie(xhr) force relevant cookies to be sent with this xmlhttprequest even if norma...
places/bookmarks - Archive of obsolete content
y 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. required. url string the url for the bookmark. required. optional options: name type group group the parent...
places/favicon - Archive of obsolete content
the object can be a url string or a tab. the platform service (moziasyncfavicons) retrieves favicon data stored from previously visited sites, and as such, will only return favicon urls for visited sites. ...
places/history - Archive of obsolete content
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 sortin...
preferences/event-target - Archive of obsolete content
ces system in firefox. this enables add-ons to listen to change events to the system-wide settings. these are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager.
globals constructor prefstarget(options) parameters options : object required options: name type branchname string by default this is "", the root. example var { prefstarget } = require("sdk/preferences/event-target"); // listen to the same branch which reqire("sdk/simple-prefs") does var target = prefstarget({ branchname: "extensions." + requi...
remote/child - Archive of obsolete content
moveeventlistener 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...
remote/parent - Archive of obsolete content
the module loads asynchronously but you can start sending messages to the module immediately. you can use an absolute path to the module or a relative path. if you use a relative path, you must use the module parameter. const { remoterequire } = require("sdk/remote/parent"); remoterequire("...
stylesheet/style - Archive of obsolete content
stylesheet file url(s) are verified to be local to an add-on, while css rules are verified to be a string or array of strings. the style created can be applied to a content by calling attach, and removed using detach. those functions are part of content/mod module. parameters options : object required options: name type uri string,array a string, or an array of strings, that represents local uri to stylesheet. ...
stylesheet/utils - Archive of obsolete content
the sheets added takes effect immediately, and only on the document of the window given. parameters window : nsidomwindow uri : string, nsiuri} type : string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". removesheet(window, uri, type) remove the document style sheet at sheeturi from the list of additional style sheets of the document. the removal takes effect immediately. ...
system/events - Archive of obsolete content
ervice, also known as nsiobserverservice. you can find a list of events dispatched by the firefox codebase here. var events = require("sdk/system/events"); var { ci } = require("chrome"); function listener(event) { var channel = event.subject.queryinterface(ci.nsihttpchannel); channel.setrequestheader("user-agent", "mybrowser/1.0", false); } events.on("http-on-modify-request", listener);
globals functions emit(type, event) send an event to observer service parameters type : string the event type. event : object an optional object with data and subject attributes. data refers to a string that you would like to pass through this event. subject should refer to the actual actor/subject of this event (ie: the object emitting the event). on(type, listener, strong) listen to events o...
system/runtime - Archive of obsolete content
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. ...
system/unload - Archive of obsolete content
it ensures that this wrapper method is called when the object's module is unloaded. therefore, when you register an object with ensure(), you can call its destructor method yourself, you can let it happen for you, or you can do both. the destructor will be called with a single argument describing the reason for the unload; see when(). if object does not have the expected destructor method, then an exception is thrown when ensure() is called. ...
tabs/utils - Archive of obsolete content
parameters tab : tab a xul tab element to activate. window : window a browser window. gettabbrowser(window) get the tabbrowser element for the given browser window. parameters window : window a browser window. returns tabbrowser : gettabcontainer(window) get the tabbrowser's tabcontainer property. parameters window : window a browser window. returns tabcontainer : gettabs(window) returns the tabs for the specified window. if you omit window, this function will return tabs across all the browser's windows. ...
test/assert - Archive of obsolete content
rt module, write a set of unit tests following the instructions in the unit testing tutorial. each test will be passed an assert object when you run the tests using jpm test. you can use this object to make assertions about your program's state. for example: var a = 1; exports["test value of a"] = function(assert) { assert.ok(a == 1, "test that a is 1"); } require("sdk/test").run(exports);
globals constructors assert(logger) create a new assert object. this function is only called by the unit test framework, and not by unit tests themselves. parameters logger : object object used to log the results of assertions. assert an object used to make assertions about a program's state in order to implement unit tests. the assert object's interface is defined by the commonjs unit testing ...
test/utils - Archive of obsolete content
may be asynchronous if beforefn accepts a third argument, which is a callback. parameters exports : object a test file's exports object beforefn : function the function to be called before each test. it has two arguments, or three if it is asynchronous: the first argument is the test's name as a string. t...
ui/frame - Archive of obsolete content
once created, the frame needs to be added to a toolbar for it to be visible: var { frame } = require("sdk/ui/frame"); var { toolbar } = require("sdk/ui/toolbar"); var frame = new frame({ url: "./frame.html" }); var toolbar = toolbar({ name: "my-toolbar", title: "my toolbar", items: [frame] }); parameters options : object required opt...
ui/id - Archive of obsolete content
making an id const { identify } = require('sdk/ui/id'); const thingy = class({ initialize: function(details) { let id = identify(this); } }); getting an id const { identify } = require('sdk/ui/id'); const { thingy } = require('./thingy'); let thing = thingy(/* ... */); let thingid = identify(thing); defining id generator const { identify } = require('sdk/ui/id'); const thingy = class(/* ... */); identify.define(thingy, thing => thing.guid); parameters object : object object to create an id for. ...
ui/toolbar - Archive of obsolete content
content is loaded and unloaded, and show and hide events when the uses shows or hides them. working with multiple browser windows there's only a single toolbar for all browser windows, so operations like show and hide work across all browser windows. if you need to customize content for a particular browser window, you can do that by messaging the window-specific frame hosted by that toolbar.
globals constructors toolbar(options) creates a toolbar. the only mandatory option is title, but for the toolbar to contain any actual content, the items parameter must also be supplied, and must contain at least object. this add-on creates a toolbar containing one button and a frame: var { actionbutton } = require('sdk/ui/button/action'); var { frame } = require("sdk/ui/frame"); var { toolbar } = r...
util/array - Archive of obsolete content
a simplified version of array.indexof(element) >= 0. let { has } = require('sdk/util/array'); let a = ['rock', 'roll', 100]; has(a, 'rock'); // true has(a, 'rush'); // false has(a, 100); // true parameters array : array the array to search. element : * the element to search for in the array. returns boolean : a boolean indicating whether or not the element was found in the array. hasany(array, elements) returns true if the given array contains any of the elements in the elements array, or false otherwise. ...
util/collection - Archive of obsolete content
the collection is backed by an array. parameters array : array if array is given, it will be used as the backing array. this way the caller can fully control the collection. otherwise a new empty array will be used, and no one but the collection will have access to it. functions addcollectionproperty(object, propname, [backingarray]) adds a collection property to the given object. ...
util/deprecate - Archive of obsolete content
it does not raise an exception, but just displays the error message and continues to execute the function. this function is mostly used to flag usage of deprecated functions, that are still available but which we intend to remove in a future release. ...
util/list - Archive of obsolete content
parameters element1 : object|string|number element2 : object|string|number ... : object|string|number functions addlistitem(list, item) function adds a item to a list. removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. list is composed out of iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list). ...
util/object - Archive of obsolete content
if two or more argument objects have properties with the same name, the property is overwritten with precedence from right to left, implying that properties of the object on the left are overwritten by a same named property of an object on the right. properties are merged with descriptors onto the source object. any argument given with "falsy" values (null, undefined) in case of objects are skipped. ...
util/uuid - Archive of obsolete content
used for by the platform see the mdn documentation for jsid. generate uuid to generate a new uuid, call uuid() with no arguments: let uuid = require('sdk/util/uuid').uuid(); parsing uuid to convert a string representation of a uuid to an nsid, pass the string representation to uuid(): let { uuid } = require('sdk/util/uuid'); let firefoxuuid = uuid('{ec8030f7-c20a-464f-9b0e-13a3a9e97384}');
globals functions uuid(stringid) generate a new uuid, or convert a string representation of a uuid to an nsid. parameters stringid : string string representation of a uuid, such as: "8cbc9bf4-4a16-11e2-aef7-c1a56188709b" optional. if this argument is supplied, it will be converted to an nsid and returned. otherwise a new nsid will be generated and returned. returns nsid : a uuid, represented...
window/utils - Archive of obsolete content
from private browser windows. the exception is the windows() function which returns an array of currently opened windows. private windows will not be included in this list if your add-on has not opted into private browsing. 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.
globals functions getmostrecentbrowserwindow() get the topmost browser window, as an nsidomwindow instance. returns nsidomwindow: the topmost browser window. getinnerid(window) returns the id of the specified window's current inner window. this function wraps nsidomwindowutils.currentinnerwindowid. parameters window : nsidomwindow the window whose inner window we are interested in. returns i...
cfx - Archive of obsolete content
nd no longer accepted for add-on submission. jpm should now be used instead. for information on how to migrate from cfx to jpm see this guide. enables you to test, run, and package add-ons. cfx is is no longer supported as of firefox 44 and no longer accepted for add-on submission, jpm should now be used instead. cfx usage is: cfx [options] command [command-specific options] "options" are
global options applicable to the tool itself or to all commands (for example --help). cfx supports the following
global options: -h, --help - show a help message and exit -v, --verbose - enable lots of output "command-specific options" are documented alongside the commands. there are four supported cfx commands: cfx init create a skeleton add-on as a starting point for yo...
jpm-mobile - Archive of obsolete content
you can use jpm and jpm-mobile for firefox 38 and onwards. this article is the reference for jpm-mobile. the node-based replacement for cfx --force-mobile. enables you to run and test add-ons for firefox mobile (aka fennec). jpm usage is: jpm-mobile [command] [options] jpm supports the following
global options: -h, --help - show a help message and exit -v, --version - print the jpm version number installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already. npm is included in node.js, so to install npm, visit nodejs.org and click the install button. after that you can install jpm just as you would any other npm package: npm install jpm-mobile -g depending on your setup, you might...
package.json - Archive of obsolete content
ecated along with cfx; it's not available when using jpm. the path to an image containing the large icon for the add-on. defaults to icon64.png. if you don't provide an icon here, the same icon as specified by icon will be used. this value will be used as the add-on's em:icon64url element in its install.rdf. the icon may be up to 64x64 pixels in size. id a
globally unique identifier for the add-on. this value will be used as the add-on's em:id element in its install.rdf. see the program id documentation. lib string representing the top-level module directory provided in this add-on. defaults to "lib". note: this is deprecated along with cfx and is not available when using jpm. license the ...
Adding a Button to the Toolbar - Archive of obsolete content
the browser will automatically choose the best fit for the screen resolution and the place in the browser ui that hosts the button. read more about specifying multiple icons. the icon file must be packaged with your add-on: it may not refer to a remote file. you can change the icon at any time by setting the button's icon property. you can change the icon, and the other state attributes, either
globally, for a specific window, or for a specific tab. read more about updating state. attaching a panel if you need to attach a panel to a button, use the toggle button api. this is just like the action button api except it adds a boolean checked property which is toggled whenever the button is checked. to attach the panel, pass the button to the panel's show() method. for more details on this, see ...
Localization - Archive of obsolete content
's locale data will be updated with the new file. limitations the current localization support is a first step towards full support, and contains a number of limitations. there's no support for content scripts or css files: at the moment, you can only localize strings appearing in javascript files that can require() sdk modules and in html. see bug 787351. the set of locale files is
global across an add-on. this means that a module isn't able to override a more general translation: so a module informal.js can't specify that "hello_id" occurring in its code should be localized to "hi!". the sdk tools compile the locale files into a json format when producing an xpi. this means that translators can't localize an add-on given the xpi alone, but must be given access to the add-on...
Add-on SDK - Archive of obsolete content
add-on scripts and content scripts. xul migration a guide to porting xul add-ons to the sdk. this guide includes a comparison of the two toolsets and a working example of porting a xul add-on. reference high-level apis reference documentation for the high-level sdk apis. tools reference reference documentation for the jpm tool used to develop, test and package add-ons, the console
global used for logging, and the package.json file. low-level apis reference documentation for the low-level sdk apis. ...
Canvas code snippets - Archive of obsolete content
ansform', 'translate']; var gettermethods = ['createpattern', 'drawfocusring', 'ispointinpath', 'measuretext', // drawfocusring not currently supported // the following might instead be wrapped to be able to chain their child objects 'createimagedata', 'createlineargradient', 'createradialgradient', 'getimagedata', 'putimagedata' ]; var props = ['canvas', 'fillstyle', 'font', '
globalalpha', '
globalcompositeoperation', 'linecap', 'linejoin', 'linewidth', 'miterlimit', 'shadowoffsetx', 'shadowoffsety', 'shadowblur', 'shadowcolor', 'strokestyle', 'textalign', 'textbaseline']; for (let m of methods) { let method = m; canvas2dcontext.prototype[method] = function() { this.ctx[method].apply(this.ctx, arguments); return this; }; } for (let m of...
Embedding SVG - Archive of obsolete content
<body> <p>hello</p> <svg:svg version="1.1" baseprofile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <p>world</p> </body> </html> embedding into xul make sure you use the right namespace when embedding <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- xul and svg go here --> </window> example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeep...
JavaScript Debugger Service - Archive of obsolete content
eakpointhook, debughook, debuggerhook, interrupthook and throwhook. note that filters are matched in a first in, first compared fashion. the first filter to match determines whether or not the hook is called. we create a generic createfilter function that acts as a jsdifilter factory. function createfilter(pattern, pass) { var jsdifilter = components.interfaces.jsdifilter; var filter = {
globalobject: null, flags: pass ? (jsdifilter.flag_enabled | jsdifilter.flag_pass) : jsdifilter.flag_enabled, urlpattern: pattern, startline: 0, endline: 0 }; return filter; }, we then add the filters we want. jsd.clearfilters(); // clear the list of filters // we exclude the scripts with the following filenames from being tracked jsd.appendfilter(createfilter("*/firefox/components/*")); j...
LookupNamespaceURI - Archive of obsolete content
note that all gecko-based browsers (including firefox) support node.lookupnamespaceuri. this function is not necessary for gecko-based browsers (though the function will quickly return the standard value for mozilla browsers) when used to reflect on static documents. however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
Miscellaneous - Archive of obsolete content
pet for generating random bytes that can, for example be used as a good source for cryptographic entropy. const nob = 128; // number of bytes var buffer = ''; var prng = components.classes['@mozilla.org/security/random-generator;1']; var bytebucket = prng.getservice(components.interfaces.nsirandomgenerator).generaterandombytes(nob, buffer); detecting full screen mode on/off it works for that
global 'window' object at least. window.addeventlistener('fullscreen', function(){ alert('fullscreen mode on or off') }, false) getting addon install path first one using addon manager: components.utils.import('resource://gre/modules/addonmanager.jsm'); addonmanager.getaddonbyid('example@addon', function(addon) { let path = addon.getresourceuri().path; // something like /home/username/.... })...
Preferences - Archive of obsolete content
to do it). it has the following benefits: you don't have to duplicate default values in various parts of your code. the code for reading preferences is simplified, since you don't need to worry about the get methods throwing exceptions. ...
Tabbox - Archive of obsolete content
moved, widget fails to advance to next tab*/ if(-1 == tabbox.selectedindex && tabs.childnodes.length>0){ tabbox.selectedindex=0; } } creating a close tab button to have a tab close button, you must configure the style. examples: .tabs-closebutton { list-style-image: url(http://mozilla.org/favicon.ico); } .tabs-closebutton { list-style-image: url("chrome://
global/skin/icons/close.gif"); } ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
our original root makefile, remembering to change the depth variable to account for the fact that they've moved a level further away from the mozilla root. you also need to remove the dist_files variable since that's going to be in the top-level makefile. every makefile that generates anything should define the xpi_name variable to make sure generated files go into your extension and not into the
global components/ directory. in fact, just define this in every makefile to be safe. you can use the same module in both base/ and advanced/ so that all the generated include files go into the same directory, but make sure that you don't use the same xpidl_module in the two public/ directories or one of the component type libraries (i.e. xpt files) will overwrite the other one and all hell will break l...
Interaction between privileged and non-privileged pages - Archive of obsolete content
we need for that is contained in evt.target.ownerdocument. we can extend the above example with some data transfer from the extension to the web page. in the following code sample 2 methods are combined: setting an extra attribute in the original event target element, and creating a new event message with a new event target element. for this to work we need to define the original target element
globally. we need a new event trigger in the web page and some code to show the event message actually arrived. in the extension we have to dispatch an event message to the right web page. the code containing the callback could look like this: in the extension: var myextension = { mylistener: function(evt) { alert("received from web page: " + evt.target.getattribute("attribute1") ...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
so consider the different button states, but we'll get into that further ahead. the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. this is very important because the toolbar customization dialog won't work correctly without this. the way to include the file in the manifest is to add this line: style chrome://
global/content/customizetoolbar.xul chrome://xulschoolhello/skin/toolbar.css if you are using xbl bindings (explained way ahead) for your toolbar items, you'll have to include the css files for those as well, each in a new line like the one above. we now have code that adds one or more buttons to the toolbar palette. the user can now use the customize dialog to add the buttons to the current firefox ...
Adding menus and submenus - Archive of obsolete content
ppendchild can be used to accomplish this. if you have nothing to show on a menu, you should follow the standard used in firefox: show a single disabled item with an "(empty)" label. if filling your menu takes a noticeable amount of time, you should not make firefox (and your users) wait for it to fill up before displaying anything. it's best to show an item with a throbber image (see chrome://
global/skin/icons/loading_16.png) so the user knows there's something going on, and asynchronously fill its contents. we'll look into some asynchronous techniques further ahead in the tutorial. adding elements to existing menus just as explained in the previous sections, the best place to overlay your extension menu is inside the tools menu. that is, unless there's a place inside the menu structure w...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
s of externally retrieved data will create security vulnerabilities. alternative: replace + function.apply() you may replace the original function with a new function, keeping a reference to the original function which you then call from the new one. // wrap in an anonymous function (which is called immediately). // this will encapsulate local variables such as _original and // not pollute the
global namespace. (function() { // keep a reference to the original function. var _original = gbrowser.addtab; // override a function. gbrowser.addtab = function() { // execute some action before the original function call. try { myaddon.onaddtab(arguments[0]); } catch (ex) { /* might handle this */ } // execute original function. var rv = _original.apply(gbrowser,...
Local Storage - Archive of obsolete content
during development you should use the "all" level, but for release versions it's usually better to move the level up to "warn", so that the log is compact and execution is more efficient. note: we recommend that all exception catch blocks include some logging at the error or warn levels, and in general you should use logging f...
Tabbed browser - Archive of obsolete content
refox is called "a browser". within the firefox browser are tabs and inside each tab is a browser, both in the common sense of a web page browser and the xul sense of a browser element. furthermore another meaning of 'browser' in this document and in some firefox source is "the tabbrowser element" in a firefox xul window. getting access to the browser from main window code running in firefox's
global chromewindow, common for extensions that overlay into browser.xul, can access the tabbrowser element using the
global variable gbrowser. // gbrowser is only accessible from the scope of // the browser window (browser.xul) gbrowser.addtab(...); if gbrowser isn't defined your code is either not running in the scope of the browser window or running too early. you can access gbrowser only after th...
Adding preferences to an extension - Archive of obsolete content
tically when the browser window is loaded and unloaded. window.addeventlistener("load", function(e) { stockwatcher.startup(); }, false); window.addeventlistener("unload", function(e) { stockwatcher.shutdown(); }, false); design the preference dialog now that we've written all the code, we need to build the xul file for the options dialog. ...
CSS3 - Archive of obsolete content
f this specification is in the work, allowing to tailor a web site regarding the input methods available on the user agent, with new media features like hover or pointer. detection of ecmascript support, using the script media features is also proposed. css style attributes recommendation since november 7th, 2013 formally defines the syntax of the content of the html style
global attribute. css fonts module level 3 candidate recommendation since september 20th, 2018 amends the css2.1 font matching algorithm to be closer to what is really implemented. adds: support for downloadable fonts via the css @font-face at-rule. the control of the contextual inter-glyph spacing via the css font-kerning property. the choice o...
Index of archived content - Archive of obsolete content
pport browser feature detection displaying notifications (deprecated) e4x e4x for templating processing xml with e4x e4x tutorial accessing xml children descendants and filters introduction namespaces the
global xml object iterator liveconnect liveconnect overview liveconnect reference jsexception jsobject msx emulator (jsmsx) old proxy api parallelarray prope...
MMgc - Archive of obsolete content
thout gcroot, those pointers won't be marked by the mark phase of the gc. note that gcroot can be used either by subclassing, or by creating a gcroot and passing it the memory locations to treat as a root: /** subclassing constructor */ gcroot(gc *gc); /** general constructor */ gcroot(gc *gc, const void *object, size_t size); allocating objects allocating unmanaged objects is as simple as using
global operator new/delete, the same way you always have. to allocate a managed (gc) object, you must use the parameterized form of operator new, and pass it a reference to the mmgc::gc object. class myobject : public mmgc::gcobject { ... }; ... myobject* myobject = new (gc) myobject(); dwb/drc/drcwb there are several smart pointer templates which must be used in your c++ code to work properly with mmg...
Source code directories overview - Archive of obsolete content
ctions inside makefiles. these programs are used for code level things instead of build level things (which are a stored in the build directory). content was split off from layout and contains objects as they are exposed to the dom. db contains c code for the mdb/mork database which is a low-level, general-purpose and cross-platform file library. it is used to store mail box data, news data and
global history data. it has not been updated to support xpcom yet. this code originated in the mozilla classic code base. dbm contains c code for managing, reading and writing hash tables. it is used for the auto-completion feature on the url edit box (stored in netscape.hst in mozilla classic) and for the cached pages index (stored in fat.db in mozilla classic). this code originated at uc berkeley. d...
Using content preferences - Archive of obsolete content
ocally save preferences on a per-site basis. this makes it possible to write an extension that lets the user customize the appearance of specific web sites (setting the font size larger on sites that use obnoxiously small fonts, for instance). the content preferences service, implemented by nsicontentprefservice, offers functions for setting and retrieving preferences for specific sites or in the
global preference space;
global preferences are used whenever a site-specific preference isn't available. site-specific content preferences are stored in the profile folder, in the database file "content-prefs.sqlite". example: setting and retrieving preferences this example demonstrates how to save a preference and then retrieve its value. var iosvc = components.classes["@mozilla.org/network/io-service...
Working with BFCache - Archive of obsolete content
the view in the current tab with a new page, what is the fate of the nsidomwindow supporting the view they click on? or: what happens when they hit the 'back' button? a: the outer nsidomwindow (the |window| object in content js, aka the <browser>'s contentwindow object in the parent document) stays right where it is. it just has its inner window and document replaced. the inner nsidomwindow (the
global scope object in content js) is either thrown away when gc happens, or frozen and placed in the bfcache. when the user hits the 'back' button, either the window in bfcache is thawed or a new inner window is created, depending on whether there's a window in the bfcache. q: is the page reloaded? loaded from cache? or is the dom saved in some way as if the window was there but invisible? are scripts ...
Creating a Firefox sidebar extension - Archive of obsolete content
ity openemptysidebar.commandkey "e"> <!entity openemptysidebar.modifierskey "shift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3. it creates a page holding one label. other elements can be included, please read the xul tutorials for more information. example 3. ...
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
nt to execute when the document finishes loading, call its open method with the type of http request we want to make and the url of the document to retrieve, and then call its send method to send the request. xmlhttprequest will retrieve the document located at the given url and call the updatetinderboxstatus() function when it is done. notice that we defined the instance of xmlhttprequest as a
global variable. this is because we need to reference it in the updatetinderboxstatus() function as well as the current function, and we can't pass the object from one function to the other because the one doesn't call the other directly. « previousnext » ...
chrome.manifest - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "chrome.manifest": skin
global my_theme jar:chrome/my_theme.jar!/
global/ skin mozapps my_theme jar:chrome/my_theme.jar!/mozapps/ skin messenger my_theme jar:chrome/my_theme.jar!/messenger/ skin messenger-newsblog my_theme jar:chrome/my_theme.jar!/messenger-newsblog/ skin communicator my_theme jar:chrome/my_theme.jar!/communicator/ skin help my_theme jar:chrome/my_theme.jar!/help/ skin navigator my_theme jar:chrome/my_theme.jar!/navigator/ skin editor my_theme jar:chrome/my_theme.jar!/editor/ ...
In-Depth - Archive of obsolete content
t. if you look at the modern skin, you'll notice that it adds the image to the other side of the toolbar. now that we have the code that will change the toolbar, it needs to be accessed. open up \classic\skin\classic\communicator\communicator.css and look for the .toolbar-primary section. there is a -moz-binding command there. point the url to the new location. change: -moz-binding: url("chrome://
global/content/bindings/toolbar.xml#toolbar-primary"); to -moz-binding: url("chrome://communicator/skin/toolbar/toolbarbindings.xml#toolbar-primary"); now every toolbar has a spot for an image on the right hand side and we can start adding images, but first we need to make sure we can see the images that we add. also in the communicator.css add this code: .toolbar-primary-icon { width: 100px; back...
toolbarBindings.xml - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "toolbarbindings.xml": <bindings id="toolbarbindings"> <binding id="toolbar-primary" extends="chrome://
global/content/bindings/toolbar.xml#toolbar-primary"> <content> <xul:hbox class="toolbar-holder toolbar-primary-holder" flex="1" xbl:inherits="orient=tborient,buttonstyle"> <xul:hbox class="toolbar-button-box" flex="1"> <children/> </xul:hbox> <xul:image class="toolbar-primary-icon" xbl:inherits="buttonstyle"/> </xul:hbox> </content> </binding> </bindings> ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
to summarize by matching patterns in those pages' urls. in this tutorial, we'll explain how to make regular expressions that match the urls for ebay auction item pages. by the end of the tutorial, you should know some basics about regular expressions and understand how to create expressions that match urls. for detailed documentation about regular expressions, see core_javascript_1.5_reference:
global_objects:regexp. to learn how to create a microsummary generator, see creating a microsummary. urls 101 urls for auction item pages on ebay, like those on many other sites, usually start with the string "http://" and contain a domain name, a file path, and some query parameters. here's a url for an auction item page on ebay: http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=280018439106 in ...
Dehydra Function Reference - Archive of obsolete content
not included), including both top-level functions, class member functions, and inline class member functions. decl is a variable type object representing the function being processed body is an array of {loc:, statements:array of variable types} representing an outline of the function stripped down to variables, function calls and assignments. process_decl(decl) process_decl is called for every
global variable, function, or template declaration. decl is a variable type input_end() called once at the end of the c++ source file before the compiler quits. this is useful for finalizing analyses. builtin functions the following functions are provided by dehydra and may be called by the user: print(msg) print a string to stdout (or stderr if the compiler is piping output). if the current callback ...
Drag and Drop - Archive of obsolete content
the drag operation is finished. there are two ways that drag and drop events can be handled. this first involves using the drag and drop xpcom interfaces directly. the second is to use a javascript wrapper object that handles some of this for you. the code for this wrapper can be found in a file named toolkit/content/nsdraganddrop.js nsdraganddrop.js which is contained in the widget-toolkit (or
global) package. xpcom drag and drop interfaces two interfaces are used to support drag and drop. the first is a drag service, nsidragservice and the second is the drag session, nsidragsession. the nsidragservice is responsible for creating drag sessions when a drag starts, and removing the drag session when the drag is complete. the function invokedragsession should be called to start a drag inside ...
Layout System Overview - Archive of obsolete content
presentation shell, or presshell, is first and foremost the owner of the formatting objects, the frames. management of the frames is facilitated by the frame manager, an instance of which the presshell owns. additionally, the presshell provides a specialized storage heap for frames, called an arena, that is used to make allocation and deallocation of frames faster and less likely to fragment the
global heap. the presentation shell also owns the root of the style system, the style set. in many cases the presentation shell provides pass-through methods to the style set, and generally uses the style set to do style resolution and style sheet management. one of the critical aspects of the presentation shell is the handling of frame formatting, or reflow. the presentation shell owns and maintains a ...
Style System Overview - Archive of obsolete content
the path from the root rule node to the style context's rule node for each rule that the element matches. style context api the style context api allows data to be obtained through a set of structs (see nsstylestruct.h). a struct for a style context can be obtained through nsistylecontext::getstyledata. nsiframe::getstyledata does the same thing for the frame's mstylecontext member, and the
global ::getstyledata is a typesafe helper that doesn't require the style struct id. this style struct is always const, and should always be declared as such (evil old-style casts often used with the non-typesafe forms sometimes hide this error), since the struct may be shared with other elements. the rule tree as we call nsrulewalker::forward on all the rules that are matched, we build or walk al...
Using microformats - Archive of obsolete content
this object and its api make finding and reading microformats easy to do. loading the microformats api the microformats object is created using the new javascript script loader added to firefox 3. ...
First run - Archive of obsolete content
ext with a page tailored to your jetpack. for example, you may want to tell users how to use your jetpack or link to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. a manifest is simply an object set to a variable named manifest. you may define this variable anywhere in the
global namespace of your jetpack. it's the same manifest you use when defining settings for your jetpack. the value of firstrunpage must be either a string or e4x xml. if the value is a both a string and a valid url, the page at that url becomes your first-run page. otherwise, the value is assumed to be html, and it becomes the body of your first-run page. this example sets the first-run page to some...
First Run - Archive of obsolete content
is text with a page tailored to your jetpack. for example, you may want to tell users how to use your jetpack or link to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. a manifest is simply an object set to a variable named manifest. you may define this variable anywhere in the
global namespace of your jetpack. it's the same manifest you use when defining settings for your jetpack. the value of firstrunpage must be either a string or e4x xml. if the value is a both a string and a valid url, the page at that url becomes your first-run page. otherwise, the value is assumed to be html, and it becomes the body of your first-run page. this example sets the first-run page to some ht...
Settings - Archive of obsolete content
ings persist across browser sessions and are stored using the jetpack [simple storage api][]. settings are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its
global namespace before it imports the settings api. the value of this variable must be an object that contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this i...
Jetpack Snippets - Archive of obsolete content
-lite-compressed.js'); document.body.appendchild(firebug); (function(){if(window.firebug.version){firebug.init();}else{settimeout(arguments.callee);}})();void(firebug); ]]></script> </body></html>, width: 800, //wide enough to use firebug onselect: function(slide) { slide.slide(800, true); }}); calling into a slidebar from the
global jetpack scope jetpack.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 me...
Settings - Archive of obsolete content
are stored using the jetpack simple storage api. settings are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.import("storage.settings"); specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its
global namespace before it imports the settings api. the value of this variable must be an object that contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this ...
Metro browser chrome tests - Archive of obsolete content
l be ignored unless invoked by test(). gtests make use of promises and tasks for managing execution. test comparison functions used in metro browser chrome tests are identical to those supported by mochitests, see how the comparison functions work in the mochitest documentation for more details. helper functions the eventutils helper functions are available on the eventutils object defined in the
global scope. additional metro specific test helpers can be found in /browser/metro/base/tests/mochitest/head.js. you may add additional common utils and helpers to head.js. be careful about changing existing helpers as changes may impact tests in other libraries. static content for tests static content (html files, images, etc.) should be stored in sub directories to avoid polluting the main test direc...
Microsummary XML grammar reference - Archive of obsolete content
re they do not inadvertently match urls which merely contain the urls they intend to match. for example, the regular expression http://www\.example\.com/ matches both the url http://www.example.com/ and the url http://www.evil.com/http://www.example.com/, but the regular expression ^http://www\.example\.com/ matches only the first of those two urls. see the reference core_javascript_1.5_reference:
global_objects:regexp for the details of the regular expression syntax valid for generators and the tutorial creating regular expressions for a microsummary generator for step by step instructions to writing regular expressions that match urls. the <include> element the <include> element identifies a set of pages that the generator is able to summarize. it must be a child of the <pages> element, and it ...
New Skin Notes - Archive of obsolete content
tation which requires usage of tables, etc... wikipedia's side bar is smaller, btw, probably for the same reasons. since i manage a number of sites for which i must respect quality standards at 800 pixels width for compatibility (we accept break 640 compatibility nowadays except for sites intended for pdas/ppcs), i find myself needing to use ctrl+- with the devmo wikki currently, not to change my
global settings of course, which are fine and factory-default, working well with the other sites i visit regularily or manage... thanks again --mmondor future fixes in l10n versions there all heading links are wrong - main link and documentation leads to english devmo, and devnews and webwatch should be hidden or localized too. --gandalf 01:30, 29 aug 2005 (pdt) we'll revisit this later. tab links ...
Space Manager Detailed Design - Archive of obsolete content
ect* abandrect); nsresult getbandavailablespace(const bandrect* aband, nscoord ay, const nssize& amaxsize, nsbanddata& aavailablespace) const; nsiframe* const mframe; // frame associated with the space manager nscoord mx, my; // translation from local to
global coordinate space bandlist mbandlist; // header/sentinel for circular linked list of band rects frameinfo* mframeinfomap; nsintervalset mfloatdamage; static print32 scachedspacemanagercount; static void* scachedspacemanagers[ns_space_manager_cache_size]; nsspacemanager(const nsspacemanager&); // no implementation void operator=(const nsspacemanager&); // no impleme...
Tamarin build documentation - Archive of obsolete content
for 'editor scalability mode' to 20000 lines. as some tamarin source files have more than the eclipse standard threshold of 5000, they do not appear as indexed. the threshold can be adjusted in eclipse preferences >> c/c++ >> editor >> scalability. *important* project-specific settings for the cdt indexer do not appear to work (it looks like a bug in eclipse), so you have to set these manually/
globally. what we want is to have the indexer track the currently selected build config (so the correct conditional compiles are highlighted in the editor). to enable this go to eclipse preferences >> c/c++ >> indexer, then select 'use active build configuration' in the 'build configuration for the indexer' section. importing the project into eclipse file >> import >> general >> existing projects i...
The new nsString class implementation (1999) - Archive of obsolete content
uld be used sparingly. memory management a principal enhancement of the new architecture is pluggable memory allocators. all nsstring subclasses provide their own default allocator implementations, but programmers are free to use their own. in the new prototype nsstrimpl and nsstring classes, the allocator is an intrinsic member installed during construction of the string (by default they share a
global allocator). note: the com rules imply that everyone needs to use the same allocators, that they acquire via a
global com service called cogetmalloc(). our nsstrimpl uses an allocator pattern so that programmers can install their own policy, but this may also make allocation simpler in a multiprocess environment. i'm wondering if this is sufficient, namely, that a string can return it's own (share...
URIs and URLs - Archive of obsolete content
, port, directory, filebasename, fileextension, param, query and ref. together these segments form the url spec with the following syntax: scheme://username:password@host:port/directory/filebasename.fileextension;param?query#ref for performance reasons the complete spec is stored in escaped form in the nsstandardurl object with pointers (position and length) to each basic segment and for the more
global segments like path and prehost for example. necko provides pre written urlparsers for schemes based on hierachical naming systems. escaping to be able to parse an url safely it is sometimes necessary to "escape" certain characters, to hide them from the parser. an escaped character is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits r...
Venkman Introduction - Archive of obsolete content
ys to start the debugger: from firefox, you can start it by selecting javascript debugger from the tools menu (tools->web development menu in mozilla 1.x and netscape). you can also start the browser with the -venkman command line option, which launches venkman initially instead of an application front end. (note that venkman displays usage data when it starts up: "recorded local startup x,
global yyy." this data comes from a counter built in to the application. for more information about this counter and the data, see item 2.2 in the venkman faq.) when you first start venkman, the basic views are arranged as in the screenshot above—though you can customize the layout and presence of the different views however you want, as we describe in the view customization section below. the scri...
Learn XPI Installer Scripting by Example - Archive of obsolete content
me registry, you must use the registerchrome function of the install object. if successful, this function returns a "0" and makes entries into theinstalled-chrome.txt file in the chrome subdirectory, which is then used to regenerate the various rdf files that make up the chrome registry. ...
textbox.type - Archive of obsolete content
e. the command event will fire if the user presses the enter key. the timed type is deprecated in gecko 1.9.1 and the search textbox may be used instead. xbl-specific note beware that if you create an xbl binding for a textbox, you need to use the appropriate extends attribute and changing type attribute on the tree won't have effect. e.g. if you have <binding id="input" extends="chrome://
global/content/bindings/autocomplete.xml#autocomplete" >, then the textbox will have autocomplete type, regardless of tree's 'type' attribute. use <binding extends="chrome://
global/content/bindings/textbox.xml#textbox" > for ordinary textbox. see also type ...
Accessing Files - Archive of obsolete content
is a convenient location where an extension might save a file it needs to use. this directory is referred to as the user's profile directory. to get a reference to a file object use nsiscriptableio.getfile(). the following example will retrieve a reference to a file named sample.txt located in the profile directory. var file = io.getfile("profile", "sample.txt"); the nsiscriptableio object is a
global object always available within an application or extension which provides a number of useful functions for dealing with files. one such method it provides is nsiscriptableio.getfile() which returns a new nsifile object. the first argument to nsiscriptableio.getfile() is the starting directory from which to locate a file. in the example above the word 'profile' is used, which means start from with...
IO - Archive of obsolete content
using files a xul application or extension may access files on disk, and either read or write to files. a file is accessed via a file object. to get a reference to a file object use nsiscriptableio.getfile(). the following example will retrieve a reference to a file located in the profile directory named sample.txt. var file = io.getfile("profile", "sample.txt"); the nsiscriptableio object is a
global object always available within an application or extension. it provides a number of useful functions for dealing with files. retrieve a file object for information about getting a file object, see accessing files get information about a file available information about a file include the permissions, size, and last modified date of a file. see getting file information for more details. reading f...
loadURI - Archive of obsolete content
please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into the document, with the given referrer and character set. the first argument should be a string, not a nsiuri object. ...
Extensions - Archive of obsolete content
for general information about how to determine which element was the target of the context menu, that is, the element that was context clicked, see determining what was 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. 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 typ...
Panels - Archive of obsolete content
opup displays for selecting or entering data. the panel element the panel element is used to create panels. the panel will display whatever elements are placed as children of the panel element. for example, the following panel displays a textbox for entering a name. note that the panel is not placed in a separate file and is instead placed inside another window. <?xml-stylesheet href="chrome://
global/skin" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button label="details" type="panel"> <panel id="search-panel"> <label control="name" value="name:"/> <textbox id="name"/> </panel> </button> </window> many panels will be associated with a button, as in this example. when the button is pressed, the panel is opened. clicking outs...
PopupEvents - Archive of obsolete content
om within a popupshowing listener. the default operation of the popupshowing event is to continue showing the popup. the preventdefault method will stop this from happening and the popup will not be opened. <menu label="edit"> <menupopup onpopupshowing="if (gdisallowed) event.preventdefault();"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> in this example, a
global variable gdisallowed is checked and the preventdefault method is called. if you want to prevent a context menu from opening it is better to call preventdefault with a handler for the contextmenu event instead, to avoid the extra steps necessary to fire the popupshowing event if it isn't needed. when using nested submenus, make sure to check in the popupshowing event that the event corresponds to ...
Sorting and filtering a custom tree view - Archive of obsolete content
custom tree view, that is, a tree whose values are loaded via javascript. this will not work for other types of trees, for example rdf-backed or ones created with dom methods. for the sake of simplicity, strings are not localized and the data loaded is hard coded. because of bug 340478, this code will only work from privileged script. ...
Code Samples - Archive of obsolete content
s["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher) .openwindow(null, uri, name, "chrome,resizable", null) change the first two lines to specify the window that you want to open. ...
Custom toolbar button - Archive of obsolete content
le contains information used by the application's extension manager. sections for target applications specify the versions where the extension works. the last section in the file specifies that this extension adds content to the application. 4. create a plain text file named chrome.manifest. ...
Tree Widget Changes - Archive of obsolete content
out the attribute. note that it's the value attribute you use, not the label attribute. <treecell/> <treecell value="true"/> you need to specify the checkbox image with css for the checkbox to display. (do not set id of the column to be 'checked' it will cause problems with the css) treechildren::-moz-tree-checkbox(checked) { /* css for checked cells */ list-style-image: url("chrome://
global/skin/checkbox/cbox-check.gif"); } in addition, checkmark columns support editing: <tree editable="true"> <treecols> <treecol type="checkbox" editable="true"> ... </treecol> </treecols> </tree> if the column is editable, the user can click the cell to change the state of the checkbox. when the user clicks the cell, the view's setcellvalue method will be called with either th...
Adding Buttons - Archive of obsolete content
to this, the buttons will appear to stretch across the window. you can add align="start" to the window tag to prevent the stretching. the findfile.xul example let's add this code to the file findfile.xul that we created in the previous section. the code needs to be inserted in-between the window tags. the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </window> you'll notice that the cancel button was added also. the window has been given a horizontal orientation so ...
Adding HTML Elements - Archive of obsolete content
t. xmlns:html="http://www.w3.org/1999/xhtml" this is a declaration of html much like the one we used to declare xul. this must be entered exactly as shown or it won't work correctly. note that mozilla does not actually download this url, but it does recognize it as being html. ...
Box Model Details - Archive of obsolete content
d to center the buttons horizontally. the align attribute aligns the buttons vertically. the result is that the buttons will be centered in the box in both directions. this example will work with a vertical box as well, although the second button will be underneath the first one, instead of beside it. ...
Creating a Wizard - Archive of obsolete content
ser of a particular os. a typical layout will include a title across the top, a set of navigation buttons across the bottom and the page contents in between. the title across the top is created using the title attribute, much like one would use for regular windows. the navigation buttons are created automatically. ...
Creating an Installer - Archive of obsolete content
and executed. this script will call install functions which will indicate which files from the archive should be installed. once the script is complete, the new package has been installed. if multiple packages are being installed, their scripts will run in sequence. install triggers as indicated above, the install process is started by an install trigger. this involves the use of the special
global object installtrigger. it contains a number of methods which can be used to start an installation. you can use this object in local or remote content, meaning that it is suitable for a download from a web site. let's create an example install trigger. this involves the use of the function installtrigger.install(). this function takes two arguments, the first is a list of packages to install, and...
Custom Tree Views - Archive of obsolete content
a value to this property at any time to set or change the view. function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together. an inline script has been used here to simplify the example. normally, you would put the script in an external script file. ...
Install Scripts - Archive of obsolete content
lexible enough to allow you to uninstall files. for this reason, installers include an install script to handle the installation process. the installer script must be called install.js and must be placed at the top level of the installer archive. the script will contain javascript code which calls a number of install functions. in an html document, or a xul document, the window object is the root
global object. that means that you can call the methods of the window object with the qualifier before it, which means that window.open() can simply be written open(). in an install script, there is no associated window, however the
global object will be an install object which contains a number of functions to customize the install process. some of the install object's functions will be described below...
Introduction to XBL - Archive of obsolete content
defined element has. binding example the box is generic enough that you can use it to create custom widgets (although you can use any element, even one you make up yourself). by assigning a class to a box tag, you can associate a binding to only those boxes that belong to that class. the following example demonstrates this. ...
Keyboard Shortcuts - Archive of obsolete content
lled when a key is released while an element has the focus. key events are only sent to the element that has the focus. typically, this will include textboxes, buttons, checkboxes and so 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...
Localization - Archive of obsolete content
s two entities, one for the label on the undo menu item and the second for the access key. changing the find files example let's take a look at how we would put all of this together by modifying the find files dialog so that it uses a dtd file for all of its text strings. the entire xul file is shown below with the changes shown in red. ...
Manifest Files - Archive of obsolete content
le path using a file url or a jar archive using a jar url, which will be described in a moment. you can specify multiple packages by including another line in the manifest file. the browser.manifest file used by firefox looks like this: content branding jar:browser.jar!/content/branding/ xpcnativewrappers=yes content browser jar:browser.jar!/content/browser/ xpcnativewrappers=yes overlay chrome://
global/content/viewsource.xul chrome://browser/content/viewsourceoverlay.xul overlay chrome://
global/content/viewpartialsource.xul chrome://browser/content/viewsourceoverlay.xul overlay chrome://browser/content/pageinfo.xul chrome://pippki/content/pageinfooverlay.xul two packages are listed here, 'branding' and 'browser'. three overlays are also specified, which allow content from different packages to...
Modifying the Default Skin - Archive of obsolete content
creating an entirely new skin. firefox has a theme manager for changing the default skin. (although the underlying code for mozilla calls them skins and the user interface calls them themes, they're both referring to the same thing). a skin is described using css, allowing you to define the colors, borders and images used to draw elements. the file classic.jar contains the skin definitions. the
global directory within this archive contains the main style definitions for how to display the various xul elements. by changing these files, you can change the look of the xul applications. customize with userchrome.css if you place a file called 'userchrome.css' in a directory called 'chrome' inside your user profile directory, you can override settings without changing the archives themselves. thi...
More Wizards - Archive of obsolete content
xample, the user must enter a secret code into a textbox on the first page of the wizard. the function checkcode() is called whenever the first page is shown as indicated by the onpageshow attribute. it is also called whenever a key is pressed in the textbox, to determine whether the next button should be enabled again. ...
Tree View Details - Archive of obsolete content
tree to repaint the twisty in the new state. the easiest way to do this is to invalidate the row. complete example there are several other view functions we can implement but they don't need to do anything in this example, so we can create functions that do nothing for those. ...
XBL Inheritance - Archive of obsolete content
atures from the binding it inherits from (and any that binding inherits from and so on up the tree). to extend an existing binding, add an extends attribute on to the binding tag. for example, the following binding creates a textbox which adds the text 'http://www' to the beginning of its value when the f4 key is pressed. example 1 : source <binding id="textboxwithhttp" extends="chrome://
global/content/bindings/textbox.xml#textbox"> <handlers> <handler event="keypress" keycode="vk_f4"> this.value="http://www"+value; </handler> </handlers> </binding> the xbl here extends from the xul textbox element. the url given in the extends attribute above is the url of the textbox binding. this means that we inherit all of the content and behavior provided by the textbox binding.
XPCOM Interfaces - Archive of obsolete content
ponents afile.initwithpath(sourcefile); adir.initwithpath(destdir); // finally, copy the file, without renaming it afile.copyto(adir,null); } copyfile("/mozilla/testfile.txt","/etc"); xpcom services some xpcom components are special components called services. you do not create instances of them because only one should exist. services provide general functions which either get or set
global data or perform operations on other objects. instead of calling createinstance(), you call getservice() to get a reference to the service component. other than that, services are not very different from other components. one such service provided with mozilla is a bookmarks service. it allows you to add bookmarks to the user's current bookmark list. an example is shown below: var bmarks = compo...
Using the Editor from XUL - Archive of obsolete content
ay their changes, or cancel. note that if they cancel, the close operation is aborted. the user clicks the close widget in their os/window manager. in this case, the onclose method on the <window> element is called. the user chooses 'close' from the file menu, uses the key shortcut, or quits the application, causing all windows to be closed. before each window is closed, javascript code in
globaloverlay.js tries to call a trytoclose method on each window. in editor.js, we set this to call editorcanclose(). if the user chooses to save the document, or throw away their changes, then the window is closed. when the last reference to the nseditorshell goes away (as a result of nseditorboxobject releasing its reference) it releases the owning reference on the editor. editor event handling e...
Window icons - Archive of obsolete content
7. see also bug 1531836 for more details. starting with firefox 1.5, thunderbird 1.5, and xulrunner 1.8, you can specify an icon for a xul window by putting files named mywindow.ico (for windows) and mywindow.xpm or mywindow16.xpm (linux), where mywindow is the id of the <window> you want to attach the icon to, in the chrome/icons/default subfolder of your bundle. these icons will override the
global icon files, which are located in app_dir/browser/chrome/icons/default. note: the
global icons override does not currently work due to bug bug 543490.
global icon files currently take precedence and bundles are only searched for icons which are not provided by the application. starting with firefox 3.0, xulrunner 3.0, thunderbird 3.0 and seamonkey 2.0 you can now specify png format icons inste...
XUL Questions and Answers - Archive of obsolete content
ound is to open the content in a new window using "window.open" and send titlebar=”no” as one of the flags in the 3rd argument. is it possible to have checkbox support for multi column lists? the current issue is a person exploring if it is possible to have checkbox support for multi column lists. ...
XUL Template Primer - Bindings - Archive of obsolete content
onditions>. this is different from the variables specified in the rule's conditions, where a value must be found for each variable for the rule to match. if a <binding> can't be matched, the rule will still fire. example to illustrate how <bindings> work, we'll examine this xul document, which builds a simple content model an rdf/xml file. ...
XUL Event Propagation - Archive of obsolete content
get itself. the combination of basic these two basic event flow mechanisms, event bubbling and event capturing, mean that events raised in the interface can be caught anywhere above the element that raised the event. this flexibility in the xul event model is the focus of this article. ...
dialog - Archive of obsolete content
dir, buttondisabledaccept, buttonlabelaccept, buttonlabelcancel, buttonlabeldisclosure, buttonlabelextra1, buttonlabelextra2, buttonlabelhelp, buttonorient, buttonpack, buttons, defaultbutton, title properties buttons, defaultbutton methods acceptdialog, canceldialog, centerwindowonscreen, getbutton, movetoalertposition examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/
global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" buttonlabelcancel="cancel" buttonlabelaccept="save"> <dialogheader title="options" description="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio label="red"/> <radio...
key - Archive of obsolete content
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. ...
prefwindow - Archive of obsolete content
lastselected, onbeforeaccept, ondialogaccept, ondialogcancel, ondialogdisclosure, ondialoghelp, onload, onunload, title, type properties buttons, currentpane, defaultbutton, lastselected, preferencepanes, type methods acceptdialog, addpane, canceldialog, centerwindowonscreen, getbutton, opensubdialog, openwindow, showpane examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://
global/skin/" type="text/css"?> <prefwindow xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="saveoptions" label="backups"> <preferences> <preference id="pref-backup" name="myapp.mybackups" type="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" type="int"/> </preferences> <checkbox label="automatically save backups"...
tabbrowser - Archive of obsolete content
ed in the background, and if replace is true, the currently displayed tabs are replaced with the specified uris instead of adding new tabs. the properties of params are following: boolean inbackground boolean replace boolean allowthirdpartyfixup tab targettab number newindex object postdatas number usercontextid note: this is the xul method on <browser> / <tabbrowser>, not the
global function in chrome://browser/content/browser.js. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into the document, with the given referrer and character set. the first argument should be a string, not a nsiuri object...
toolbox - Archive of obsolete content
'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. ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
urce, then come back here since the build process itself will be slightly different. got source? now you need to set up a special .mozconfig file to tell mozilla to build both xulrunner and your application. here's a sample .mozconfig for building xulrunner and mccoy: # options for client.mk. mk_add_options moz_build_projects="xulrunner mccoy" mk_add_options moz_objdir=@topsrcdir@/../mccoybase #
global options ac_add_options --enable-debug ac_add_options --disable-optimize # xulrunner options ac_add_app_options xulrunner --enable-application=xulrunner # mccoy options ac_add_app_options mccoy --enable-application=mccoy ac_add_app_options mccoy --with-libxul-sdk=../xulrunner/dist the first section tells mozilla what to build and where to put the resulting object files. in this case, we are bui...
Dialogs in XULRunner - Archive of obsolete content
get a consistent experience across applications. custom dialogs building dialogs in xul is very similar to creating windows. each dialog is described in its own xul file. xul provides a dialog element to act as the container for the dialog. dialog xul files can have dtd, css, and javascript, just like windows. ...
Getting started with XULRunner - Archive of obsolete content
detail in xulrunner:specifying startup chrome window. the debugging preferences are discussed in debugging a xulrunner application step 7: create some xul finally, we need to create a simple xul window, which is described in the file main.xul. nothing fancy here, just the minimum we need to make a window. no menus or anything. ...
MacFAQ - Archive of obsolete content
be removed, all you need is the window.arguments[0]) <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="myxul_hidden" windowtype="myxul:hiddenwindow" title="" width="0" height="0" persist="screenx screeny width height sizemode" > <!-- load the mozilla helpers --> <script type="application/javascript" src="chrome://
global/content/nsusersettings.js" /> <script><![cdata[ function debug(alogstring) { var mconsoleservice = components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice) mconsoleservice.logstringmessage("myxul: " + alogstring + "\n"); } function checkotherwindows() { var singletonwindowtype = nspref...
nsIContentPolicy - Archive of obsolete content
t-face rule. type_media 15 indicates a video or audio load. type_websocket 16 indicates a websocket load. type_csp_report 17 indicates a content security policy report. type_xslt 18 indicates a style sheet transformation. type_beacon 19 indicates a beacon post. type_fetch 20 indicates a load initiated by the
globalfetch.fetch() method, which is available as a
global in both window and worker contexts. type_imageset 21 indicates a request to load an <img> (with the srcset attribute or <picture>. type_web_manifest 22 indicates a request to load a web manifest. type_internal_script 23 an internal constant used to represent scripts loaded using <script> elements...
Archived Mozilla and build documentation - Archive of obsolete content
if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these
globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the
global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., javascript crypto mozilla defines a special javascript object to allow web pages access to ce...
NP_Initialize - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary provides
global initialization for a plug-in. syntax windows #include <npapi.h> nperror winapi np_initialize(npnetscapefuncs *anpnfuncs) unix #include <npapi.h> nperror np_initialize(npnetscapefuncs *anpnfuncs, nppluginfuncs *anppfuncs) returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls this function only once: when a plug-in is loaded, before the first instance is created. this is the first function that the browser calls. np_initialize tells the plug-in that the browser has loaded it and provides
global initialization. allocate any memory or res...
NP_Shutdown - Archive of obsolete content
syntax #include <npapi.h> void np_shutdown(void); windows #include <npapi.h> void winapi np_shutdown(void); description the browser calls this function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself. use np_shutdown to delete any data allocated in np_initialize to be shared by all instances of a plug-in. if you have defined a java class for your plug-in, be sure to release it at this time so that java can unload it and free up memory. ...
NPAPI plugin reference - Archive of obsolete content
gin with npn_ to indicate that they are implemented by the browser and called by the plug-in. np_getmimedescription np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. np_getvalue allows the browser to query the plug-in for information. np_initialize provides
global initialization for a plug-in. np_port contains information required by the window field of an npwindow structure. np_shutdown provides
global deinitialization for a plug-in. npanycallbackstruct contains information required during embedded mode printing. npapi plug-in side api this chapter describes methods in the plug-in api that are available from the plug-in object; these allow plug-in...
Introduction to SSL - Archive of obsolete content
some organizations may want to disable the weaker ciphers to prevent ssl connections with weaker encryption. however, due to u.s. government restrictions on products that support anything stronger than 40-bit encryption, disabling support for all 40-bit ciphers effectively restricts access to network browsers that are available only in the united states (unless the server involved has a special
global server id that permits the international client to "step up" to stronger encryption). to serve the largest possible range of users, it's a good idea for administrators to enable as broad a range of ssl cipher suites as possible. that way, when a domestic client or server is dealing with another domestic server or client, respectively, it will negotiate the use of the strongest ciphers available.
-moz-border-bottom-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-bottom-colors css property sets a list of colors for the bottom border. /* single <color> value */ -moz-border-bottom-colors: #f0f0f0; /* multiple <color> values */ -moz-border-bottom-colors: #f0f0f0 #a0a0a0 #505050 #000000; /*
global values */ -moz-border-bottom-colors: inherit; -moz-border-bottom-colors: initial; -moz-border-bottom-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valu...
-moz-border-left-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-left-colors css property sets a list of colors for the left border. /* single <color> value */ -moz-border-left-colors: #f0f0f0; /* multiple <color> values */ -moz-border-left-colors: #f0f0f0 #a0a0a0 #505050 #000000; /*
global values */ -moz-border-left-colors: inherit; -moz-border-left-colors: initial; -moz-border-left-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifieda...
-moz-border-right-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-right-colors css property sets a list of colors for the right border. /* single <color> value */ -moz-border-right-colors: #f0f0f0; /* multiple <color> values */ -moz-border-right-colors: #f0f0f0 #a0a0a0 #505050 #000000; /*
global values */ -moz-border-right-colors: inherit; -moz-border-right-colors: initial; -moz-border-right-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas spe...
-moz-border-top-colors - Archive of obsolete content
in mozilla applications like firefox, the -moz-border-top-colors css property sets a list of colors for the top border. /* single <color> value */ -moz-border-top-colors: #f0f0f0; /* multiple <color> values */ -moz-border-top-colors: #f0f0f0 #a0a0a0 #505050 #000000; /*
global values */ -moz-border-top-colors: inherit; -moz-border-top-colors: initial; -moz-border-top-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimatio...
-moz-stack-sizing - Archive of obsolete content
-moz-stack-sizing is an extended css property. normally, a <xul:stack> will change its size so that all of its child elements are completely visible. for example, moving a child of the stack far to the right will widen the stack so the child remains visible. /* keyword values */ -moz-stack-sizing: auto; -moz-stack-sizing: ignore; /*
global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; if you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. the property is set not on the stack itself, but on the stack's children. this lets you ignore certain children, but not others. note: in previous versions of gecko it was possible to work around the prob...
display-inside - Archive of obsolete content
the display-inside css property specifies the inner display type of the box generated by an element, dictating how its contents lay out inside the box. /* keyword values */ display-inside: auto; display-inside: block; display-inside: table; display-inside: flex; display-inside: grid; display-inside: ruby; /*
global values */ display-inside: inherit; display-inside: initial; display-inside: unset; value not found in db! syntax one of the keyword values listed below. values auto if the element's computed <display-outside> value is inline-level, the element is an inline element, and lays out its contents using inline layout. if the element's computed <display-outside> value is an layout-specific internal type, this elements acts as normal for its given <display-outside> value.
display-outside - Archive of obsolete content
values block-level the element generates a block-level box, and participates in a block formatting context. other formatting contexts, such as flex formatting contexts, may also work with block-level elements. inline-level the eleme...
Using JavaScript Generators in Firefox - Archive of obsolete content
warning: this technique works only in firefox, not ie, chrome, safari, etc. generators can be used to simplify asynchronous code in firefox by opting in to using javascript version 1.7 or later. you can opt in in html as follows: <script type="text/javascript;version=1.7" src="myscript.js"></script> then your myscript.js file might look like this: // need to stash the generator in a
global variable. var generator; // simple event listener function to pass the received event to the generator. function grabevent(event) { generator.send(event); } // when we're all done we can close the generator, but that must happen outside // of the generator so we use a timeout. function closegenerator() { settimeout(function() { generator.close(); }, 0); } // our main steps function databas...
Debug - Archive of obsolete content
syntax you do not instantiate the debug object. its properties and methods are called off the debug class. there are different ways to debug internet explorer and windows 8.x store 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. ...
New in JavaScript 1.3 - Archive of obsolete content
or and navigator 4.06 and 4.5 executes javascript language versions up to 1.3. note that communicator and navigator 4.0-4.05 and earlier ignored scripts with the language attribute set to "javascript1.3" and higher. <script language="javascript1.2"> <!-- javascript for navigator 4.0. --> <script language="javascript1.3"> <!-- javascript for navigator 4.5. ...
New in JavaScript 1.8.5 - Archive of obsolete content
old proxy api offers support for creating object and function proxies that enable meta-programming in javascript. changed functionality in javascript 1.8.5 iso 8601 support in date: the date object's parse() method now supports simple iso 8601 format date strings.
global objects made read only: the nan, infinity, and undefined
global objects have been made read only, per the ecmascript 5 specification. obj.__parent__ and obj.__count__ become obsolete. some information about why: spidermonkey change du jour: the special __parent__ property has been removed bug 551529 & bug 552560. trailing commas no longer accepted in json.parse(). ...
arguments.caller - Archive of obsolete content
the obsolete arguments.caller property used to provide the function that invoked the currently executing function. this property has been removed and no longer works. description this property is not available anymore, but you can still use function.caller. function whocalled() { if (whocalled.caller == null) console.log('i was called from the
global scope.'); else console.log(whocalled.caller + ' called me!'); } examples the following code was used to check the value of arguments.caller in a function, but doesn't work anymore. function whocalled() { if (arguments.caller == null) console.log('i was called from the
global scope.'); else console.log(arguments.caller + ' called me!'); } specifications not part of any standard. implemented in javascrip...
LiveConnect Overview - Archive of obsolete content
compatibility in javascript 1.3 and earlier versions, the jsexception class had three public constructors which optionally took a string argument, specifying the detail message or other information for the exception. the getwrappedexception method was not available. use a try...catch statement such as the following to handle liveconnect exceptions in javascript 1.3 and earlier versions: try {
global.eval("foo.bar = 999;"); } catch (exception e) { if (e instanceof jsexception) { jscodefailed(); } else { othercodefailed(); } } in this example, the eval statement fails if foo is not defined. the catch block executes the jscodefailed method if the eval statement in the try block throws a jsexception; the othercodefailed method executes if the try block throws any other erro...
LiveConnect - Archive of obsolete content
liveconnect provides javascript with the ability to call methods of java classes and vice-versa using the existing java infrastructure. older versions of gecko included special support for the java<->javascript bridge (such as the java and packages
global objects), but as of mozilla 16 (firefox 16 / thunderbird 16 / seamonkey 2.13) liveconnect functionality is provided solely by the oracle's java plugin. documentation java plugin - liveconnect documentation this is likely the most up-to-date documentation of liveconnect. removal of java and packages
global objects in mozilla 16 see bug 748343 for the rationale and workarounds. you can still embed java applets and access their api from javascript. liveconnect overview an overview for l...
Old Proxy API - Archive of obsolete content
is provided). calltrap is a variable-argument function(args) { return any; } that reifies “proxy(args)”. note: the this-binding of the calltrap function is the this-binding of the call-site. constructtrap is an optional variable-argument function(args) { return any-object; } that reifies “new proxy(args)”. the this-binding of the constructtrap is either undefined (in strict mode) or the
global object (in non-strict mode). if no constructtrap is provided, performing new proxy(...args) calls the proxy’s calltrap with this bound to a new object delegating to the proxy's prototype. handler is an object that implements the handler api. handler api there are two kinds of traps: fundamental and derived traps. if one of the fundamental traps isn't implemented and the proxy is used in a w...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
upporting the accessibility guidelines, an organization can offer their product lines or services to a larger and more diverse user base. interchangeability if a user experiences consistent behavior across a range of products, they can predict how a particular action or function will work or respond. as a product provider, the goal should be the element of least surprise. by instilling a set of
global goals and standards into an organizational infrastructure, an organization is ensuring its end users the ability to interact, function, view, and process information consistently as they transition from one device to the next. a significant drawback in allowing divergence across applications is that information must be replicated, altered, or massaged to be processed across the divergent applica...
Windows Media in Netscape - Archive of obsolete content
nt reflects the unique component in this version range. scripting the control namespacing issues are the most important distinction between scripting the windows media control in ie and netscape 7.1. in code deployed for ie, invocations of the sort player.controls.play(); are common, where player is the id of the object element. in netscape 7.1, plugins and activex controls are not exposed to the
global namespace, but rather as properties of the document object. accessing properties and controls from the document object works well with ie also, and thus, in order to deploy cross-platform code, avoiding syntax that makes use of
global namespace is important. here, for example, is a code snippet that works equally well on both netscape 7.1 and ie: <object id="player" height="0" width="0" classi...
Using the DOM File API in chrome code - Extensions
users 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.import
globalproperties( [ "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 ...
Game promotion - Game development
ill contact you and ask for the link or build of your game. this big list of youtubers is a great place to start. you can find youtube and twitch.tv influencers at gameinfluencer.com to help promote your game. events if you've gone through all the options listed above you can still find new, creative ways to promote your game — events are another good example. attending events, both local and
global, gives you the ability to meet your fans face to face, as well as other members of the development community. value the fact that they spent their time seeing you. conferences there are many conferences where you can give a talk explaining some technical difficulties you overcame, or how you implemented specific apis; again — use your games as examples for that. it's important to focus on the...
Building up a basic demo with A-Frame - Game development
invisible.) — we've set its scale so it will more easily visible, its color, and some opacity so it won't completely covering the objects behind it. adding lights the basic light types in a-frame are directional and ambient. the first type is a directional light placed somewhere on the scene while the second one reflects the light from the first type, so it looks more natural; this can be set
globally. add the new code below your previous additions — this uses the standard <a-light> element: <a-light type="directional" color="#fff" intensity="0.5" position="-1 1 2"> </a-light> <a-light type="ambient" color="#fff"> </a-light> the directional light has a white color, its intensity is set to 0.5, and it is placed at position -1 1 2. the ambient light only needs a color, which i...
Building up a basic demo with Babylon.js - Game development
reading on, copy this code to a new text file and save it in your working directory as index.html. initialising the babylon.js engine we have to create a babylon.js engine instance first (passing it the <canvas> element to render on) before we start developing our game. add the following code to the bottom of your second <script> element: var engine = new babylon.engine(canvas); the babylon
global object contains all the babylon.js functions available in the engine. creating a scene a scene is the place where all the game content is displayed. while creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. let's create a scene by adding the following lines just below our previous code: var scene = new babylon.scene(engine); scene.clear...
TLD - MDN Web Docs Glossary: Definitions of Web-related terms
established for countries or territories. example: .us for united states. internationalized country code top-level domains (idn cctld) cctlds in non-latin character sets (e.g., arabic or chinese). generic top-level domains (gtld) top-level domains with three or more characters. unsponsored top-level domains domains that operate directly under policies established by icann processes for the
global internet community, for example "com" and "edu". sponsored top-level domains (stld) these domains are proposed and sponsored by private organizations that decide whether an applicant is eligible to use the tld, based on community theme concepts. infrastructure top-level domain this group consists of one domain, the address and routing parameter area (arpa). learn more general knowledge ...
MDN Web Docs Glossary: Definitions of Web-related terms
flex container flex item flexbox forbidden header name forbidden response header name fork fragmentainer frame rate (fps) ftp ftu function fuzz testing g gaia garbage collection gecko general header gif gij git
global object
global scope
global variable glyph gonk google chrome gpl gpu graceful degradation grid grid areas grid axis grid cell grid column grid container grid lines grid row grid tracks guard gutters gzip compression ...
Organizing your CSS - Learn web development
has the class box: .box { border: 1px solid #ccc; } there will be times when making something more specific makes sense, however this will generally be an exception rather than usual practice. break large stylesheets into multiple smaller ones in particular in cases where you have very different styles for distinct parts of the site, you might want to have a stylesheet that includes all the
global rules and then smaller ones that include the specific rules needed for those sections. you can link to multiple stylesheets from one page, and the normal rules of the cascade apply, with rules in stylesheets linked later coming after rules in stylesheets linked earlier. for example, we might have an online store as part of the site, with a lot of css used only for styling the product listings an...
Type, class, and ID selectors - Learn web development
lector to remove the margins on all elements. this means that instead of the default styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. this kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. since the universal selector makes
global changes, we use it to deal with very specific situations such as the one outlined below. using the universal selector to make your selectors easier to read one use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. for example, if i wanted to select the first child of any descendant element of <article> , no matter what element it was...
Styling tables - Learn web development
we've also set our custom font on the headings inside the <thead> and <tfoot> elements, for a nice grungy, punky look. we've set some letter-spacing on the headings and cells, as we feel it aids readability. again, mostly a stylistic choice. we've center-aligned the text in the table cells inside the <tbody> so that they line up with the...
How CSS is structured - Learn web development
ce, searching for comments in your code editor becomes a way to efficiently find a section of code. /* handle basic element styling */ /* -------------------------------------------------------------------------------------------- */ body { font: 1em/150% helvetica, arial, sans-serif; padding: 1em; margin: 0 auto; max-width: 33em; } @media (min-width: 70em) { /* let's special case the
global font size. on large screen or window, we increase the font size for better readability */ body { font-size: 130%; } } h1 {font-size: 1.5em;} /* handle specific elements nested in the dom */ /* -------------------------------------------------------------------------------------------- */ div p, #id:first-line { background-color: red; border-radius: 3px; } div p { margin: 0;...
What do common web layouts contain? - Learn web development
main content the biggest region, containing content unique to the current page. stuff on the side 1) information complementing the main content; 2) information shared among a subset of pages; 3) alternative navigation system. in fact, everything not absolutely required by the page's main content. footer visible at the bottom of every page on the site. like the header, contains less prominent
global information like legal notices or contact info. these elements are quite common in all form factors, but they can be laid out different ways. here are some examples (1 represents header, 2 footer; a main content; b1, b2 things on the side): 1-column layout. especially important for mobile browsers so you don't clutter the small screen up. 2-column layout. often used to target tablets, since...
Advanced form styling - Learn web development
t live here (also see here for the source code). also bear in mind that we've added some javascript to the page that lists the files selected by the file picker, below the control itself. this is a simplified version of the example found on the <input type="file"> reference page. as you can see, we've done fairly well at getting these to look uniform across modern browsers. ...
HTML forms in legacy browsers - Learn web development
border: 1px solid #ccc; } input[type="button"] { /* this does not restore the default rendering */ border: none; } input[type="button"] { /* these don't either! actually there is no standard way to do it in any browser */ border: auto; border: initial; } input[type="button"] { /* this will come the closest to restoring default rendering, when supported. */ border: revert; } see the
global css revert value for more information. <button> the <button> element suffered from two issues that are now resolved: a bug in old versions of internet explorer sent the html content available between the starting and ending tag of the <button> element instead of the content of the value attribute when clicked. this was only an issue if that value needed to be sent, such as when data processi...
CSS property compatibility table for form controls - Learn web development
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: * { /* turn off the native look and feel */ -webkit-appearance: none; appearance: none; /* for internet explorer */ background: none; } compatibility tables
global behaviors some behaviors are common to many browsers at a
global level: border, background, border-radius, height using one of these properties can partially or fully turn off the native look & feel of widgets on some browsers. 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 ...
Sending forms through JavaScript - Learn web development
tp request to send via javascript, for example via xmlhttprequest. this article explores such approaches. a form is not always a form with progressive web apps, single page apps, and framework based apps, it's common to use html forms to send data without loading a new document when response data is received. let's first talk about why this requires a different approach. gaining control of the
global interface standard html form submission, as described in the previous article, loads the url where the data was sent, which means the browser window navigates with a full page load. avoiding a full page load can provide a smoother experience by avoiding network lag, and possible visual issues like flickering. many modern uis only use html forms to collect input from the user, and not for data s...
CSS basics - Learn web development
family with your webpage. next, delete the existing rule you have in your style.css file. it was a good test, but let's not continue with lots of red text. add the following lines (shown below), replacing the font-family assignment with your font-family selection from what will your website look like?. the property font-family refers to the font(s) you want to use for text. this rule defines a
global base font and font size for the whole page. since <html> is the parent element of the whole page, all elements inside it inherit the same font-size and font-family. html { font-size: 10px; /* px means "pixels": the base font size is now 10 pixels high */ font-family: "open sans", sans-serif; /* this should be the rest of the output you got from google fonts */ } note: anything in css...
HTML basics - Learn web development
tems doesn't matter, such as a shopping list. these are wrapped in a <ul> element. ordered lists are for lists where the order of the items does matter, such as a recipe. these are wrapped in an <ol> element. each item inside the lists is put inside an <li> (list item) element. for example, if we wanted to turn the part of the following paragraph fragment into a list <p>at mozilla, we’re a
global community of technologists, thinkers, and builders working together ... </p> we could modify the markup to this <p>at mozilla, we’re a
global community of</p> <ul> <li>technologists</li> <li>thinkers</li> <li>builders</li> </ul> <p>working together ... </p> try adding an ordered or unordered list to your example page. links links are very important — they are what makes the web a...
The web and web standards - Learn web development
book program called enquire, which featured the concept of links between different nodes. sound familiar? fast forward to 1989, and timbl wrote information management: a proposal and hypertext at cern; these two publications together provided the background for how the web would work. they received a fair amount of interest, enough to convince timbl's bosses to allow him to go ahead and create a
global hypertext system. by late 1990, timbl had created all the things needed to run the first version of the web — http, html, the first web browser, which was called worldwideweb, an http server, and some web pages to look at. in the next few years that followed, the web exploded, with multiple browsers being released, thousands of web servers being set up, and millions of web pages being created...
Document and website structure - Learn web development
cle>s up into different <section>s, or <section>s up into different <article>s, depending on the context. <aside> contains content that is not directly related to the main content but can provide additional information indirectly related to it (glossary entries, author biography, related links, etc.). <header> represents a group of introductory content. if it is a child of <body> it defines the
global header of a webpage, but if it's a child of an <article> or <section> it defines a specific header for that section (try not to confuse this with titles and headings). <nav> contains the main navigation functionality for the page. secondary links, etc., would not go in the navigation. <footer> represents a group of end content for a page. non-semantic wrappers sometimes you'll come across a ...
Build your own function - Learn web development
message inside the paragraph, and an 'x' inside the button. this button will be what needs to be clicked/activated when the user wants to close the message box. const msg = document.createelement('p'); msg.textcontent = 'this is a message box'; panel.appendchild(msg); const closebtn = document.createelement('button'); closebtn.textcontent = 'x'; panel.appendchild(closebtn); finally, we use an
globaleventhandlers.onclick event handler to make it so that when the button is clicked, some code is run to delete the whole panel from the page — to close the message box. briefly, the onclick handler is a property available on the button (or in fact, any element on the page) that can be set to a function to specify what code to run when the button is clicked. you'll learn a lot more about these in...
Drawing graphics - Learn web development
next, we create a new textureloader object, then call load() on it. load() takes two parameters in this case (although it can take more): the texture we want to load (our png), and a function that will run when the texture has loaded. inside this function we use properties of the texture object to specify that we want a 2 x 2 rep...
Solve common problems in your JavaScript code - Learn web development
to declare the function, but not call it anywhere. for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remember that functions have their own scope — you can't access a variable value set inside a function from outside the function, unless you declared the variable
globally (i.e. not inside any functions), or return the value from the function. running code after a return statement remember also that when you return from a function, the javascript interpreter exits the function — no code after the return statement will run. in fact, some browsers (like firefox) will give you an error message in the developer console if you have code after a return statement. ...
Working with JSON - Learn web development
mbles javascript object literal syntax, it can be used independently from javascript, and many programming environments feature the ability to read (parse) and generate json. json exists as a string — useful when you want to transmit data across a network. it needs to be converted to a native javascript object when you want to access the data. this is not a big issue — javascript provides a
global json object that has methods available for converting between the two. note: converting a string to a native object is called deserialization, while converting a native object to a string so it can be transmitted across the network is called serialization. a json object can be stored in its own file, which is basically just a text file with an extension of .json, and a mime type of applicatio...
Getting started with React - Learn web development
der(<app />, document.getelementbyid('root')); // if you want your app to work offline and load faster, you can change // unregister() to register() below. note this comes with some pitfalls. // learn more about service workers: https://bit.ly/cra-pwa serviceworker.unregister(); as with app.js, the file starts by importing all the js modules and other assets it needs to run. src/index.css holds
global styles that are applied to our whole app. we can also see our app component imported here; it is made available for import thanks to the export statement at the bottom of app.js. line 7 calls react’s reactdom.render() function with two arguments: the component we want to render, <app /> in this case. the dom element inside which we want the component to be rendered, in this case the elemen...
Understanding client-side JavaScript frameworks - Learn web development
r app. we will learn how to deal with reactivity issues related to updating objects and arrays. to avoid common pitfalls, we'll have to dig a little deeper into svelte's reactivity system. we'll also look at solving some accessibility focus issues, and more besides. 6. working with svelte stores in this article we will show another way to handle state management in svelte — stores. stores are
global global data repositories that hold values. components can subscribe to stores and receive notifications when their values change. 7. typescript support in svelte we will now learn how to use typescript in svelte applications. first we'll learn what typescript is and what benefits it can bring us. then we'll see how to configure our project to work with typescript files. finally we will go over ...
Introduction to automated testing - Learn web development
he previous section. next, you'll need some sample html, css and javascript content to test your system on — make copies of our sample index.html, main.js, and style.css files in a subfolder with the name src inside your project folder. you can try your own test content if you like, but bear in mind that such tools won't work on internal js/css — you need external files. first, install gulp
globally (meaning, it will be available across all projects) using the following command: npm install --
global gulp-cli next, run the following command inside your npm project directory root to set up gulp as a dependency of your project: npm install --save-dev gulp now create a new file inside your project directory called gulpfile.js. this is the file that will run all our tasks. inside this...
Strategies for carrying out testing - Learn web development
ly what browsers people are using to browse your site. of course, this relies on you already having a site to use it on, so it isn't much good for completely new sites. but an analytics history can be useful for finding support stats to influence say a new version of a company's site, or new features you are adding to an existing site. if you have these available, they are far more accurate than
global browser stats like those mentioned above. you may also consider using open source and privacy focussed analytics platforms like open web analytics and matomo. they expect you to self-host the analytics platform. setting up google analytics first of all, you'll need a google account. use this account to sign into google analytics. choose the google analytics (web) option, and click the sign...
Accessibility/LiveRegionDevGuide
ents from hidden tabs. with the goal of eliminating the "non-live" events, some sort of event filtering logic must be employed. the following is a list of potential filtering techniques: the "event-from-input" object attribute can be used to filter events that were triggered by user action. the ":system" (or lack thereof) can be used to filter events that are system generated. (at-spi only) a
global variable can be set in a document:load:complete event listener and reset in a object:state-changed:busy listener. this variable can then be used to quickly determine if an event was triggered by the document being loaded. an event containing an object that does not have state visible is probably from a hidden tab. an event containing an object that has state selectable is not a live region. an...
Gecko info for Windows accessibility vendors
if a given node's get_nodetype method returns nodetype_document, then you know you can queryinterface to an isimpledomdocument. the root accessible can also always be queryinterface'd to an isimpledomdocument. here are the methods for isimpledomdocument: hresult get_url (/* [out] */ bstr *url); // location of document hresult get_title (/* [out] */ bstr *title); // from th...
Mozilla’s UAAG evaluation report
cannot slow animations 4.5 start, stop, pause, and navigate multimedia. (p1) na 4.6 position captions. (p1) na 4.7 slow other multimedia. (p2) na this is similar to checkpoint 4.4, except that includes animation through style cannot control animation rate of animated images 4.8 control other multimedia. (p2) na 4.9
global volume control. (p1) na 4.10 independent volume control. (p1) na 4.11 control other volume. (p2) na 4.12 configure synthesized speech rate. (p1) na 4.13 configure synthesized speech volume. (p1) na 4.14 configure synthesized speech characteristics. (p1) na 4.15 specific synthesized speech charact...
Adding a new event
t. create dom event factory method if your dom event implementation is generatable, you can skip this section. in nsidomevent.idl, you need to define ns_newdomfooevent(). it's last argument should be the most subclass. then, the implementation of the dom event can access internal event class instance safer. then, the factory method should be implemented at the bottom of fooevent.cpp in the
global namespace. modify eventdispatcher::createevent() if your dom event implementation is generatable or you're in case 3, you can skip this section. the first half of eventdispatcher::createevent() is a factory to create a dom event instance from internal event instance. you need to modify this. the last half of it is the implementation of legacy event creator of javascript such as: var event ...
Debugging on Mac OS X
d then # sources the .lldbinit from there. # # note: this scripts actions take a few seconds to complete, so the custom # formatters, commands etc. that are added may not be immediately available. # breakpoint set --name nsthread::processnextevent --thread-index 1 --auto-continue true --one-shot true breakpoint command add -s python # this script that we run does not work if we try to use the
global 'lldb' # object, since it is out of date at the time that the script runs (for # example, `lldb.target.executable.fullpath` is empty). therefore we must # get the following objects from the 'frame' object. target = frame.getthread().getprocess().gettarget() debugger = target.getdebugger() # delete our breakpoint (not actually necessary with `--one-shot true`): target...
Makefile - variables
_dso_libs extra_dso_ldopts extra_js_modules extra_pp_components xpcomm files to pre-process before installation. garbage a "clean target" macro containing a list of files to remove. garbage_dirs a "clean target" macro containing a list of directories to remove.
global_deps a list of common dependencies (makefile.in, autoconf.mk) that will force rebuilding. libobjs have_dtrace sun microsystem's dynamic tracing environment is available. local_includes allow use of moz_objdir in .mozconfig with older gnu gcc on beos. module module_name ...
How Mozilla's build system works
: calling functions that are explicitly made available to the moz.build environment. assigning to a well-defined set of variables whose name is uppercase. creating new variables whose name is not uppercase (this includes defining functions). moz.build files cannot do the following: import modules. open files. use the print statement or function. reference many of python's built-in or
global functions (they are not made available to the execution environment). the most important actions of moz.build files are #1 and #2 from the above list. these are how the execution of a moz.build file tells the build system what to do. for example, you can assign to the dirs list to define which directories to traverse into looking for additional moz.build files. the output of the execution of a...
The Firefox codebase: CSS Guidelines
*-box-*, flex-*, order if some css is layout or functionality related, then it is likely content css. if it is esthetics related, then it is likely theme css. when importing your stylesheets, it's best to import the content css before the theme css, that way the theme values get to override the content values (which is probably what you want), and you're going to want them both after the
global values, so your imports will look like this: <?xml-stylesheet href="chrome://
global/skin/
global.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/path/module.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/skin/path/module.css" type="text/css"?> [1] -moz-appearance is tricky. generally, when specifying -moz-appearance: foo; you're giving hints as to how some...
Eclipse CDT Manual Setup
long. select "c/c++ general > preprocessor include paths, macros, and so on." select the providers tab. make sure that "cdt gcc build output parser" is selected, and that "cdt managed build settings entries" is not selected. highlight (select) "cdt gcc build output parser", then in the "language settings provider options" that appear below, make sure that "share setting entries between projects (
global provider)" is not ticked. if the main object directory for your source tree is a fennec build: in the "cdt gcc build output parser", change the compiler command pattern to (.*gcc)|(.*[gc]\+\+)|(clang) (before this change it should have been "(gcc)|([gc]\+\+)|(clang)"). this pattern is what cdt uses to identify compiler commands when parsing the build output. by default, it recognizes commands...
mach
em-reviewers for review. mach command modules useful information command modules are not imported into a reliable python package/module "namespace." therefore, you can't rely on the module name. all imports must be absolute, not relative. because mach command modules are loaded at mach start-up, it is important that they be lean and not have a high import cost. this means that you should avoid
global import statements as much as possible. instead, defer your import until inside the @command decorated method. mach ships with a toolbox of mix-in classes to facilitate common actions. see python/mach/mach/mixin. if you find yourself reinventing the wheel or doing something you feel that many mach commands will want to do, please consider authoring a new mix-in class so your effort can be shared!
Error codes returned by Mozilla APIs
ns_error_dom_file_not_found_err (0x80650000) file was not found. ns_error_dom_file_not_readable_err (0x80650001) file could not be read. network errors the following errors can occur when creating connections over the network, or when reading or writing data. ns_binding_failed (0x804b0001) ns_binding_ab...
Cross Process Object Wrappers
cripts to make content objects available to chrome through a wrapper called a cross process object wrapper, also known as a cpow. however, 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", ...
Limitations of frame scripts
ssionstore nsiwindowmediator <need more examples> places api the places api can't be used inside a frame script. for example: nsinavhistoryservice nsinavbookmarksservice observers in the content process as noted in observers in the chrome process, most observers should be registered in the chrome process and will not work in the content process. the exceptions are: content-document-
global-created document-element-inserted outer-window-destroyed inner-window-destroyed dom-window-destroyed these must be registered in the content process. qi from content window to chrome window there's a particular pattern often used to get from a content window to the associated chrome window. it looks something like this: window.queryinterface(ci.nsiinterfacerequestor) ...
Limitations of frame scripts
ssionstore nsiwindowmediator <need more examples> places api the places api can't be used inside a frame script. for example: nsinavhistoryservice nsinavbookmarksservice observers in the content process as noted in observers in the chrome process, most observers should be registered in the chrome process and will not work in the content process. the exceptions are: content-document-
global-created document-element-inserted outer-window-destroyed inner-window-destroyed dom-window-destroyed these must be registered in the content process. qi from content window to chrome window there's a particular pattern often used to get from a content window to the associated chrome window. it looks something like this: window.queryinterface(ci.nsiinterfacerequestor) ...
Firefox and the "about" protocol
about:webrtc information about webrtc usage about:welcome page first displayed when firefox is installed about:welcomeback information page displayed after firefox is reset these urls are defined in docshell/base/nsaboutredirector.cpp within the kredirmap array. the array maps most of the urls, like config to urls in the chrome: pseudo protocol, such as chrome://
global/content/config.xul. the about location information is duplicated in docshell/build/nsdocshellmodule.cpp. note: you must access about: protocol pages by typing them into the address bar. attempts to navigate through window.location will throw — error: access to 'about:addons' from script denied. ...
Firefox UI considerations for web developers
es list in order to have quick access to them. each site is represented by an icon and, below it, a name for the site. while both of these can be edited by the user, you may wish to ensure that your site provides a good icon to use in places like this. how an icon is selected the new tab page chooses icons to use for top sites by trying a series of methods until it obtains an icon to use: a
global "top sites" list is checked. this list is created by a mozilla service called tippy top. the data store provided by tippy top includes an optimized icon for each of the sites in the list; if the site is on this list, that icon is used. if tippy top doesn't include the site, firefox looks in its places data store for icons specified in the page's <head> element; if an svg icon is available,...
Chrome-only API reference
ications. it currently works in (privileged) chrome code on firefox desktop (version 47 and above).chromeworkerif you're developing privileged code, and would like to create a worker that can use js-ctypes to perform calls to native code, you can do so by using chromeworker instead of the standard worker object. it works exactly like a standard worker, except that it has access to js-ctypes via a
global ctypes object available in the
global scope of the worker. examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below. to use a postmessage with callback version of chromeworker that features promises, see promiseworker. ...
overflow-clip-box-block
the overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction. /* keyword values */ overflow-clip-box-block: padding-box; overflow-clip-box-block: content-box; /*
global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. formal sy...
overflow-clip-box-inline
the overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction. /* keyword values */ overflow-clip-box-inline: padding-box; overflow-clip-box-inline: content-box; /*
global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. fo...
overflow-clip-box
he overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow. it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties. /* keyword values */ overflow-clip-box: padding-box; overflow-clip-box: content-box; /* two values */ overflow-clip-box: padding-box content-box; overflow-clip-box: content-box content-box; /*
global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, this behavior was hardcoded; since then it uses this property that can be used elsewhere too. note that this property is activated by default only in the ua sty...
Implementing QueryInterface
and simple. ok. it has more than one return, but the primary return is at the end of the function as expected; and the additional return is clear and alone at the top of the function. it only has one addref. it addrefs the resulting interface, not this, thus following the com-correct way (particularly important in aggregation) it uses nscomtypeinfo<t>::getiid() instead of ktiid thus saving a
global declaration and
global space it uses c 's static_cast, via ns_static_cast, which detects errors when you can't really get to the desired interface. it avoids repeated uses of and assignments to *ainstanceptr, which compilers have trouble optimizing. it clears the result, *ainstanceptr, when returning an error. it generates less code than the typical implementation of queryinterface. it tests...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
e fact that ace to unicode conversion is not implemented yet. of particular concern for japanese users is the one in which full-width japanese roman characters are not normalized to ascii roman characters. (cf. bug 210734.) this forces the japanese user to shift out of the japanese input mode to write the top domain names such as .jp causing inconvenience. for other bugs, see this link. idn is a
global trend and is likely to be adopted by a large number of sites making it easier for average internet users to find web sites. many web sites around the world are expected to register native language host names with the appropriate domain name registrars for their top domains. netscape 7.1 and mozilla 1.4 are playing a significant role in aiding the development of idn further. original document in...
Introduction to Layout in Mozilla
nshtmlreflowmetrics basic pattern parent frame initializes child reflow state (available w, h); places child frame (x, y); invokes child’s reflow method child frame computes desired (w, h), returns via reflow metrics parent frame sizes child frame and view based on child’s metrics n.b. ...
DownloadTarget
method overview promise refresh() properties attribute type description exists read only boolean indicates whether or not the target file exists. this is a dynamic property, which is updated when the download is completed or when the download.refresh() method is called. you can use this instead of using file system calls to check for the existence of the file in order to reduce io overhead. path read only string the path of the target file. ...
Downloads.jsm
to demonstrate the logging, a new download is started while a message box is being shown. the download is stopped and removed from the list when the message box is closed, regardless of whether it has been completed or not. components.utils.import("resource://gre/modules/downloads.jsm"); components.utils.import("resource://gre/modules/osfile.jsm") components.utils.import("resour...
Following the Android Toasts Tutorial from a JNI Perspective
make sure to unload the classes and the java environment, this is good for performance. this is the template that will follow our object of signatures: var my_jenv = null; try { my_jenv = jni.getforthread(); // do the jni work here } finally { if (my_jenv) { jni.unloadclasses(my_jenv); } } the reason we choose my_jenv for a variable name, and not jenv, is because the
global privileged window scope of firefox for android has a variable jenv already, and we don't want to mix. declare constructors, methods, and fields now that the sig's and java environment is ready, it is now possible to declare the constructors, methods, and fields. load the class the first step is to load the class. every constructor, method, and field belongs to a class. in our case, we have a ...
JNI.jsm
file int jni stands for java native interface; this library allows calling java code running in java virtual machines (jvms), etc. the most common use for this module is in add-ons and other works on firefox for android (fennec). with this module, all of the android sdk functions that firefox has permissions for are at your fingertips. a note about firefox for android, this jsm file is already
globally imported and is available from the privileged window scope as window.jni. there also exists a jenv variable in the window scope, so if you need to run jni from the
global scope, use a different variable name then jenv. jni.jsm contains all the js-ctypes needed to communicate with the jni libraries. the js-ctypes is abstracted away while all the underlying data is all ctype data. functions are ...
OS.File.Error
instances of os.file.error are used by os.file to notify of file-related errors. using os.file.error example: finding out whether the problem is due to a file that does not exist try { let file = os.file.open("myfile.txt"); // ... } catch (ex) { if (ex instanceof os.file.error && ex.becausenosuchfile) { // the file does not exist } }
global object os.file.error methods overview the following functions are utility functions that may be used to construct instances of os.file.error, setting the platform-specific error number. error closed() error exists() methods os.file.error.closed() return an error representing the fact that a file is closed. os.file.error.exists() return an error representing the fact that a file exists. instances of os.file.err...
OS.File for the main thread
console.log('valopen:', valopen); var txttoappend = 'append some text \n'; var txtencoded = new textencoder().encode(txttoappend); valopen.write(txtencoded).then(valwrite => { console.log('valwrite:', valwrite); valopen.close().then(valclose => { console.log('valclose:', valclose); console.log('successfully appended'); }); }); });
global object os.file method overview promise<file> open(in string path, [optional] in object mode, [optional] in object options); promise<object> openunique(in string path, [optional] in object options); promise<void> copy(in string sourcepath, in string destpath, [optional] in object options); promise<bool> exists(in string path); promise<string> getcurre...
PopupNotifications.jsm
the notification panel. anchorid the id of the element that should serve as the anchor for the notification popup (that is, the element the arrow on the popup should point to). if you specify null, the notification will be anchored to the popupnotification object's icon box. this anchorid must point to an element contained inside the popupnotification object's icon box (for firefox windows, the
global popupnotifications object 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 objec...
Promise.jsm
its usage is not suggested for new code. if you just need a promise, consider using a dom promise instead. if you need a deferred, because you want to create a promise and manually resolve or reject it, consider using promiseutils.jsm instead. ...
PromiseWorker.jsm
as well known with workers, there is a minimum of two files required. the worker file, and the main thread file. the following sections tell you which content to use in your worker and main thread files, in order to use promiseworker objects. worker file there is some standard templating that must be dropped into the worker file by the developer. the require.js file must be imported with worker
globalscope/importscripts(). next, the promiseworker.js file should be brought in with the require() method. finally, the template code should be added in. the code below is what should be copied and pasted: importscripts('resource://gre/modules/workers/require.js'); let promiseworker = require('resource://gre/modules/workers/promiseworker.js'); // instantiate abstractworker (see below). let worker = ...
Services.jsm
e etld nsieffectivetldservice effectivetld service focus nsifocusmanager focus manager io nsiioservice nsiioservice2 i/o service locale nsilocaleservice locale service logins nsiloginmanager password manager service metro nsiwinmetroutils 2 mm nsimessagebroadcaster nsiframescriptloader
global frame message manager3 obs nsiobserverservice observer service perms nsipermissionmanager permission manager service ppmm nsimessagebroadcaster nsiprocessscriptloader
global parent process message manager3 prefs nsiprefbranch nsiprefbranch2 nsiprefservice preferences service prompt nsipromptservice prompt servi...
Localization technical reviews
at the access keys look normal. if they don't, we report any strange access keys or translations that localizers might have changed during their initial translation process. for more info about access keys in the technical review process, see bug 421893. no utf-7 in the intl.properties file firefox no longer has a utf-7 parser. there should not be any utf-7 encodings in the file toolkit/chrome/
global/intl.properties. for more info about utf-7 in firefox, see bug 441876. more intl.properties checkpoints, cont we also check the plural rule for the locale, that the general.useragent.locale is set to the locale code, that accept-lang shows the locale code(s) (like ab, ab-cd,...) and is followed by en and en-us, and finally that intl.menuitems.insertseparatorbeforeaccesskeys = true, where "true...
Mozilla Port Blocking
ports enabled by protocol handlers in mozilla: protocol handler allowed ports ftp 21, 22 ldap 389, 636 nntp any port pop3 any port imap any port smtp any port finger 79 datetime 13 how to change mozilla port blocking permanently si...
Mozilla Style System Documentation
for frames: const nsstyledisplay *display; ::getstyledata(frame, &display); or for style contexts: const nsstyledisplay *display; ::getstyledata(sc, &display); these functions cause an appropriate struct to be computed if it hasn't been computed ...
BloatView
e other tools to fix it. the number of objects remaining might not be equal to the total number of objects. this could indicate a hand-written release method (that doesn't use the ns_log_release macro from nstracerefcnt.h), or perhaps you're just not freeing any of the instances you've allocated. these sorts of leaks are easy to fix. the total number of objects might be 1. this might indicate a
global variable or service. usually this will have a large number of refcounts. if you find leaks, you can use refcount tracing and balancing to discover the root cause. combining and sorting bloat logs you can view one or more bloat logs in your browser by running the following program. perl tools/bloatview/bloattable.pl log1 log2 ... logn > htmlfile this will produce an html file that contains a...
GC and CC logs
ing gc and cc logs there are numerous scripts that analyze gc and cc logs on github. to find out why an object is being kept alive, the relevant scripts are find_roots.py and parse_cc_graph.py (which is called by find_roots.py). calling find_roots.py on a cc log with a specific object or kind of object will produce paths from rooting objects to the specified objects. most big leaks include an ns
globalwindow, so that's a good class to try if you don't have any better idea. to fix a leak, the next step is to figure out why the rooting object is alive. for a c++ object, you need to figure out where the missing references are from. for a js object, you need to figure out why the js object is reachable from a js root. for the latter, you can use the corresponding find_roots.py for js on the gc log...
JS::PerfMeasurement
sval argument in your .idl file and have javascript pass a perfmeasurement object that it created in that argument slot. the jsval you receive points to a javascript wrapper object. to extract the c++-level perfmeasurement object, call this function. it will return null if javascript passed in something with the wrong dynamic type. jsobject* js::registerperfmeasurement(jscontext* cx, jsobject*
global) you shouldn't need to use this function, but we mention it for completeness. it initializes the javascript wrapper interface for this api and pokes the constructor function into the
global object you provide. ...
TraceMalloc
ss argument to diffbloatdump.pl, and then the diff tree can be run through fix_linux_stack.py or fix_macosx_stack.py as needed. leaksoup leaksoup is a trace-malloc tool that analyzes the shutdown log. because this log includes the contents of heap blocks, leaksoup can analyze the graph of live objects and determine which allocations are roots (within that graph, of course -- stack allocations and
global variables don't count). leaksoup also finds sets of objects that are rooted by a cycle (i.e., a set of reference counted objects that own references to each other in a cycle). however, it cannot distinguish between owning and non-owning pointers, which means that non-owning pointers that are nulled out by destructors may show up in leaksoup as cycles. however, despite that, it is probably the eas...
Performance
. it should be the starting point for anybody new to power profiling. tools/power/rapl (mac, linux) tools/power/rapl is a command-line utility in the mozilla codebase that uses the intel rapl interface to gather direct power estimates for the package, cores, gpu and memory. powermetrics (mac-only) powermetrics is a command-line utility that gathers and displays a wide range of
global and per-process measurements, including cpu usage, gpu usage, and various wakeups frequencies. timerfirings logging (all platforms) timerfirings logging is a built-in logging mechanism that prints data on every time fired. activity monitor, battery status menu and top (mac-only) the battery status menu, activity monitor and top are three related mac tools that have major flaws...
Phishing: a short definition
the impact has not improved much since. phishing is an attempt to collect sensitive information, such as usernames, passwords, and financial details by disguising as a trustworthy entity online. a relatively simple, yet effective, phishing scheme is sending an email with a fake invoice of a person’s favorite shopping site. this email will usually contain a link pretending to lead to the original service, but in reality, taking the victim to an attacker-controlled website. ...
NSPR Contributor Guide
that fully document your public typedefs, enums, macros and functions. see: prshm.h as an example of how your header file(s) should be documented. source file descriptions. provide descriptive documentation in your source (*.c) files. alas, we have no source files documented as we think they should be. the following are some general guidelines to use when implementing new features: don't export
global variables your code must be thread safe you must provide test cases that test all apis you are adding. see: [#testcases test cases] new libraries all the guidelines applicable to [#newfeatures new features] applies to new libraries. for purposes of this paper, a "new library" is defined as a libary under the mozilla/nsprpub/lib directory tree and built as a separate library. these libraries ...
Optimizing Applications For NSPR
thread. therefore, if you call a blocking system call from the primordial thread, it is going to block more than just the primordial thread and the system may not function correctly. on nt, this problem is especially obvious because the idle thread, which is in charge of driving the asynch io completion port, is also blocked. do not call blocking system calls from the primordial thread. create a
global thread and call the system call in that thread, and have the primordial thread join that thread. nspr uses timer signals to implement thread preemption for local threads on some platforms. if all the software linked into the application is not ported to the nspr api, the application may fail because of threads being preempted during critical sections. to disable thread preemption call <tt>pr_dis...
Atomic Operations
the functions define a portable api that may be reliably used in any environment. since not all operating environments provide access to such functions, their performance may vary considerably. atomic operations functions the api defined for the atomic functions is consistent across all supported platforms. however, the implementation may vary greatly, and hence the performance. on systems that do not provide direct access to atomic operators, nspr emulates the capabilities by using its own locking mechanisms. for such systems, nspr performs atomic operations just as efficiently as the client could. ...
Logging
nspr provides a set of logging functions that conditionally write printf() style strings to the console or to a log file. nspr uses this facility itself for its own development debugging purposes. you can select events to be logged by module or level. a module is a user-defined class of log events. a level is a numeric value that indicates the seriousness of the event to be logged. you can combine module and level criteria to get highly selective logging. nspr also provides "assert"-style macros and functions to aid in application debugging. ...
Long Long (64-bit) Integers
the functions define a portable api that can be used reliably in any environment. where 64-bit integers are desired, use of nspr's implementation is recommended to ensure cross-platform compatibility. most of the 64-bit integer operations are implemented as macros. the specific implementation of each macro depends on whether the compiler for the target platform supports 64-bit integers. for a specific target platform, if 64-bit integers are supported for that platform, define have_long_long at compile time. ...
Memory Management Operations
nspr provides heap-based memory management functions that map to the familiar malloc(), calloc(), realloc(), and free(). memory allocation functions memory allocation macros memory allocation functions nspr has its own heap, and these functions act on that heap. libraries built on top of nspr, such as the netscape security libraries, use these functions to allocate and free memory. if you are allocating memory for use by such libraries or freeing memory that was allocated by such libraries, you must use these nspr functions rather than the libc equivalents. ...
NSPR Types
algebraic types of various lengths are used for integer algebra. miscellaneous types are used for representing size, pointer difference, boolean values, and return values. for information on naming conventions for nspr types, functions, and macros, see nspr naming conventions. ...
PR_CreateThread
n, which is called as the root of the new thread. returning from this function is the only way to terminate a thread. arg a pointer to the root function's only parameter. nspr does not assess the type or the validity of the value passed in this parameter. priority the initial priority of the newly created thread. scope specifies your preference for making the thread local (pr_local_thread),
global (pr_
global_thread) or
global bound (pr_
global_bound_thread). however, nspr may override this preference if necessary. state specifies whether the thread is joinable (pr_joinable_thread) or unjoinable (pr_unjoinable_thread). stacksize specifies your preference for the size of the stack, in bytes, associated with the newly created thread. if you pass zero in this parameter, pr_createthread choo...
PR_EXTERN
for syntax details for each platform, see prtypes.h. ...
PR_IMPLEMENT
used to define implementations of symbols that are to be exported from a shared library. syntax #include <prtypes.h> pr_implement(type)implementation description pr_implement is used to define implementations of externally visible routines and
globals. for syntax details for each platform, see prtypes.h. warning: some platforms do not allow the use of the underscore character (_) as the first character of an exported symbol. ...
PR_SetConcurrency
eter pr_setconcurrency has one parameter: numcpus the number of extra virtual processor threads to be created. description setting concurrency controls the number of virtual processors that nspr uses to implement its m x n threading model. the m x n model is not available on all host systems. on those where it is not available, pr_setconcurrency is ignored. virtual processors are actually
global threads, each of which is designed to support an arbitrary number oflocal threads. since
global threads are scheduled by the host operating system, this model is particularly applicable to multiprocessor architectures, where true parallelism is possible. however, it may also prove advantageous on uniprocessor systems to reduce the impact of having a locally scheduled thread calling incidental blo...
PR_SetLibraryPath
me should be absolute or relative. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may indicate that the function cannot allocate sufficient storage to make a copy of the path string description this function registers a default library pathname with the runtime. this allows an environment to express policy decisions
globally and lazily, rather than hardcoding and distributing the decisions throughout the code. ...
NSPR API Reference
ing-point integer type native os integer types miscellaneous types size type pointer difference types boolean types status type for return values threads threading types and constants threading functions creating, joining, and identifying threads controlling thread priorities controlling per-thread private data interrupting and yielding setting
global thread concurrency getting a thread's scope process initialization identity and versioning name and version constants initialization and cleanup module initialization locks lock type lock functions condition variables condition variable type condition variable functions monitors monitor type monitor functions cached monitors cached monitor functio...
An overview of NSS Internals
re is a classic engine that is very stable and works fine in all simple scenarios, for example if all (b) candidate issuer certificates have the same subject and issuer names and differ by validity period; however, it works only in a limited amount of more advanced scenarios. unfortunately, the world of certificates has become more complex in the recent past. new certificate authorities enter the
global pki market, and in order to get started with their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it w...
NSS 3.16.4 release notes
ges in nss 3.16.4 the following 1024-bit root ca certificate was restored to allow more time to develop a better transition strategy for affected sites. it was removed in nss 3.16.3, but discussion in the mozilla.dev.security.policy forum led to the decision to keep this root included longer in order to give website administrators more time to update their web servers. cn = gte cybertrust
global root sha1 fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74 in nss 3.16.3, the 1024-bit "entrust.net secure server certification authority" root ca certificate (sha1 fingerprint: 99:a6:9b:e6:1a:fe:88:6b:4d:2b:82:00:7c:b8:54:fc:31:7e:15:39) was removed. in nss 3.16.4, a 2048-bit intermediate ca certificate has been included, without explicit trust. t...
NSS 3.18 release notes
s x, by default the softokn shared library will link with the sqlite library installed by the operating system, if it is version 3.5 or newer. ...
NSS 3.27 release notes
o = equifax, ou = equifax secure certificate authority sha-256 fingerprint: 08:29:7a:40:47:db:a2:36:80:c7:31:db:6e:31:76:53:ca:78:48:e1:be:bd:3a:0b:01:79:a7:07:f9:2c:f1:78 cn = equifax secure ebusiness ca-1 sha-256 fingerprint: cf:56:ff:46:a4:a1:86:10:9d:d9:65:84:b5:ee:b5:8a:51:0c:42:75:b0:e5:f9:4f:40:bb:ae:86:5e:19:f6:73 cn = equifax secure
global ebusiness ca-1 sha-256 fingerprint: 5f:0b:62:ea:b5:e3:53:ea:65:21:65:16:58:fb:b6:53:59:f4:43:28:0a:4a:fb:d1:04:d7:7d:10:f9:f0:4c:07 bugs fixed in nss 3.27 this bugzilla query returns all the bugs fixed in nss 3.27: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.27 compatibility ...
NSS 3.28.1 release notes
:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 cn = amazon root ca 3 sha-256 fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 cn = amazon root ca 4 sha-256 fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 cn = luxtrust
global root 2 sha-256 fingerprint: 54:45:5f:71:29:c2:0b:14:47:c4:18:f9:97:16:8f:24:c5:8f:c5:02:3b:f5:da:5b:e2:eb:6e:1d:d8:90:2e:d5 cn = symantec class 1 public primary certification authority - g4 sha-256 fingerprint: 36:3f:3c:84:9e:ab:03:b0:a2:a0:f6:36:d7:b8:6d:04:d3:ac:7f:cf:e2:6a:0a:91:21:ab:97:95:f6:e1:76:df cn = symantec class 1 public primary certificati...
NSS 3.32 release notes
2:56:3f:49:84:4a:cf:c3:2b:7b:e4:b0:ff:59:9f:9e:8c:7a:f7 cn = cnnic root sha-256 fingerprint: e2:83:93:77:3d:a8:45:a6:79:f2:08:0c:c7:fb:44:a3:b7:a1:c3:79:2c:b7:eb:77:29:fd:cb:6a:8d:99:ae:a7 cn = comsign secured ca sha-256 fingerprint: 50:79:41:c7:44:60:a0:b4:70:86:22:0d:4e:99:32:57:2a:b5:d1:b5:bb:cb:89:80:ab:1c:b1:76:51:a8:44:d2 cn = geotrust
global ca 2 sha-256 fingerprint: ca:2d:82:a0:86:77:07:2f:8a:b6:76:4f:f0:35:67:6c:fe:3e:5e:32:5e:01:21:72:df:3f:92:09:6d:b7:9b:85 cn = secure certificate services sha-256 fingerprint: bd:81:ce:3b:4f:65:91:d1:1a:67:b5:fc:7a:47:fd:ef:25:52:1b:f9:aa:4e:18:b9:e3:df:2e:34:a7:80:3b:e8 cn = swisscom root ca 1 sha-256 fingerprint: 21:db:20:12:36:60:bb:2e:d4:1...
NSS 3.35 release notes
:14 this intermediate cert had been directly included to help with transition from 1024-bit roots per bug #1045189. the websites (tls/ssl) trust bit was turned off for the following ca certificates: cn = chambers of commerce root sha-256 fingerprint: 0c:25:8a:12:a5:67:4a:ef:25:f2:8b:a7:dc:fa:ec:ee:a3:48:e5:41:e6:f5:cc:4e:e6:3b:71:b3:61:60:6a:c3 cn =
global chambersign root sha-256 fingerprint: ef:3c:b4:17:fc:8e:bf:6f:97:87:6c:9e:4e:ce:39:de:1e:a5:fe:64:91:41:d1:02:8b:7d:11:c0:b2:29:8c:ed significant changes to tls 1.3 were made, along with the update from draft -18 to draft -23: support for keyupdate was added. keyupdate will be used automatically, if a cipher is used for a sufficient number of records. ssl_keylog...
NSS 3.45 release notes
bl_64fpu_3.so builds bug 1554336 - optimize away unneeded loop in mpi.c bug 1559906 - fipstest: use ckm_tls12_master_key_derive instead of vendor specific mechanism bug 1558126 - tls_aes_256_gcm_sha384 should be marked as fips compatible bug 1555207 - helloretryrequestcallback return code for rejecting 0-rtt bug 1556591 - eliminate races in uses of pk11_setwrapkey bug 1558681 - stop using a
global for anti-replay of tls 1.3 early data bug 1561510 - fix a bug where removing -arch xxx args from cc didn't work bug 1561523 - add a string for the new-ish error ssl_error_missing_post_handshake_auth_extension this bugzilla query returns all the bugs fixed in nss 3.45: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_...
NSS Developer Tutorial
if (condition) action(); although the use of curly braces is more common. multiple-line comments should be formatted as follows: /* * line1 * line2 */ or /* ** line 1 ** line 2 */ the following styles are also common, because they conserve vertical space: /* line1 * line2 */ or /* line1 ** line2 */ or /* line1 * line2 */ naming public functions are named foo_dooneaction.
global, but unexported functions, are usually named foo_dooneaction. variable, and function parameter names, always start with a lowercase letter. the most common style is foobarbaz, although foobarbaz and foo_bar_baz are also used. miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. a data buffer is usually represented as: unsigned char *dat...
Python binding for NSS
n, 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 progress in another thread. also, any "
global" values which are set in python-nss are actually thread-local. examples of this are the various callbacks which can be set and their parameters.
sslintro.html
ation set and private apis intended for internal use by the nss implementation of ssl. you should use only the ssl apis (and related certificate, key, and pkcs #11 apis) that are described in this document, the ssl reference. other apis that may be exposed in the header files are not supported for application use. initialization initialization includes setting up configuration files, setting
global defaults, and setting up callback functions. functions used in the initialization part of an application can include the following: pr_init. initializes nspr. must be called before any other nss functions. pk11_setpasswordfunc. sets the
global callback function to obtain passwords for pkcs #11 modules. required. nss_init. sets up configuration files and performs other tasks required to...
NSS Tools modutil
plex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ (quotes andbackslashes must be escaped with a backslash. a complex string must notinclude newlines or carriage returns.) outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens. keys keys are case-insensitive. this section discusses the following keys:
global keysper-platform keysper-file keys
global keys forwardcompatible gives a list of platforms that are forward compatible. if the current platform cannot be found in the list of supported platforms, then the forwardcompatible list is checked for any platforms that have the same os and architecture in an earlier version. if one is found, its attributes are used for the current platform. pl...
NSS tools : signtool
ta control file. metadata is signed information attached either to the jar archive itself or to files within the archive. this metadata can be any ascii string, but is used mainly for specifying an installer script. ...
Necko walkthrough
nshttpconnectionmgr::postevent creates an nsconnevent with params including the handler function, nshttpconnectionmgr::onmsgnewtransaction, and the recently created nshttptransaction. dispatches the nsconnevent to the socket thread back to the context of nshttpchannel...
Tutorial: Embedding Rhino
hi js> r = new java.lang.runnable(obj); [object object] js> t = new java.lang.thread(r) thread[thread-0,5,main] js> t.start() hi adding java objects the next example is runscript2. this is the same as runscript, but with the addition of two extra lines of code: object wrappedout = context.javatojs(system.out, scope); scriptableobject.putproperty(scope, "out", wrappedout); these lines add a
global variable out that is a javascript reflection of the system.out variable: $ java runscript2 "out.println(42)" 42.0 undefined using javascript objects from java after evaluating a script it's possible to query the scope for variables and functions, extracting values and calling javascript functions. this is illustrated in the runscript3 example. this example adds the ability to print the value ...
Rhino Examples
hell in the tools package. the programs may be specified as files on the command line or by typing interactively while the shell is running. primitivewrapfactory primitivewrapfactory.java is an example of a wrapfactory that can be used to control the wrapping behavior of the rhino engine on calls to java methods. multithreaded script execution dynamicscopes.java is a program that creates a single
global scope object and then shares it across multiple threads. sharing the
global scope allows both information to be shared across threads, and amortizes the cost of context.initstandardobjects by only performing that expensive operation once. implementing host objects first check out the tutorial if you haven't already. the foo class - extending scriptableobject foo.java is a simple javascript host o...
Performance Hints
mpiler to generate special code to access the variables. for example, you could rewrite function sum(a) { result = 0; for (i=0; i < a.length; i++) result += a[i]; return result; } as function sum(a) { var result = 0; for (var i=0; i < a.length; i++) result += a[i]; return result; } this is not equivalent code because the second version does not modify
global variables result and i. however, if you don't intend for any other function to access these variables, then storing them
globally is probably wrong anyway (what if you called another function that had a loop like the one in sum!). arrays use the forms of the array constructor that specify a size or take a list of initial elements. for example, the code var a = new array(); for (var i=0; i < n;...
Rhino scopes and contexts
ntly executed script rather than their lexical scope. so we can store information that varies across scopes in the instance scope yet still share functions that manipulate that information reside in the shared scope. the dynamicscopes example illustrates all the points discussed above. more on scopes the key things to determine in setting up scopes for your application are what scope should
global variables be created in when your script executes an assignment to an undefined variable, and what variables should your script have access to when it references a variable? the answer to 1 determines which scope should be the ultimate parent scope: rhino follows the parent chain up to the top and places the variable there. after you've constructed your parent scope chain, the answer to questi...
GC Rooting Guide
how it gets traced depends on why it should be alive. the simplest approach is to use js::persistentrooted (usable on anything with a trace method with the appropriate signature): js::persistentrooted<myowningstruct> immortalstruct; but note that js::persistentrooted in a struct or class is a rather dangerous thing to use -- it will keep a gc thing alive, and most gc things end up keeping their
global alive, so if your class/struct is reachable in any way from that
global, then nothing will ever be cleaned up by the gc. summary use js::rooted<t> typedefs for local variables on the stack. use js::handle<t> typedefs for function parameters. use js::mutablehandle<t> typedefs for function out-parameters. use an implicit cast from js::rooted<t> to get a js::handle<t>. use an explicit addr...
Bytecodes
presentation that is used in the javascript engine. the javascript frontend constructs an ast from the source text, then emits stack-based bytecodes from that ast as a part of the jsscript data structure. bytecodes can reference atoms and objects (typically by array index) which are also contained in the jsscript data structure. within the engine, all bytecode execute within a stack frame -- even
global (top-level) and eval code has a stack frame associated with it. a frame on the stack has space for javascript values (the tagged value format) in a few different categories. the space for a single javascript value is called a "slot", so the categories are: argument slots: holds the actual arguments passed to the current frame. local slots: holds the local variables used by the current code. e...
Tracing JIT
l component: jstracer.* the files jstracer.cpp and jstracer.h contain a the mechanisms of monitoring and recording the activity of the interpreter. each spidermonkey jscontext holds a trace monitor of type jstracemonitor. the trace monitor maintains some book-keeping information, as well as the collection of recorded fragments, held in a hashtable keyed by the interpreter's program counter and
global object shape at the time of recording. at any moment, the trace monitor is in one of three major states: monitoring, recording, or executing. the transitions between these states are somewhat complex and delicate, but the overall picture is simple: monitoring the trace monitor's initial state is monitoring. this means that spidermonkey is interpreting bytecode. every timespidermonkey interpr...
SpiderMonkey Internals
e 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. jsarena.cpp, jsarena.h last-in-first-out allocation macros that amortize malloc costs and allow for en-masse freeing. see the paper mentioned in jsarena.h's major comment. jsgc.cpp, jsgc.h the garbage collector and tracing routines. jsinterp.*,...
Introduction to the JavaScript shell
some environment variables that can be set to alter js shell behavior. js_stdout=file redirect stdout to file. js_stderr=file redirect stderr to file. built-in functions to make the javascript shell more useful, there are a number of built-in functions provided that you can use either from javascript programs or in interactive mode. note: this list is incomplete and overlaps with shell
global objects. see js/src/shell/js.cpp (around shell_functions) for more. build() returns the date and time at which the javascript shell was built. note: clear() with no parameters really clears everything. this includes all these built-in functions. clone(function, [scope]) clones the specified function object. if scope isn't specified, the new object's parent is the same as the original object...
JIT Optimization Outcomes
es 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 the object containing the 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 h...
JS::CloneFunctionObject
leobject the function to clone. scopechain js::autoobjectvector the new function's scope chain. description js::clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj. if scopechain is supplied, it uses scopechain as its enclosing scope. if scopechain is omitted, it creates a new function object in cx's
global. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created
global object. the new object's prototype is function.prototype; js_newobject : choosing a default prototype explains exactly how this is computed. js::clonefunctionobject takes care to choose a prototype that shares a
global object with the given parent whenever possible. funobj ...
JS::Compile
ct obj, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlescript script); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the
global object, or null. obsolete since jsapi 39 options js::readonlycompileoptions & compile options. srcbuf js::sourcebufferholder & source buffer containing the script to compile. chars const char16_t * string containing the script to compile. bytes const char * string containing the script to compile. length size_t the...
JS::CompileOptions
s-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. to counter this attack, html5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the
global for which it is loaded. callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in jserrorreports. const char *filename() const returns filename of the source code. const char *introducerfilename() const returns filename of the file which introduces the file. const char16_t *sourcemapurl()...
JSClass.call
ype jsnative. note that when a custom object is called, a this argument is calculated for it just as if it were a function. that is, the obj argument received by the jsnative is the this argument, not the custom object that was called! // suppose this object has jsclass.call and jsclass.construct hooks. var custom = new specialcustomobject(); custom(); // the jsclass.call hook receives the
global object as the obj parameter. new custom(); // the jsclass.construct hook receives the
global object as the obj parameter. var x = { specialmethod: custom }; x.specialmethod(); // the jsclass.call hook receives x as the obj parameter. new x.specialmethod(); // the jsclass.construct hook receives x as the obj parameter. the custom object that was called is jsval_to_object(js_argv_callee(a...
JSClass
ctforconstructor(cx, &printer_class, vp); */ if (!obj) return false; myprinter *p = new myprinter; if (p == null) { js_reportoutofmemory(cx); return false; } js_setprivate(cx, obj, p); args.rval().setobject(*obj); /* spidermonkey 31 or older * js_set_rval(cx, vp, object_to_jsval(obj)); */ return true; } { js_initclass(cx,
global, js::null(), &printer_class, printer_construct, 1, null, null, null, null); } see also mxr id search for jsclass jsclass.flags js_getclass js_initclass js_newobject js_newobjectforconstructor js_instanceof bug 638291 - added trace bug 702507 - removed jsclass_construct_prototype bug 726944 - removed xdrobject, reserved0 and reserved1 bug 886829 - made finalize option...
JSErrorReport
ss-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. to counter this attack, html5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the
global for which it is loaded. callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in jserrorreports. linebuf const char * text of the line that caused the error, minus the trailing newline character. tokenptr const char * pointer to the error token in *linebuf. uclinebuf const char1...
JSExtendedClass
t they wrap. for example, an object and its wrappers are all equal under ===. description to implement a custom class that uses any of the jsextendedclass callbacks: create a jsextendedclass and populate both the base fields and the extended fields. ensure that the additional reserved fields at the end of the jsextendedclass are null. jsclass and jsextendedclass structs should usually be
global, and in this case the compiler automatically initializes these fields to null. (this is a feature of the c and c++ languages.) otherwise, use memset. set the jsclass_is_extended flag in myextendedclass.base.flags. pass &myextendedclass.base to functions like js_initclass or js_newobject that require a jsclass *. see also bug 571789 ...
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 prop...
JSRuntime
top-level object that represents an instance of the javascript engine. a program typically has only one jsruntime, even if it has many threads. the jsruntime is the universe in which javascript objects live; they can't travel to other jsruntimes. all javascript code and most jsapi calls run within a jscontext. the jscontext is a child of the jsruntime. a context can run scripts. it contains the
global object and the execution stack. exception handling, error reporting, and some language options are per-jscontext. once created, a context can be used any number of times for different scripts or jsapi queries. for example, a browser might create a separate context for each html page; every script in the page could use the same context. objects may be shared among jscontexts within a jsruntime. t...
JSSecurityCallbacks.contentSecurityPolicyAllows
e of the callback. (it is also the type of the callback set by js_setcheckobjectaccesscallback.) syntax typedef jsbool (*jscspevalchecker)(jscontext *cx); name type description cx jscontext * the js context in which the property access attempt is occurring. description check whether runtime code generation is allowed for the current
global. jssecuritycallbacks.contentsecuritypolicyallows is invoked once per
global object upon the first attempt to evaluate js code from a string (either through eval or the function constructor). ...
JS_AddExternalStringFinalizer
the callback may not keep a reference to this jsstring, as its memory is about to be freed. description add a finalizer for external strings created by js_newexternalstring using a type-code returned from this function, and that understands how to free or release the memory pointed at by js_getstringchars(str). returns a nonnegative type index if there is room for finalizer in the
global gc finalizers table, else returns -1. in a js_threadsafe build, this function must be invoked on the primordial thread only, at startup—or else the entire program must single-thread itself while loading a module that calls this function. to remove an external string finalizer, use js_removeexternalstringfinalizer. see also js_removeexternalstringfinalizer bug 724810 ...
JS_BeginRequest
name type description cx jscontext * the context in which the calling thread intends to call jsapi functions. description when your multithreaded application wants to use a jscontext, it must use js_beginrequest and js_endrequest to bracket maximal non-blocking hunks of native code that call the jsapi. this "request model" is necessary to interlock with the
global garbage collector. in a js_threadsafe build, many jsapi functions must only be called from within a request. in this reference, the cx parameter of such functions is documented with the phrase “requires request”, like this: name type description cx jscontext * the context to use. requires request. in a js_threadsafe build, the caller must be in a request on th...
JS_BufferIsCompilableUnit
ol js_bufferiscompilableunit(jscontext *cx, js::handle<jsobject*> obj, const char *utf8, size_t length); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the
global object, or null. utf8 const char * string containing the script to compile. length size_t the length of utf8 in characters. description given a buffer, return false if the buffer might become a valid javascript statement with the addition of more lines. otherwise return true. the intent is to support interactive compilation - accumulate lines in a buffer until ...
JS_ClearNewbornRoots
* the context to clear. description the last gc thing of each type (object, string, double, external string types) created on a given context is kept alive until another thing of the same type is created, using a newborn root in the context. these newborn roots help native code protect newly-created gc-things from gc invocations activated before those things can be rooted using local or
global roots. however, the newborn roots can also entrain great gobs of garbage, so the js_gc entry point clears them for the context on which gc is being forced. embeddings may need to do likewise for all contexts. see js_enterlocalrootscope for a better way to manage newborns in cases where native hooks (functions, getters, setters, etc.) create many gc-things, potentially without connecting them to p...
JS_ClearRegExpStatics
clear the pending regexp input and flags. syntax bool js_clearregexpstatics(jscontext *cx, handleobject 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::handleobject a pointer to a
global object. description js_clearregexpstatics clears the pending input string and flags of the built-in regexp object. on successful, js_clearregexpstatics returns true, otherwise returns false. see also mxr id search for js_clearregexpstatics js_newregexpobject js_newucregexpobject js_setregexpinput regexp ...
JS_ClearScope
on 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 property from an object, use js_deleteproperty. to remove a single array object element, use js_deleteelement. see also js_deleteproperty js_deleteelement js_clearnon
globalobject js_setallnonreservedslotstoundefined bug 749371 ...
JS_CloneFunctionObject
jsobject * the function to clone. parent jsobject * the new function's parent. description js_clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj, but uses parent as its enclosing scope. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created
global object. the new object's prototype is function.prototype; js_newobject: choosing a default prototype explains exactly how this is computed. js_clonefunctionobject takes care to choose a prototype that shares a
global object with the given parent whenever possible. funobj must be a pointer to a javascript function object (see js_objectisfunction). on success, js_clonefunctionobject returns a point...
JS_CompileFunction
new function becomes a method of obj. (a new property is defined on obj with the given name and the new function object as its value.) on success, js_compilefunction and js_compileucfunction return a pointer to the newly compiled function. ...
JS_CompileFunctionForPrincipals
the line number of the function or file where an error occurred during compilation. on success, js_compilefunctionforprincipals and js_compileucfunctionforprincipals return a pointer to the newly compiled function. on error or exception, they return null. ...
JS_CompileScript
*chars, size_t length, const js::compileoptions &options, js::mutablehandlescript script); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the
global object, or null. if the jsoption_compile_n_go option is set in cx, the resulting script must be executed in this scope, and at most once. obsolete since jsapi 39 ascii or chars const char * or const char16_t * string containing the script to compile. length size_t the length, in characters, of source. options js::compileoptions & compile options. ...
JS_ConstructObject
engine tries to find reasonable defaults. js_constructobjectwitharguments is the same but additionally passes zero or more arguments to the constructor. neither of these functions is quite like the javascript new keyword. for details on how we find the appropriate constructor and default prototype, see js_newobject: choosing a default prototype. roughly speaking, we use parent or cx to find a
global object, and then find clasp's constructor in that
global object. if parent is null, the engine chooses an object to serve as the new object's parent. on success, js_constructobject returns a pointer to the newly instantiated object. otherwise it returns null. the new object created by these functions is subject to garbage collection. the object should be made gc-reachable immediately. see the ...
JS_ConvertArguments
ous and almost entirely useless, because the resulting jsfunction is not a real function object and therefore cannot be safely passed to any other jsapi function. that includes js_callfunction() and js_getfunctionobject(). a jsfunction represents only the compiled code and not the environment of the function. unless the function happens to be a native function, this means it isn't attached to any
global or enclosing scope, and therefore must not be treated like a real function. instead, use jsval_is_object and js_objectisfunction() to check whether a value is already a function, or use js_convertvalue() to convert a value to jstype_function safely. v jsval argument value (no conversion) * n/a none. if an asterisk (*) is present in format, it tells the conversio...
JS_DefineFunctions
dontdefinelateproperties define only properties which have no jsprop_define_late flag. description js_definefunctions creates zero or more functions and makes them properties (methods) of a specified object, obj, as if by calling js_definefunction repeatedly. fs is a pointer to the first element of an array of jsfunctionspec records. this array is usually defined as a static
global, with each record initialized using js_fs or js_fn. each array element defines a single function: its name, the native c/c++ implementation, the number of javascript arguments the function expects, and any property attributes. the last element of the array must contain 0 values. (the macro js_fs_end can be used for the last element.) js_definefunctions creates one function for each non-zero eleme...
JS_DestroyContext
context(jscontext *cx); void js_destroycontextnogc(jscontext *cx); void js_destroycontextmaybegc(jscontext *cx); // obsolete since jsapi 14 name type description cx jscontext * the context to destroy. description these functions destroy a context, cx. js_destroycontext additionally performs garbage collection to reclaim any memory that was being used by cx's
global object. js_destroycontextnogc does not perform garbage collection. js_destroycontextmaybegc may or may not perform garbage collection; the engine makes an educated guess as to whether enough memory would be reclaimed to justify the work. in a js_threadsafe build, it does not matter whether the calling thread is in a request on cx. however, there must not be any suspended requests on cx. if js_set...
JS_EnterLocalRootScope
ot scope. syntax jsbool js_enterlocalrootscope(jscontext *cx); name type description cx jscontext * pointer to the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description scoped local root management allows native functions, getter/setters, etc. to avoid calling js_addroot and js_removeroot to manage
global roots temporarily. js_addroot roots a variable, ensuring that whatever the variable points to at any given moment is protected from gc. by contrast, local root scopes protect newly-created objects, doubles, and strings. there is no need to tell the js engine about each variable that may point to such a value. calling js_enterlocalrootscope and js_leavelocalrootscope around the body of the native ...
JS_EnumerateStandardClasses
jscontext *cx, js::handleobject obj); name type description cx jscontext * pointer to the executable script context 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::handleobject an object to enumerate standard classes. description the
global object's class's enumerate op should call js_enumeratestandardclasses(cx, obj), to define eagerly during for...in loops any classes not yet resolved lazily. see also mxr id search for js_enumeratestandardclasses js_resolvestandardclass ...
JS_ExecuteRegExp
char16_t *chars, size_t length, size_t *indexp, bool test, js::mutablehandlevalue rval); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a
global object. reobj js::handleobject a pointer to a regexp object. chars const char16_t * a pointer to the string contains a input string. length size_t the length of bytes or chars, in characters. indexp size_t * in/out parameter. a pointer to the lastindex for the execution, and received the updated lastindex. test bool pass t...
JS_ExecuteScriptVersion
object *scriptobj, jsval *rval, jsversion version); name type description cx jscontext * the context in which to execute the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the scope in which to execute the script. in the simplest cases, this should just be the embedding's
global object. obj must not be an array, an e4x xml object, a with object, or a proxy. in ecmascript terms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2. instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until null i...
JS_GetErrorPrototype
of error.prototype. syntax jsobject * js_geterrorprototype(jscontext *cx); name type description cx jscontext * pointer to a js context whose errors should be reported via your function. other contexts in the same runtime can have their own error reporting functions. description js_geterrorprototype returns the original value of error.prototype from the
global object of the current compartment of cx. see also mxr id search for js_geterrorprototype bug 997285 ...
JS_GetGCParameter
rsery may grow to, or 0 to disable generational gc. jsgc_min_nursery_bytes / "minnurserybytes" minimum size the nursery may shrink to. jsgc_bytes / "gcbytes" amount of bytes allocated by the gc. jsgc_number / "gcnumber" number of times gc has been invoked. includes both major and minor gc. jsgc_mode / "mode" select gc mode: jsgc_mode_
global (0) the gc runs all objects are visited in a singleslice. jsgc_mode_zone (1) the gc runs only the objects that belong to somezones are visited in a singleslice. jsgc_mode_incremental (2) the gc runs all objects are visited in multipleslices. jsgc_mode_zone_incremental (3) the gc runs only the objects that belong to somezones are visited in multipleslices. ...
JS_GetSecurityCallbacks
isable eval() and friends. use null is not needed. subsumes jssubsumesop a pointe to the function which returns whether the first principal subsumes the second. use null is not needed. description js_setsecuritycallbacks sets the runtime's security callbacks to callbacks. it allows the embedding to control certain aspects of js code execution based on security settings of the
global object the code is executed in. if callbacks is null, it sets callbacks to default value. js_getsecuritycallbacks returns the runtime's current security callbacks. if the callbacks are default value, it returns null see also mxr id search for js_getsecuritycallbacks mxr id search for js_setsecuritycallbacks jsprincipals jscspevalchecker jssubsumesop bug 957688 - removed checkobjectaccess bug ...
JS_InitCTypesClass
this article covers features introduced in spidermonkey 1.8.5 initialize the ctypes object on a
global object. the ctypes object will be frozen. syntax jsbool js_initctypesclass(jscontext *cx, jsobject *
global); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.
global jsobject * the
global object. description ctypes capability is disabled in a build by default. see also ...
JS_IsBuiltinEvalFunction
this article covers features introduced in spidermonkey 17 return whether the given function is the
global eval function. syntax bool js_isbuiltinevalfunction(jsfunction *fun); name type description obj jsfunction * pointer to the function to test. description js_isbuiltinevalfunction returns whether the given function is the
global eval function. see also mxr id search for js_isbuiltinevalfunction js_isbuiltinfunctionconstructor bug 638312 ...
JS_IsBuiltinFunctionConstructor
this article covers features introduced in spidermonkey 17 return whether the given function is the
global function constructor. syntax bool js_isbuiltinfunctionconstructor(jsfunction *fun); name type description obj jsfunction * pointer to the function to test. description js::iscallable returns whether the given function is the
global function constructor. see also mxr id search for js_isbuiltinfunctionconstructor js_isbuiltinevalfunction bug 638312 ...
JS_NewContext
stack depth limit.) passing a large number for stackchunksize is a mistake. in a debug build, large chunk sizes can degrade performance dramatically. the usual value of 8192 is recommended. the application must call js_destroycontext when it is done using the context. before a jsruntime may be destroyed, all the jscontexts associated with it must be destroyed. the new jscontext initially has no
global object. the new jscontext is associated with the calling thread. no other thread may use it or destroy it. see also mxr id search for js_newcontext js_destroycontext js_contextiterator js_setcontextcallback ...
JS_RemoveExternalStringFinalizer
h it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. unregister a custom string memory manager. syntax int js_removeexternalstringfinalizer(jsstringfinalizeop finalizer); name type description finalizer jsstringfinalizeop the finalizer to remove. description remove finalizer from the
global gc finalizers table, returning its type code if found, -1 if not found. as with js_addexternalstringfinalizer, there is a threading restriction if you compile the engine js_threadsafe: this function may be called for a given finalizer pointer on only one thread; different threads may call to remove distinct finalizers safely. you must ensure that all strings with finalizer's type have been coll...
JS_ResolveStandardClass
or an int, to a standard class name in obj if possible, defining the class's constructor and/or prototype and storing true in *resolved. if id does not name a standard class or a top-level property induced by initializing a standard class, store false in *resolved and just return true. return false on error, as usual for bool result-typed api entry points. this api can be called directly from a
global object class's resolve op, to define standard classes lazily. the class's enumerate op should call js_enumeratestandardclasses(cx, obj), to define eagerly during for...in loops any classes not yet resolved lazily. see also mxr id search for js_resolvestandardclass js_enumeratestandardclasses ...
JS_SetRegExpInput
set the pending regexp input. syntax bool js_setregexpinput(jscontext *cx, js::handleobject obj, js::handlestring input, bool multiline); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a
global object. input js::handlestring a pointer to the input string. multiline bool true if input is multiline. description js_setregexpinput sets the pending input string of the built-in regexp object to the specified input string. the jsreg_multiline is set to multiline parameter, and other flags are all reset. on successful, js_setregexpinput returns true, otherwi...
JS_THREADSAFE
s in a js_threadsafe build, spidermonkey's internal data structures that represent javascript values are single-thread-only. in a debug build, this is enforced with assertions. however, spidermonkey does not protect the application's data structures. jsnatives and other callback functions can be called concurrently by multiple threads. multiple threads can end up accessing private data or c/c++
global variables at the same time. it is up to the application to practice safe threading. sharing contexts among threads ordinarily, a jscontext is created, used, and destroyed by a single thread. this makes sense, as a context can only be used by one thread at a time. however, there are a few cases where an application might need to share contexts across threads. for example: many worker threads ...
JS_ValueToFunction
ous and almost entirely useless, because the resulting jsfunction is not a real function object and therefore cannot be safely passed to any other jsapi function. that includes js_callfunction() and js_getfunctionobject(). a jsfunction represents only the compiled code and not the environment of the function. unless the function happens to be a native function, this means it isn't attached to any
global or enclosing scope, and therefore must not be treated like a real function. instead, use jsval_is_object and js_objectisfunction() to check whether a value is already a function, or use js_convertvalue() to convert a value to jstype_function safely. if v is a function object, this returns the associated jsfunction. if v is null, undefined, a boolean, a number, or a string, a typeerror is rep...
Property attributes
lting to class gsops for property holding function. added in spidermonkey 17 mxr id search for jsfun_stub_gsops jsfun_constructor native that can be called as a constructor. added in spidermonkey 17 mxr id search for jsfun_constructor jsprop_redefine_nonconfigurable 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 th...
JSDBGAPI
see profiling javascript with shark. js_connectshark js_disconnectshark js_startchudremote js_stopchud...
Parser API
latest ecmascript features and is backward-compatible with spidermonkey format. example: > var expr = reflect.parse("obj.foo + 42").body[0].expression > expr.left.property ({loc:null, type:"identifier", name:"foo"}) > expr.right ({loc:{source:null, start:{line:1, column:10}, end:{line:1, column:12}}, type:"literal", value:42}) it is also 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 ...
Profiling SpiderMonkey
ant to run shark on both the browser and [xpcshell], since the host environments differ. here are some instrumented tests to work from: media:profiling-ammo.zip 3.) once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static builds. make -c my-obj-dir/js/src other ways to profile for linux, there are
global jprof functions available. see the documentation on the --enable-jprof mozconfig option. we're working to add support for other profilers, such as oprofile, intel vtune, and callgrind. when we have js scriptable profiling options available for all tier 1 platforms, we'll look at adding
global start/stop profiling functions. if you'd like to profile something at a higher level of detail than the j...
SpiderMonkey 1.8.8
ing c++ projects. please note that spidermonkey reserves the js:: namespace for itself. ...list new c++ helpers here... obsolete apis ...list obsolete methods/structs/apis here... deleted apis js_get_class (use js_getclass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentand
globalobject (use js_new
globalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_newnumbervalue api changes break out and discuss all api changes here... jsclass prototype has changed a number of optional members have been removed from the jsclass prototype. jsc...
SpiderMonkey 17
ing c++ projects. please note that spidermonkey reserves the js:: namespace for itself. ...list new c++ helpers here... obsolete apis ...list obsolete methods/structs/apis here... deleted apis js_get_class (use js_getclass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentand
globalobject (use js_new
globalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_newnumbervalue js_finalizestub js_clearnewbornroots jsclass_mark_is_trace flag js_setscriptstackquota api changes break out and discuss all api changes here... jsclass prototype...
SpiderMonkey 24
++ helpers have been introduced into the api, to help embedders writing c++ projects. please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use). ...list new c++ helpers here... obsolete apis ...list obsolete methods/structs/apis here... deleted apis js_get_class (use js_getclass instead) js_enumerateresolvedstandardclasses js_get
globalobject js_setcstringsareutf8 ...list other deleted apis... api changes break out and discuss all api changes here... jsoption_strict has been renamed to jsoption_extra_warnings. js_setversion has been removed, js version is now set on the compartment instead of context. js_getprototype, takes context as first argument js_encodestringtobuffer takes add context as first argument, js_newrun...
SpiderMonkey 38
) jsval_is_int (bug 952650) jsval_is_null (bug 952650) jsval_is_number (bug 952650) jsval_is_primitive (bug 952650) jsval_is_string (bug 952650) jsval_is_void (bug 952650) jsval_to_boolean (bug 952650) jsval_to_double (bug 952650) jsval_to_gcthing (bug 952650) jsval_to_int (bug 952650) jsval_to_object (bug 952650) jsval_to_private (bug 952650) jsval_to_string (bug 952650) js_clearnon
globalobject (bug 1043281) js_clonefunctionobject (bug 1089026) js_compilefunction (bug 1089026) js_compileucfunction (bug 1089026) js_convertarguments (bug 1125784) js_convertargumentsva (bug 1125784) js_convertstub (bug 1103152) js_defineownproperty (bug 1017323) js_deletepropertystub (bug 1103152) js_doubletoint32 (bug 1112774) js_doubletouint32 (bug 1112774) js_enumeratestub (bug 1103152)...
SpiderMonkey 45
gnificant updates to its language features, yo. new c++ apis jsapi is a c++ exclusive api. please note that spidermonkey reserves the js:: namespace for itself for public exports and the js:: namespace for internal use. ...
Mozinfo
ndows platform. api usage mozinfo is a python package. downloading the software and running python setup.py develop will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. the top level attributes (os, version, bits, processor) are available as module
globals: if mozinfo.os == 'win': ... in addition, mozinfo exports a dictionary, mozinfo.info, that contain these values. mozinfo also exports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "unknown". unknown will evaluate ...
Animated PNG graphics
rmat: instead of sequences of ihdr..idat..iend, frames other than frame 0 are stored in 'afra' chunks. added start_frame to 'anim' to indicate which frame the animation should start on. removed num_frames from 'anim' chunk from 0.3 added 'actl', 'fdat', 'fctl' chunk descriptions as per the latest png-list discussion added section 4, "interactions with other png chunks"; described
global and local palettes and transparency changed 'offs' chunk section to refer to more general chunks updated 'adat' description to indicate that all frames must either be in a single chunk, or that the first chunk must have empty data. added notice that each frame's region (x,y,width,height) must lie completely within the parent png canvas fixed dispose_op description (after, not befo...
Mork
a row should not be seen outside of a table; the only time i have seen one outside a table is for table meta-rows. the first mid, as you should expect by now, is the row id, with the scope being an important part of the id, in that 1:scope1 is not the same row as 1:scope2. if the scope is not specified, then it is the default scope of the table (if it has one) or 'r' otherwise. these row ids are
global, even if defined in a table. indeed, defining a row in a table is a shortcut for both defining a row and adding the row to the table. the presence of an initial minus means to delete all cells before adding new cells. a minus after the mid indicates that the next cell should be deleted. i haven't seen that case though, so it may not be an issue in practice. the rowreference is a mid that refers t...
The Places database
d each time you visit a new host. it contains the host url, frequency of access, if typed or not, and it's prefix (https://, ftp://, etc). history tables moz_historyvisits: one entry in this table is created each time you visit a page. it contains the date, referrer, and other information specific to that visit. it contains a reference to the moz_places table which contains the url and other
global statistics. see history service design for more information. bookmarks tables moz_bookmarks: this table contains bookmarks, folders, separators and tags, and defines the hierarchy. the hierarchy is defined via the parent column, which points to the moz_bookmarks record which is the parent. the position column numbers each of the peers beneath a given parent starting with 0 and incrementing ...
History Service Design
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, bookmark, etc.). an additional property of a visit is the visit we have come from, this is used to track visit chains in
global history, so for example if clicking a link causes a redirect the from visit will allow to follow up the chain of visits. at the moment this is used when catching favicons or bookmarks for redirected pages. querying for data querying data is a basic feature for places. thanks to the underlying database, history size has increased far more than 10 times from the previous mork based implementation...
Aggregating the In-Memory Datasource
ce() implementation needs to forward nsirdfdatasource to the delegate3: ns_imethodimp myclass::queryinterface(refnsiid aiid, void** aresult) { ns_precondition(aresult != nsnull, "null ptr"); if (! ...
An Overview of XPCOM
r the object should return the same object. though there are tools and better ways to handle singletons (which we'll discuss when we talk about the nsiservicemanager), a developer may want to use this information to ensure that only one singleton object can exist despite what the callers do. the requirements of a factory class can be handled in a strictly functional way, with state being held by
global variables, but there are benefits to using classes for factories. when you use a class to implement the functionality of a factory, for example, you derive from the nsisupports interface, which allows you to manage the lifetime of the factory objects themselves. this is important when you want to group sets of factories together and determine if they can be unloaded. another benefit of using the ...
Component Internals
are for the applications that will be using your component. the shutdown process when the application is ready to shutdown xpcom, it calls ns_shutdownxpcom. when that method is called, the following sequence of events occurs: xpcom fires a shutdown notification to all registered observers. xpcom closes down the component manager, the service manager and associated services. xpcom frees all
global services. ns_shutdownxpcom returns and the application may exit normally. the unstoppable shutdown note that shutdown observation is unstoppable. in other words, the event you observe cannot be used to implement something like a "are you sure you want to quit?" dialog. rather, the shutdown event gives the component or embedding application a last chance to clean up any leftovers before they ...
Creating the Component Code
er->createinstance(ksamplecid, nsnull, kisupportsiid, (void**)&sample); in the above snippet, we assume that the component manager has been initialized. in many cases this value is passed in or easily accessible. if not, it can always be obtained by a call to ns_getcomponentmanager(). a listing of this and other
global xpcom functions is in the xpcom api reference. the first parameter of the call to createinstance specifies the component the client code is looking for, which is the same value passed to registerfactorylocation. the next parameter is for aggregation, which the weblock component does not support. the third parameter is the interface used to talk to the component. the last parameter is the out var...
Finishing the Component
sn't frozen, that stuff is subject to change in future versions of gecko. if you want to be protected against changes in gecko, you must only use interfaces and apis that are clearly marked as frozen. the marking is made in the comments above the interface declaration. for example, take a look at the nsiservicemanager: /** * the nsiservicemanager manager interface provides a means to obtain *
global services in an application. the service manager depends * on the repository to find and instantiate factories to obtain * services. * * users of the service manager must first obtain a pointer to the *
global service manager by calling ns_getservicemanager. after that, * they can request specific services by calling getservice. * when they are finished they can ns_release() the service as ...
Starting WebLock
s in the white list. even this simple outline presents some ambiguity, however. it's certainly not enough to spell out the interface for the weblock component in this way. for example, addsite is supposed to add the current url to the white list, but is the url an input parameter to the method, is it the topmost web page in the gecko application, or is it something more random-a url picked from
global history or that's been given context in some other way? as a strongly typed and implementation-agnostic language, xpidl requires that you be quite specific about the apis, the list of parameters, their order, and their types. xpidl requires that you spell it all out, in other words. and it's this formality that makes the interfaces in xpcom effective contracts between services and clients. the ...
Introduction to XPCOM for the DOM
tion is true most of the time). you would like to manipulate that object with a method defined on the nsifoo interface. the goal is to retrieve a pointer to the nsifoo interface. to do so, there are two main techniques, and the context should tell you what to use. the first technique is to use a "getter", the second is to use a static cast on the "this" pointer. a getter is a function defined in
global scope or in class scope that will "return" a pointer to the required interface. generally getters work like this: first, declare a pointer to an interface, ifooptr without assigning it. pass the address of the pointer to the getter function. the getter function will then assign to the pointer the correct address and will queryinterface the pointer to that interface. ifooptr is now a pointer to an...
Components.isSuccessCode
g example demonstrates copying data from a buffered nsiinputstream to an nsioutputstream, checking for whether the copy succeeded using components.issuccesscode(). note: nsiasyncstreamcopier.init() has changed in gecko 1.9.2, omit last 2 boolean parameters if you're using gecko 1.9.1 and earlier. ...
Components.manager
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. ...
Components.utils.cloneInto
ve functions below. wrapreflectors: a boolean value that determines if objects reflected from c++, such as dom objects, should be cloned. if omitted the default value is false. see cloning objects that contain dom elements below. returns a reference to the cloned object. ...
Components.utils.evalInWindow
ul for privileged code, such as add-on code, to access variables and apis defined in web content. even so, while the code is being evaluated it is in the content's context, so the caller has to be prepared for the possibility that the content could have redefined behavior (for example, a setter in the script may have been redefined to do something unexpected). this function is made available as a
global in sandboxes which have the wantexporthelpers option set in the sandbox() constructor. syntax var result = components.utils.evalinwindow(script, window); parameters script : string the script to evaluate in the other window. window : object the window in which to evaluate the script. returns the result of evaluating the script. if this is just native (for example, a dom node), ...
Components.utils.unload
of your extension. syntax components.utils.unload( url ); parameters url the "resource://" url of the script to unload. this must be the same url that was used to load the script. example you can unload a module called mymodule.jsm using the following line of code: components.utils.unload("resource://myaddon/modules/mymodule.jsm"); note: currently components.utils.unload clears the
global object of an unloaded module. this may cause modules to misbehave after unloading even if you have a reference to them. see bug 769253 see also bug 481603 the documentation in xpccomponents.idl the tests in js/xpconnect/tests/unit/ ...
Components.utils.unwaiveXrays
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 obj the object for which we wish to restore xrays. returns the object with xrays restored. example suppose a page script adds an expando to its
global window: // page script foo = "i'm an expando"; by default, chrome code won't see foo, because it sees the content window with xray vision, but the chrome code can waive xray protection. the chrome code can then use unwaivexrays to restore xray protection: // chrome code // contentwindow is an xray var isxray = components.utils.isxraywrapper(gbrowser.contentwindow); // true // expandos are no...
Components.utils.waiveXrays
x waived = components.utils.waivexrays(obj); parameters obj the object for which we wish to waive xrays. returns if the argument obj is an xray, this function returns a wrapper that transitively waives xray behavior on the underlying object and anything that comes off the object. if obj is not an xray, this function just returns obj. ...
XPCShell Reference
arnings. the last option listed is the one that takes effect. -x this option toggles the xml option on and off. by default it is off. [scriptfile] this is the file name of the script to execute. [scriptarg…] these are arguments to be passed to the script. these arguments are only passed to “scriptfile” and not the scripts designated by –f options. these arguments appear on the
global property arguments. for instance, assume that you have a file called test.js with the following contents: for (prop in arguments) { print(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...
NS_InitXPCOM2
ationprovider [in] the object to be used by xpcom to locate application specific directories and files (e.g., the user profile, the component registry, etc.). this parameter may be nsnull. return values the ns_initxpcom2 function returns ns_ok if successful. otherwise, it returns an error code. some of the possible errors are documented below: ns_error_not_initialized indicates that static
globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes. this error may also occur if xpcom is being initialized after ns_shutdownxpcom has been called. remarks you must call ns_initxpcom2 (or ns_initxpcom3) before proceeding to use xpcom in a process. the one exception is that you may call ns_newlocalfile or ns_newnativelocalfile...
NS_InitXPCOM3
y of nsstaticmoduleinfo objects. passing null causes the default (built-in) static modules to be registered, if present. astaticmodulecount [in] the number of elements in astaticmodules. return values the ns_initxpcom3 function returns ns_ok if successful. otherwise, it returns an error code. some of the possible errors are documented below: ns_error_not_initialized indicates that static
globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes. this error may also occur if xpcom is being initialized after ns_shutdownxpcom has been called. remarks you must call ns_initxpcom3 (or ns_initxpcom2) before proceeding to use xpcom in a process. the one exception is that you may call ns_newlocalfile or ns_newnativelocalfile...
Core XPCOM functions
xpcom provides a number of
global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces. ns_allocinfallibly allocates a block of memory using the xpcom memory manager.ns_freefrees a block of memory using the xpcom memory manager.ns_getcomponentmanagerthe ns_getcomponentmanager function returns a reference to the xpcom component manager.ns_getcomponentregistrarthe ns_getcomponentregistrar function returns a reference to the xpcom component registrar.ns_getmemorymanagerthe ns_getmemorymanager function returns a reference to the xpcom memory manager.ns_getservicemanagerthe ns_getservicemanager function returns a reference to the xpcom service manager.ns_initxpcom2the ns_initxpcom2 fun...
XPCOM glue classes
sembedstringthe nsembedstring concrete class provides a way to construct a nsastring object that allocates null-terminated storage.nsfixedcstringclass declarationnsfixedstringclass declarationnsliteralcstring (external)class declarationnsliteralstring (external)class declarationnsmemorythe nsmemory class provides static helper routines to manage memory. these routines allow easy access to xpcom's
global nsimemory implementation without having to go through the service manager to get it.nspromiseflatcstringclass declarationnspromiseflatstringclass declarationnsrefptrrefptr (formerly known as nsrefptr, see bug 1207245) is a general class to implement reference counting pointers for objects. it is similar to nscomptr, but does not require that the type be an xpcom interface. like with nscomptr, it...
IJSDebugger
odule that does this for you. the only time you should directly use this interface to create the debugger object is if you need to debug chrome; due to bug 707237, the javascript code module doesn't work in that case. see the javascript debugger api guide for details on using the debugger api. method overview [implicit_jscontext] void addclass(); methods addclass() defines the
global debugger constructor. on return, the debugger object has been added to the
global context. [implicit_jscontext] void addclass(); parameters none. see also js debugger api reference js debugger api guide ...
mozIPlaceInfo
toolkit/components/places/public/moziasynchistory.idlscriptable this interface provides additional info for a places entry 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) attributes attribute type description frecency long read only: the frecency of the place. guid string read only: the
globally unique id of the place. placeid long read only: the machine-local (internal) id of the place. title string read only: the title associated with the place. uri nsiuri read only: the uri of the place. visits mozivisitinfo[] read only: an array of mozivisitinfo objects for the place. see also moziasynchistory mozivisitinfo ...
DefaultKeyBinding
« nsiaccessible page summary provides localized string of
global keyboard accelerator for default action, such as ctrl+o for open file (ctrl + o). attribute astring defaultkeybinding; see also nsiaccessible.getkeybindings() nsiaccessible.keyboardshortcut ...
nsIAppShellService
needed for good measure webnav = null; // in firefox <= 45 setting to null will cause it to get gc'ed which will destroy it registertoplevelwindow() add a window to the application's registry of windows. these windows are generally shown in the windows taskbar, and the application knows it can not quit until it is out of registered windows. note: when this method is successful, it fires the
global notification "xul-window-registered" void registertoplevelwindow( in nsixulwindow awindow ); parameters awindow the window to register. run() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) runs an application event loop: normally the main event pump which defines the lifetime of the application. void run(); parameters none. ...
nsIBrowserSearchService
earch engine. void moveengine( in nsisearchengine engine, in long newindex ); parameters engine the engine to move. newindex the engine's new index in the set of visible engines. exceptions thrown ns_error_failure if newindex is out of bounds, or if engine is hidden. removeengine() removes the search engine. if the search engine is installed in a
global location, this will just hide the engine. if the engine is in the user's profile directory, it will be removed from disk. void removeengine( in nsisearchengine engine ); parameters engine the engine to remove. restoredefaultengines() un-hides all engines installed in the directory corresponding to the directory service's ns_app_search_dir key. (that is the set of engines return...
nsIDOMStorageItem
nsidomstorageitem.idlscriptable this interface represents an object in dom storage. this is for session storage. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) gecko 1.9.1 note starting in gecko 1.9.1 (firefox 3.5), this is only used for session storage; previously, it was also used for
global storage. attributes attribute type description secure boolean if true, the item was stored for an https page. note: all items, regardless of whether they were stored for an http page or an https page, are visible from https pages. however, http pages can only see items stored from http pages, and will not see items stored from https pages. as such, this attribute is irrelevant for storage ...
nsIDOMStorageList
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsidomstorage nameditem(in domstring domain); methods nameditem() called when the list of available access points changes. nsidomstorage nameditem( in domstring domain ); parameters domain the name of the domain for whom to return the storage object. ...
nsIDOMStorageWindow
all dom windows inherit from this interface. 1.0 66 introduced gecko 1.8.1 obsolete gecko 8.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko 8.0 this interface has been merged into nsidomwindow, and this interface has been removed. attributes attribute type description
globalstorage nsidomstoragelist
global storage, accessible by domain. read only. localstorage nsidomstorage local storage for the current browsing context. data stored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. moz_indexeddb nsiidbfactory indexed databases for the current browsing cont...
nsIDOMWindow
ription applicationcache nsidomofflineresourcelist get the application cache object for this window. read only. note: prior to gecko 7.0 this attribute was part of nsidomwindow2. document nsidomdocument the document contained in the window. read only. frames nsidomwindowcollection the child windows for this window. read only. native code only!
globalstorage nsidomstoragelist
global storage, accessible by domain. read only. note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow. localstorage nsidomstorage local storage for the current browsing context. data stored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. note: prior to ge...
nsIDirectoryServiceProvider
tring prop, out prbool persistent ); parameters prop the symbolic name of the file. persistent true if the returned file will be cached by directory service. subsequent requests for this prop will bypass the provider and use the cache. false if the provider will be asked for this prop each time it is requested. return value the nsifile represented by the property. example this code creates a
global, read-only string called currdir with the value of the current working directory. __definegetter__("currdir", function getcurrdir() { return components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectoryserviceprovider) .getfile("curworkd",{}...
nsIDownload
of bytes downloaded so far. read only. cancelable nsicancelable an object that can be used to cancel the download. once the download is complete, this value is set to null. read only. displayname astring a user-readable description of the transfer. read only. id unsigned long the id by which the download is identified uniquely in the database - not
globally unique. for example, a private download and a public one might have identical ids. can only be safely used for direct database manipulation in the database that contains this download. use the guid property instead for safe, database-agnostic searching and manipulation. read only. deprecated since gecko 19.0 guid astring the guid of the download that is stored in the database. h...
nsIFaviconService
ils again, it will be re-added to the failed cache. setfaviconurlforpage() and setfavicondata() will take any url you provide and save it. this function is intended for automatic usage, and will only save favicons for "good" urls, as defined by what gets added to history. for "bad" urls, this function will succeed and do nothing. this function will also ignore the error page favicon uri (chrome://
global/skin/icons/warning-16.png). icons that fail to load will automatically be added to the failed favicon cache. this function will not save favicons for non-bookmarked urls when history is disabled (expiration time is 0 days). the rest of the functions here will always store favicons even when history is disabled. void setandloadfaviconforpage( in nsiuri apageuri, in nsiuri afaviconuri, in boo...
nsIFileView
pg files. void setfilter( in astring filterstring ); parameters filterstring the filter to be applied to the file list. sort() set the method used for sorting. void sort( in short sorttype, in boolean reversesort ); parameters sorttype one of the sort* constants. reversesort true, results will be sorted in ascending order. ...
nsIInstallLocation
install locations. you should not use the exact values here, you should offset from these values each time you create a new install location. offsetting can be brittle but you should know what install locations are being defined for your own application. constant value description priority_app_profile 0 priority_app_system_user 10 priority_xre_system_user 100 priority_app_system_
global 1000 priority_xre_system_
global 10000 methods getidforlocation() retrieves the guid for an item at the specified location. note: this function makes no promises about whether or not this path is actually maintained by this install location. astring getidforlocation( in nsifile file ); parameters file the location where an item might live. return value the id for an item that might l...
nsIJetpack
s all callbacks previously registered with registerreceiver() for a particular message. void unregisterreceivers( in astring amessagename ); parameters amessagename the name of the message to unregister all callbacks from. evalscript() this asynchronously sends code to the jetpack process for evaluation. the code will be evaluated using at least javascript 1.8.1. when evaluated, the script's
global scope will include all privileged apis. individual lines of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. void evalscript( in astring ascript ); parameters ascript the full contents of the script to evaluate in the jetpack process. createhandle() this creates an opaque handle that can transparently be exchanged between process...
nsIMemory
xpcom/base/nsimemory.idlscriptable this interface represents a generic memory allocator. inherits from: nsisupports last changed in gecko 0.9.6 nsimemory is used to allocate and deallocate memory segments from a heap. the implementation is free to define the heap. ns_getmemorymanager returns the
global nsimemory instance. method overview voidptr alloc(in size_t size); violates the xpcom interface guidelines void free(in voidptr ptr); violates the xpcom interface guidelines void heapminimize(in boolean immediate); boolean islowmemory(); deprecated since gecko 2.0 voidptr realloc(in voidptr ptr, in size_t newsize); violates the xpcom interface guidelines methods alloc allocates a block of memory of a particular size. voidptr...
nsIMessenger
ovides functions for managing the history, undo and redo operations, and for loading, saving, or deleting messages and attachments in mailnews. inherits from: nsisupports implemented by: @mozilla.org/messenger;1. to create an instance, use: messenger = components.classes["@mozilla.org/messenger;1"] .createinstance(components.interfaces.nsimessenger); in thunderbird, a
global nsimessenger object is defined as messenger via the createmessenger function in mailwindow.js. method overview void setdisplaycharset(in acstring acharset); void setwindow(in nsidomwindow ptr, in nsimsgwindow msgwindow); void openurl(in acstring aurl); void loadurl(in nsidomwindow ptr, in acstring aurl); void launchexternalurl(in acstring aurl); ...
nsIMicrosummaryGenerator
s installed via nsisidebar.addmicrosummarygenerator(), this uri is a urn of the form urn:source:<url>, where <url> is the remote location from which we installed the generator. for generators installed via some other mechanism (for example an extension that dynamically creates generators), this uri is a urn in a form of the extension's own choosing, with the only restriction being that the uri be
globally unique. to ensure this, we recommend that such extensions incorporate uuids created by nsiuuidgenerator into the urns of the generators they create. methods calculateupdateinterval() calculates the interval until the microsummary should be updated for the next time, depending on the page content. if the generator doesn't specify an interval, null is returned. long calculateupdateinterval( ...
nsIMsgCustomColumnHandler
ingforrow: 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() method: var handler = gdbview.getcolumnhandler("newcolumn"); and removed using the nsimsgdbview.removecolumnhandler() method: gdbview.removecolumnhandler("newcolumn"); method overview astring getsortstringforrow(in nsimsgdbhdr ahdr)...
nsIMsgDatabase
void synccounts(); getthreadcontainingmsghdr() nsimsgthread getthreadcontainingmsghdr(in nsimsgdbhdr msghdr) ; markhdrread() helpers for user command functions like delete, mark read, etc. void markhdrread(in nsimsgdbhdr msghdr, in boolean bread, in nsidbchangelistener instigator); markhdrreplied() void markhdrreplied(in nsimsgdbhdr msgh...
nsIMsgFilterCustomAction
* recommended form: extensionname@example.com#actionname */ readonly attribute acstring id; /* action name to display in action list. this should be localized. ...
nsIMsgFolder
linestoreoutputstream nsioutputstream readonly offlinestoreinputstream nsiinputstream readonly retentionsettings nsimsgretentionsettings downloadsettings 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: ol...
nsIMsgIdentity
are only used for migration and backward compatability. use dobcc and dobcclist instead. bccothers boolean bcclist astring dobcc boolean dobcclist astring draftfolder astring stationeryfolder astring showsavemsgdlg boolean directoryserver astring override
globalpref boolean autocompletetomydomain boolean if this is false, don't append the user's domain to an autocomplete address with no matches. valid boolean determines if the ui should use this identity and the wizard uses this to determine whether or not to ask the user to complete all the fields. smtpserverkey astring the preferred smtp server for t...
nsIMsgIncomingServer
rettyname astring helper function to construct the pretty name in a server type specific way - for example, mail for foo@test.com, news on news.mozilla.org. read only. defaultcopiesandfoldersprefstoserver boolean if the server supports fcc/sent/etc, default prefs can point to the server. otherwise, copies and folders prefs should point to local folders. by default this value is set to true via
global pref 'allows_specialfolders_usage' (mailnews.js). for nntp, the value is overridden to be false. if isps want to modify this value, they should do that in their rdf file by using this attribute. please look at mozilla/mailnews/base/ispdata/aol.rdf for usage example. displaystartuppage boolean dobiff boolean downloadmessagesatstartup boolean read only. downloadonbiff boolean downlo...
nsIMsgSearchCustomTerm
* recommended form: extensionname@example.com#termname * commas and quotes are not allowed, the id must not * parse to an integer, and names of standard search * attributes in searchattribentrytable in nsmsgsearchterm.cpp * are not allowed. */ readonly attribute acstring id; name /// name to display in term list. this should be localized. ...
nsINavHistoryObserver
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18) warning: if you are in the middle of a batch transaction, there may be a database transaction active. you can still access the database in this situation but be careful (of what?). ...
nsINavHistoryQueryOptions
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) method overview nsinavhistoryqueryoptions clone(); attributes attribute type description applyoptionstocontainers boolean if true, the query options are only applied to the containers. ...
nsIObserverService
xpcom/ds/nsiobserverservice.idlscriptable this interface provides methods to add, remove, notify, and enumerate observers of various notifications. inherits from: nsisupports last changed in gecko 0.9.6 the xpcom nsobserverservice implements this interface to provide
global notifications for a variety of subsystems. implemented by @mozilla.org/observer-service;1 as a service: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); method overview void addobserver( in nsiobserver anobserver, in string atopic, in boolean ownsweak); nsisimpleenumerator enumerateobservers( in string atopic ); void notifyobservers( in nsisupports asubject, in string atopic,...
nsIProcessScriptLoader
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisupports this interface is used by parent process message managers to load scripts into a child process. the scripts run only once per process. the
global object for process scripts is a contentprocessmessagemanager. methods void loadprocessscript(in astring aurl, in boolean aallowdelayedload) void removedelayedprocessscript(in astring aurl); jsval getdelayedprocessscripts(); loadprocessscript() load a script in the child process. process scripts are loaded as soon as loadprocessscript() is called. if this function is called on a chromemessagebroadcaster, : it will load the process script into all child processes. if aallowde...
nsISHEntry
ewer. savelayoutstateflag boolean indicate whether layouthistorystate should be saved. statedata nsistructuredclonecontainer get/set data associated with this history state via a pushstate() call, serialized using structured clone. (prior to gecko 6.0 returned a json encoded string.) sticky boolean whether the content viewer is marked "sticky" windowstate nsisupports saved state of the
global window object. methods addchildshell() saved child docshells corresponding to contentviewer. the child shells are restored as children of the parent docshell, in this order, when the parent docshell restores a saved presentation. append a child shell to the end of our list. void addchildshell( in nsidocshelltreeitem shell ); parameters shell childshellat() nsidocshelltreeitem childshell...
nsIScreenManager
; parameters nativewidget the native widget for which to obtain an nsiscreen instance. return value the nsiscreen instance for the native widget pointer. screenforrect() returns the nsiscreen containing the specified rectangle. if the rectangle overlaps multiple screens, the screen containing the majority of the rectangle's area is selected and returned. the coordinates must be specified using
global (screen) coordinates, and are in pixels. nsiscreen screenforrect( in long left, in long top, in long width, in long height ); parameters left the left edge of the rectangle. top the top edge of the rectangle. width the width of the rectangle. height the height of the rectangle. return value the nsiscreen containing the majority of the rectangle's area. see also nsiscreen ...
nsIScriptableIO
ch welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. nsiscriptableio provides a convenient api for creating files and streams, as well as for reading and writing data to them. for your convenience, this api is published through a
global io object. for more details about how to use this object, see the file and stream guide. network/base/public/nsiscriptableio.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports a scriptable io object can be used in an extension or chrome code by referring to the
global io object. for example: io.getfile("profile", "cooki...
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.import
globalproperties) 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.i...
nsISessionStore
eopened window as an nsidomwindow object. note on windows the nsisessionstore api stores state information for certain windows inside the web brower. these windows are nsidomwindow objects that contain the tabbrowser that users see as tabs; the document in these windows is browser.xul. for many extensions, those that overlay browser.xul, the appropriate window object for nsisessionstore is the
global object 'window'. for javascript running in windows other than the one you want to use in nsisessionstore, you need a nsidomwindow object containing browser.xul. this will be the outermost or root nsidomwindow in a nsixulwindow (the window seen by users as a moveable frame on the display). this kind of domwindow object can be obtained from other nsidomwindow objects (like the sidebar window objec...
nsIThreadManager
ns the corresponding nsithread. returns null if there isn't a corresponding nsithread. nsithread getthreadfromprthread( in prthread prthread ); parameters prthread the prthread for which to retrieve the corresponding nsithread. return value the nsithread matching the specified prthread, or null if there is no matching nsithread. newthread() create a new thread. internally, this is a
global user prthread. nsithread newthread( in unsigned long creationflags ); parameters creationflags reserved for future use. pass 0. return value the newly created nsithread. see also the thread manager nsithread nsithreadpool nsithreadinternal nsithreadobserver nsithreadeventfilter prthread ...
nsIUUIDGenerator
xpcom/base/nsiuuidgenerator.idlscriptable this interface can be used to generate an id that can be considered
globally unique, often referred to as a uuid or guid. 1.0 66 introduced gecko 1.8.1 inherits from: nsisupports last changed in gecko 1.8.1 (firefox 2 / thunderbird 2 / seamonkey 1.1) implemented by @mozilla.org/uuid-generator; as a service: var uuidgenerator = components.classes["@mozilla.org/uuid-generator;1"] .getservice(components.interfaces.nsiuuidgenerator); method overview nsidptr generateuuid(); void generateuuidinplace(in nsnonconstidptr id); native code only! methods generateuuid() obtains a new uuid using appropriate platform-specific methods to obtain a nsid that can be considered to be
globally unique. nsidptr gen...
nsIUpdateManager
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsiupdate getupdateat(in long index); void saveupdates(); attributes attribute type description activeupdate nsiupdate an nsiupdate object describing the currently in use update. this update is not in the history list. read only. ...
nsIUpdateTimerManager
these timers are used to schedule update checks in the future, for example. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void registertimer(in astring id, in nsitimercallback callback, in unsigned long interval); methods registertimer() presents a user interface that checks for and displays the available updates. ...
nsIWindowMediator
want to enumerate all windows regardless of type, specify null. note: in nsiwindowmediator's reference page the return type of getmostrecentwindow and the type of enumerator's elements is said to be nsidomwindow/nsidomwindowinternal. in fact, those methods usually (always?) return a chromewindow object, implementing both of those interfaces and a few others, when called from javascript code. the
global window object you're probably familiar with is of chromewindow type. see also working with windows in chrome code ...
nsIWindowWatcher
users must keep this attribute current, including after the topmost window is closed. this attribute will be null if the active window is not an nsidomwindow; for example, if the active window is an alert. methods getchromeforwindow() retrieve the chrome window mappe...
nsIWorkerMessagePort
duced gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void postmessage(in domstring amessage); methods postmessage() posts a message into the event queue. void postmessage( in domstring amessage ); parameters amessage the message to post. see also using web workers nsiworkermessageevent nsiworker
globalscope nsiworkerscope nsiabstractworker nsiworker ...
nsIXULBrowserWindow
provides methods that may be called from the internals of the browser area to tell the containing xul window to update its user interface. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the xulbrowserwindow attribute exists on the nsixulwindow interface although both firefox and seamonkey also store their nsixulbrowserwindow reference in the
global xulbrowserwindow object accessible from javascript code. note: the xulbrowserwindow object offered to javascript code provides a great many more methods and attributes than those listed here, which are only the ones available to c++ code. see the documentation for xulbrowserwindow for details. method overview astring onbeforelinktraversal(in astring originaltarget, in nsiuri linkuri, in nsidom...
nsIXULWindow
xpfe/appshell/nsixulwindow.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an nsixulwindow is created as part of the creation of a top-level chrome window. when the window is destroyed, it will fire a "xul-window-destroyed" notification through the
global observer service. this signals the application in case it needs to quit. method overview void addchildwindow(in nsixulwindow achild); void applychromeflags(); native code only! void assumechromeflagsarefrozen(); void center(in nsixulwindow arelative, in boolean ascreen, in boolean aalert); nsixulwindow createnewwindow(in print32 achromeflags, in nsiappshell aappshell); n...
nsMsgNavigationType
the nsmsgnavigationtype interface contains constants used for message navigation in thunderbird. for example to move forward a message, you would call: // assuming gdbview is a
global nsimsgdbview var resultid = new object(); var resultindex = new object(); var threadindex = new object(); gdbview.viewnavigate(components.interfaces.nsmsgnavigationtype.nextmessage, resultid, resultindex, threadindex, true); the nsmsgnavigationtype interface is defined as a
global variable in thunderbird: var nsmsgviewcommandtype = components.interfaces.nsmsgviewcommandtype; mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description firstmessage 1 go to the first message in the ...
nsMsgViewCommandType
last changed in gecko 1.9 (firefox 3) constants name value description markmessagesread 0 marks the selected messages as read. ...
XPCOM reference
rojects. if you're working on a module in the mozilla codebase that's compiled with the mozilla_internal_api flag set, some of these apis -- the string functions and classes in particular -- are not the ones you should be using. see the xpcom internal string guide for documentation of the internal string api used within the mozilla codebase. core xpcom functionsxpcom provides a number of
global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces.foldersthe folder classes all implement the nsimsgfolder interface. there are currently three folder classes - nslocalmailfolder, nsimapmailfolder, and nsnewsfolder. they all inherit from nsmsgdbfolder, which implements a lot of the core func...
Weak reference
t attempts to reach that part must return nsnull. sometimes our queryinterface through the weak pointer would return a pointer to the `real' interface, and sometimes it would return nsnull. we just broke com. it's clear, therefore, that the weak reference can't be aggregated to the target object. hence, we can't use queryinterface to move between them. i know this sounds more convenient, but the
global routine ns_getweakreference makes it easy to go from the target object to the weak reference; and nsiweakreference::queryreferent gives you the same functionality as queryinterface for getting back. additionally, nscomptr now supports the new key do_queryreferent to simplify life even further. how do i make a class support weak references? in javascript, just make sure that your queryinterface ...
Filelink Providers
ttings.js file have examples of this. management interface once an account has been created, it is manageable from within the preferences dialog, in the attachment pane, in the outgoing tab. the content to the right of the menulist is an iframe, pointed at a url read from the providers managementurl attribute, which should point to an xhtml page. the xhtml page should have a function in the
global scope called onloadprovider. this function is called automatically once the dom content is done loading, and is passed a single parameter - the provider instance whose data is being displayed. ...
Mail and RDF
ner. instead of having a singleton datasource that is shared across all ui components, we have per-view datasources. this allows each template-based widget to maintain view/window-specific data with each datasource. for example...??? (sorting? what else do we store?) datasources are created when each window's javascript is loaded by declaring the datasource variables in the source javascript as
global variables. in the document's onload= handler the datasources are attached to their respective widgets by setting the database property on each rdf template's parent element. reflecting data to rdf in order to have a dynamic ui that updates when the underlying content changes, a datasource must implement two key methods of reflecting data into rdf. answering queries: when rdf asks for informa...
Mail event system
agesatom, 4, 5); the dialog is one of these folder-specific listeners. in its implementation of onintpropertychanged, it uses this information to update the message count in the dialog. notifypropertychanged then broadcasts this event to the mail session: mailsession->onintpropertychanged(this, ktotalmessagesatom, 4, 5); the mail session rebroadcasts this information to each of the
global listeners that has been registered with it. for each
global listener, it calls onintpropertychanged: listener->onintpropertychanged(folder, ktotalmessagesatom, 4, 5); the folder datasource is a listener on all folders and receives this notification. in its implementation of onintpropertychanged, it notifies rdf (via the nsirdfobserver system) that the message count has changed. rdf handle...
Main Windows
items have the same id’s, and contain the same structure. a few odd pieces are missing though. for instance, the “add new toolbar” buttons from toolkit aren’t in the thunderbird version. customizetoolbarsheet.xul is a similar implementation written for osx to give a more native appearance. at compile time these files are added to the toolkit directory so that their chrome addresses are in
global, the same as firefox’s. why this is this way, i’m not sure at the moment. i assume that customizetoolbars was originally not in the toolkit, but in firefox's chrome, or that there were some special changes wanted for thunderbird's implementation at some point. regardless, it seems to still be that way now. ...
Spam filtering
training data is stored in a binary format, in a file named "training.dat". initially, the training.dat file is empty (there was discussion of shipping with a default file). on spam detection, the user can choose to move spam to a special "junk" folder. ...
Access Window
the window object represents the window of the thunderbird application as well as the currently opened tabs. you can do many things with the window object, such as accessing the height or width of the window/tab or setting its title, registering timer events and much more. the window api will give you the complete details. since window is a
global variable you can use it directly from your javascript file. check if the window is a tab or the root window window.addeventlistener("load", function(e) { alert("is root?: " + isroot()); }, false); function isroot() { if(window != window.top) return "false"; else return "true"; } the example above tells you if the window object is a reference of the application window or of one of it is a tabs. register a timer window.setinterval( func...
Folders and message lists
this object provides many of the functions required for working with folder views. we'll look at some of them below. getting the current nsimsgfolder the nsimsgfolder interface contains many methods and attributes for working with folders. to get the nsimsgfolder instance for the currently-displayed folder, just use gfolderdisplay.displayedfolder. ...
Theme Packaging
css), probably xbl, and some graphic design and aesthetic skill (...or maybe not). this document describes only how themes are packaged in order to be shown in firefox's themes window. theme file layout thunderbird themes are packaged in an xpi file with the following structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files
global/files mozapps/files ... you must have a top-level chrome.manifest file which registers the chrome for the theme (as before) and also an install.rdf manifest that specifies metadata that is displayed in the appearance section of the add-ons manager. preview.png is a preview image which will show when double-clicked on a theme in the appearance section of the add-ons manager. it can...
Thunderbird extensions
ead the thunderbird how-tos; they contain many recipes for things extensions want to do. still stuck? ask in a community communication channel on the right. feeling really brave? read the source using a fancy interface; you can often find tests that demonstrate what you're trying to achieve. the gloda database thunderbird has a subsystem called gloda. gloda stands for «
global database », and creates thunderbird-wide relations between objects. gloda provides concepts such as conversations, messages, identities, contacts. all these concepts are related : a conversation contains messages which are linked to identities (from field, to field) which are themselves part of a contact: indeed, a contact has multiple identities. typical use cases for gloda: find all messa...
Using MAPI with Thunderbird's Windows 7 developer builds
s the default mapi/mail client. if you want to set a debug build as the default mail client, you need configure it manually: in the objdir/mozilla/dist/bin directory, copy mozmapi32.dll to mozmapi32_inuse.dll and mapiproxy to mapiproxy_inuse.dll. (be sure to copy - not move - these files.) in the uninstall sub-directory of the bin directory, run these two commands: helper.exe /setasdefaultapp
global helper.exe /setasdefaultappuser create an elevated shell and register the mapi proxy.dll as a com server. (one way to create an elevated shell is to invoke the command prompt from the start menu, right click, and select run as administrator.) in the elevated shell, change to the objdir/mozilla/dist/bin directory and enter this command: regsvr32 mapiproxy_inuse.dll ...
Virtualenv
v this will fetch virtualenv from pypi and install it in your site-packages. you may need to use sudo to obtain appropriate permissions for the system. if you do not have pip or easy_install, you will need to download from pypi or clone from the github virtualenv repository, extract from the tarball (in the pypi case), and run python setup.py install. again, you may need to use sudo to install
globally. if you're running ubuntu, there is also an ubuntu package available: sudo apt-get install python-virtualenv virtualenv.py may also be run as standalone software with the same functionality. it will require it to be part of a clone of the github repository or have internet access to fetch setuptools. on mac os x, you will need xcode to use virtualenv. see this article for details. using...
Add to iPhoto
s a javascript object containing all the types and methods that framework's api. note: in a few cases, this code takes the easy way out by using ctypes.voidptr_t instead of a typed pointer. that's not really the ideal way to do things but saved some time for this simple example. some of this may change as i refine the example in the future; i'll update the article if and when that happens. some
global types there are a few
global data types used by all of our frameworks. these are declared near the top of the code: const osstatus = ctypes.int32_t; const cfindex = ctypes.long; const optionbits = ctypes.uint32_t; osstatus used to represent the status code resulting from an operation. cfindex a core foundation long integer type used to represent indexes into lists. i debated including th...
Mozilla
d to load the application. this article covers the contents of the archive and techniques for inspecting those contents. performance the articles linked to from here will help you improve performance, whether you're developing core mozilla code or an add-on. phishing: a short definition in 2014, the msci estimated an annual
global impact of phishing, and various forms of identity theft, to be as high as $5 billion usd. the impact has not improved much since. preferences the preference system makes it possible to store data for mozilla applications using a key/value pairing system. these articles provide information about how to use the preference system. productization gu...
Initialization and Destruction - Plugins
stances of a plug-in. it is called once after the last instance of the plug-in is destroyed, before releasing the plug-in library itself. void np_shutdown(void); for an example that shows both the np_initialize and np_shutdown methods, see initialize and shutdown example. initialize and shutdown example this example demonstrates the use of the np_initialize and np_shutdown methods. /* define
global variable to hold the user agent string. */ static char* useragent = null; /* initialize function. */ nperror np_initialize(void) { /* get the user agent from the browser. */ char* result = npn_useragent(); if (result == null) return nperr_out_of_memory_error; /* allocate some memory so that you can keep a copy of it. */ useragent = (char*) npn_memalloc(strlen(result) + 1); if (usera...
DOM Inspector internals - Firefox Developer Tools
iewers/d...pupoverlay.xul chrome://inspector/content/viewers/s...pupoverlay.xul chrome://inspector/content/commandoverlay.xul chrome://inspector/content/viewers/d...andoverlay.xul chrome://inspector/content/keysetoverlay.xul chrome://inspector/content/viewers/d...setoverlay.xul chrome://inspector/content/statusbaroverlay.xul chrome://
global/content/
globaloverlay.xul (note that the overlays from the viewer subdirectories—viewers/dom and viewers/stylerules—are loaded as a result of overlay directives in dom inspector's chrome manifest, rather than being explicitly imported using a xul-overlay processing instruction in the overlaid file.) inspectoroverlay.xul this imports the scripts the top-level inspector needs, incl...
Introduction to DOM Inspector - Firefox Developer Tools
included in firefox by default; instead, you must download and install it from the mozilla add-ons web site. (note: this is now a dead link.) when you first start the dom inspector, you are presented with a two-pane application window that looks a little like the main mozilla browser. like the browser, the dom inspector includes an address bar, and some of the same menus. in seamonkey additional
global menus will be available. inspecting a document when the dom inspector opens, it may or may not load an associated document, depending on the host application. if the dom inspector doesn't automatically load a document or loads a document other than the one you'd like to inspect, you can select the desired document a few different ways. inspecting content documents the inspect content docume...
Examine, modify, and watch variables - Firefox Developer Tools
e the docs for the old debugger, please visit debugger (before firefox 52). examine variables when the code has stopped at a breakpoint, you can examine its state in the variables pane of the debugger: 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...
Debugger keyboard shortcuts - Firefox Developer Tools
me. see this guide to using these keys as standard function keys. to use a remapped key as a standard function key, hold the function key down as well (so to open the profiler, use shift + function + f5). note: before firefox 66, the combination ctrl + shift + s on windows and linux or cmd + opt + s on macos would open/close the debugger. from firefox 66 and later, this is no longer the case.
global shortcuts these shortcuts work in all tools that are hosted in the toolbox. command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - reset font size ctrl + 0 cmd + 0 ctrl + 0 ...
UI Tour - Firefox Developer Tools
trace copies all items in the call stack (including their uris and line number) to the clipboard. scopes in the right-hand pane you'll see a label "scopes" with a disclosure arrow next to it. when the debugger's paused, you'll be able to expand this section to see all objects that are in scope at this point in the program: objects are organized by scope: the most local appears first, and the
global scope (window, in the case of page scripts) appears last. within the scopes pane, you can create watchpoints that pause the debugger when a value is read or assigned. ...
Debugger.Environment - Firefox Developer Tools
environment. type the type of this environment object, one of the following values: “declarative”, indicating that the environment is a declarative environment record. function calls, calls to eval, let blocks, catch blocks, and the like create declarative environment records. “object”, indicating that the environment’s bindings are the properties of an object. the
global object and dom elements appear in the chain of environments via object environments. (note that with statements have their own environment type.) “with”, indicating that the environment was introduced by a with statement. parent the environment that encloses this one (the “outer” environment, in ecmascript terminology), or null if this is the outermost environment. obje...
Debugger.Source - Firefox Developer Tools
serted; or the like. although the main script of a worker thread is introduced by a call to worker or sharedworker, these accessors always return undefined on such script’s sources. a worker’s main script source and the call that created the worker are always in separate threads, but debugger is an inherently single-threaded facility: its debuggees must all run in the same thread. since the
global that created the worker is in a different thread, it is guaranteed not to be a debuggee of the debugger instance that owns this source; and thus the creating call is never “in debuggee code”. relating a worker to its creator, and other multi-threaded debugging concerns, are out of scope for debugger. if the instance refers to webassembly code, introductionscript is the debugger.script insta...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
this menu will not be present unless you have changed the preference as explained above.) selecting the 'browser' context in the scratchpad enter the following code in the scratchpad: // this simply defines the 'debugger' constructor in this // scratchpad; it doesn't actually start debugging anything. components.utils.import('resource://gre/modules/jsdebugger.jsm'); adddebuggerto
global(window); (function () { // the debugger we'll use to observe a tab's allocation. var dbg; // start measuring the selected tab's main window's memory // consumption. this function is available in the browser // console. window.demotrackallocations = function() { dbg = new debugger; // this makes hacking on the demo *much* more // pleasant. dbg.uncaughtexceptionhook =...
DevTools API - Firefox Developer Tools
ools are debugging. a target is usually a web page (a tab), but can be other things (a chrome window, a remote tab,…). in terms of code, each tool has to provide a tooldefinition object. a definition is a js light object that exposes different information about the tool (like its name and its icon), and a build method that will be used later-on to start an instance of this tool. the gdevtools
global object provides methods to register a tool definition and to access tool instances. an instance of a tool is called a toolpanel. the toolpanel is built only when the tool is selected (not when the toolbox is opened). there is no way to "close/destroy" a toolpanel. the only way to close a toolpanel is to close its containing toolbox. all these objects implement the eventemitter interface. api gd...
All keyboard shortcuts - Firefox Developer Tools
open webide shift + f8 shift + f8 * shift + f8 storage inspector shift + f9 shift + f9 * shift + f9 open debugger 3 ctrl + shift + z cmd + opt + z ctrl + shift + z 1. unlike the other toolbox-hosted tools, this shortcut does not also close the web console. instead, it focuses on the web console's command line. to close the web console, use the
global toolbox shortcut of ctrl + shift + i (cmd + opt + i on a mac). 2. before firefox 55, the keyboard shortcut was ctrl + shift + q (cmd + opt + q on a mac). 3. starting in firefox 71. before firefox 66, the letter in this shortcut was s. toolbox these shortcuts work whenever the toolbox is open, no matter which tool is active. command windows macos linux cycle throu...
AudioWorkletNode() - Web APIs
o processing. syntax var node = new audioworkletnode(context, name); var node = new audioworkletnode(context, name, options); parameters context the 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 audioworklet
globalscope.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-defi...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
is present. signcount (4 bytes) - a signature count from the authenticator. the server will use this counter to detect authenticator cloning. attestedcredentialdata (variable length) - the credential that was created. this is only present during a navigator.credentials.create() call. this is a sequence of bytes with the following format: aaguid (16 bytes) - authenticator attestation
globally unique identifier, a unique number that identifies the model of the authenticator (not the specific instance of the authenticator) so that a relying party can understand the characteristics of the authenticator by looking up its metadata statement. credentialidlength (2 bytes) - the length of the credential id that immediately follows these bytes. credentialid (variable length) - a unique...
BaseAudioContext.decodeAudioData() - Web APIs
complete file data, not fragments of audio file data. syntax older callback syntax: baseaudiocontext.decodeaudiodata(arraybuffer, successcallback, errorcallback); newer promise-based syntax: promise<decodeddata> baseaudiocontext.decodeaudiodata(arraybuffer); parameters arraybuffer an arraybuffer containing the audio data to be decoded, usually grabbed from xmlhttprequest, windoworworker
globalscope.fetch() or filereader. successcallback a callback function to be invoked when the decoding successfully finishes. the single argument to this callback is an audiobuffer representing the decodeddata (the decoded pcm audio data). usually you'll want to put the decoded data into an audiobuffersourcenode, from which it can be played and manipulated how you want. errorcallback an optional err...
CSS Font Loading API - Web APIs
s events and interfaces for dynamically loading font resources. interfaces fontface represents a single usable font face. fontfaceset an interface loading font faces and checking their download statuses. fontfacesource a mixin providing all of the fonts used in font-related operations, unless defined otherwise. it defines the fontfacesources.fonts property available to document and worker
globalscope. fontfacesetloadevent fired whenever a fontfaceset loads. specifications specification status comment css font loading module level 3 working draft initial definition. ...
Using the CSS Painting API - Web APIs
..) paint(ctx, size, props, args) { const strokewidth = args[1]; if (strokewidth.unit === 'px') { ctx.linewidth = strokewidth.value; } else { ctx.linewidth = 1.0; } ... } it's worth noting the difference between using custom properties to control different parts of this worklet and the arguments set out here. custom properties (and in fact any properties on the style map) are
global — they can be used elsewhere within our css (and js). you may for example have a --maincolor, which will be useful for setting the color within a paint() function, but can also be used to set colors elsewhere in your css. if you wanted to change it specifically for paint, it could prove difficult. this is where the custom argument feature comes in handy. another way to think about it is that a...
CSS Painting API - Web APIs
int(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 image where a css property expects a file. access this interface through css.paintworklet. paintworklet
globalscope the
global execution context of the paintworklet. paintrenderingcontext2d implements a subset of the canvasrenderingcontext2d api. it has an output bitmap that is the size of the object it is rendering to. paintsize returns the read-only values of the output bitmap's width and height. dictionaries paintrenderingcontext2dsettings a dictionary providing a subset of canvasrenderi...
Cache - Web APIs
ode snippet also shows a best practice for versioning caches used by the service worker. though there's only one cache in this example, the same approach can be used for multiple caches. it maps a shorthand identifier for a cache to a specific, versioned cache name. the code also deletes all caches that aren't named in current_caches. in the code example, caches is a property of the serviceworker
globalscope. it holds the cachestorage object, by which it can access the cachestorage interface. this is an implementation of the windoworworker
globalscope mixin. note: in chrome, visit chrome://inspect/#service-workers and click on the "inspect" link below the registered service worker to view logging statements for the various actions the service-worker.js script is performing. var cache_version = ...
CacheStorage.delete() - Web APIs
syntax caches.delete(cachename).then(function(boolean) { // your cache is now deleted }); parameters cachename the name of the cache you want to delete. ...
CacheStorage.has() - Web APIs
syntax caches.has(cachename).then(function(boolean) { // true: your cache exists! }); parameters cachename a domstring representing the name of the cache object you are looking for in the cachestorage. return value a promise that resolves to true if the cache exists or false if not. examples the following example first checks whether a cache called 'v1' exists. if so, we add a list of assets to it. ...
CacheStorage.match() - Web APIs
cache objects are searched in creation order. note: caches.match() is a convenience method. equivalent functionality is to call cache.match() on each cache (in the order returned by caches.keys()) until a response is returned. ...
CacheStorage.open() - Web APIs
note: if the specified cache does not exist, a new cache is created with that cachename and a promise that resolves to this new cache object is returned. syntax caches.open(cachename).then(function(cache) { // do something with your cache }); parameters cachename the name of the cache you want to open. return value a promise that resolves to the requested cache object. ...
CacheStorage - Web APIs
the windowed context over https. window.caches will be undefined unless an ssl certificate is configured. maintains a mapping of string names to corresponding cache objects. use cachestorage.open() to obtain a cache instance. use cachestorage.match() to check if a given request is a key in any of the cache objects that the cachestorage object tracks. you can access cachestorage through the
global caches property. note: cachestorage always rejects with a securityerror on untrusted origins (i.e. those that aren't using https, although this definition will likely become more complex in the future.) when testing, you can get around this by checking the "enable service workers over http (when toolbox is open)" option in the firefox devtools options/gear menu. note: cachestorage.match() is a ...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
the canvasrenderingcontext2d.createlineargradient() method of the canvas 2d api creates a gradient along the line connecting two given coordinates. this method returns a linear canvasgradient. to be applied to a shape, the gradient must first be assigned to the fillstyle or strokestyle properties. 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. syntax canvasgradient ctx.createlineargradient(x0, y0, x1, y1); the createlineargradient() method is specified by four parameters defining the start and end points of the gradient line. parameters x0 the x-axis coordinate of the start point. y0 the y-axis coordinate of the start point. x1 the x-axis coordinate of...
CanvasRenderingContext2D.drawWindow() - Web APIs
of the canvas 2d api renders a region of a window into the canvas. the contents of the window's viewport are rendered, ignoring viewport clipping and scrolling. this api cannot be used by web content. it is synchronous, and as such can't be compatible with fission. if you're using it from an extension, you should switch to tabs.capturetab. if you're writing chrome code, you probably want window
globalparent.drawsnapshot from the parent process. syntax void ctx.drawwindow(window, x, y, w, h, bgcolor [, flags]); parameters window the window to render. x the x-axis coordinate of the window. y the y-axis coordinate of the window. w the width of the window. h the height of the window. bgcolor a domstring that specifies the color the canvas is filled with before the window is rende...
CanvasRenderingContext2D.save() - Web APIs
the canvasrenderingcontext2d.save() method of the canvas 2d api saves the entire state of the canvas by pushing the current state onto a stack. the drawing state the drawing state that gets saved onto a stack consists of: the current transformation matrix. the current clipping region. the current dash list. the current values of the following attributes: strokestyle, fillstyle,
globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor,
globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. syntax void ctx.save(); examples saving the drawing state this example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect wi...
Basic usage of canvas - Web APIs
itrarily 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 height attributes explicitly in the <canvas> attributes, and not using css. the id attribute isn't specific to the <canvas> element but is one of the
global html attributes which can be applied to any html element (like class for instance). it is always a good idea to supply an id because this makes it much easier to identify it in a script. the <canvas> element can be styled just like any normal image (margin, border, background…). these rules, however, don't affect the actual drawing on the canvas. we'll see how this is done in a dedicated chapt...
Clipboard - Web APIs
the clipboard interface implements the clipboard api, providing—if the user grants permission—both read and write access to the contents of the system clipboard. the clipboard api can be used to implement cut, copy, and paste features within a web application. the system clipboard is exposed through the
global navigator.clipboard property. calls to the methods of the clipboard object will not succeed if the user hasn't granted the needed permissions using the permissions api and the "clipboard-read" or "clipboard-write" permission as appropriate. note: in reality, at this time browser requirements for access to the clipboard vary significantly. please see the section clipboard availability for details. all of the clipboard api methods operate asynchronously; they return a promise whic...
Clipboard API - Web APIs
tically to pages when they are in the active tab. the clipboard-read permission must be requested, which you can do by trying to read data from the clipboard. this api is designed to supersede accessing the clipboard using document.execcommand(). accessing the clipboard instead of creating a clipboard object through instantiation, you access the system clipboard through the navigator.clipboard
global: navigator.clipboard.readtext().then( cliptext => document.queryselector(".editor").innertext += cliptext); this snippet fetches the text from the clipboard and appends it to the first element found with the class editor. since readtext() (and read(), for that matter) returns an empty string if the clipboard isn't text, this code is safe. interfaces clipboard secure context provides an i...
Console API - Web APIs
pi spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or worker
globalscope.console in workers; accessible using just console — contains many methods that you can call to perform rudimentary debugging tasks, generally focused around logging various values to the browser's web console. by far the most commonly-used method is console.log, which is used to log the current value contained inside a specific variable. interfaces console provides rudimentary debugg...
ContentIndex - Web APIs
function unregistercontent(article) { // reference registration const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) return; // unregister content from index await registration.index.delete(article.id); } all the above methods are available within the scope of the service worker. they are accessible from the worker
globalscope.self property: // service worker script self.registration.index.add(item); self.registration.index.delete(item.id); const contentindexitems = self.registration.index.getall(); specifications specification status comment unknownthe definition of 'contentindex' in that specification. unknown initial definition. ...
ContentIndexEvent.id - Web APIs
read-only id property of the contentindexevent interface is a string which identifies the deleted content index via it's id. syntax var id = contentindexevent.id; value a string representation of the deleted content index id. examples this example listens for the contentdelete event and logs the removed content index id. the contentindexevent is only available to the {domxref('serviceworker
globalscope','
global scope')}} of a serviceworker. self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'id' in that specification. unknown initial definition. ...
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. ...
DOMParser - Web APIs
ument. parser = new domparser(); doc = parser.parsefromstring(stringcontaininghtmlsource, "text/html") // returns an htmldocument, which also is a document. domparser html extension /* * domparser html extension * 2012-09-04 * * by eli grey, http://eligrey.com * public domain. * no warranty expressed or implied. use at your own risk. ...
DirectoryReaderSync - Web APIs
n(fileentry) { // print out file's name. console.log(fileentry.name); }); }); }; worker.postmessage({'cmd': 'list'}); the following is worker.js code that gets the contents of the directory. // taking care of the browser-specific prefixes. self.requestfilesystemsync = self.webkitrequestfilesystemsync || self.requestfilesystemsync; //
global for holding the list of entry file system urls. var paths = []; function getallentries(dirreader) { var entries = dirreader.readentries(); for (var i = 0, entry; entry = entries[i]; ++i) { // stash this entry's filesystem in url paths.push(entry.tourl()); // if this is a directory, traverse. if (entry.isdirectory) { getallentries(entry.createreader()); } } } //...
Document.getElementById() - Web APIs
ara'); elem.style.color = newcolor; } result usage notes the capitalization of "id" in the name of this method must be correct for the code to function; getelementbyid() is not valid and will not work, however natural it may seem. unlike some other element-lookup methods such as document.queryselector() and document.queryselectorall(), getelementbyid() is only available as a method of the
global document object, and not available as a method on all element objects in the dom. because id values must be unique throughout the entire document, there is no need for "local" versions of the function. example <!doctype html> <html> <head> <meta charset="utf-8"> <title>document</title> </head> <body> <div id="parent-id"> <p>hello word1</p> <p id="test1">hello word2</...
Document.timeline - Web APIs
donly property of the document interface represents the default timeline of the current document. this timeline is a special instance of documenttimeline that is automatically created on page load. this timeline is unique to each document and persists for the lifetime of the document including calls to document.open(). the time values for this timeline are calculated as a fixed offset from the
global clock such that the zero time corresponds to the navigationstart moment plus a signed delta known as the origin time. prior to establishing the navigationstart moment, the document timeline is inactive. note: a document timeline that is associated with a non-active document is also considered to be inactive. syntax var pagetimeline = document.timeline; var thismoment = pagetimeline.currentt...
Document: transitionstart event - Web APIs
fter any transition-delay has ended. the difference is transitionstart and transitionrun is that transitionrun fires when the transition is created (i.e. at the start of any delay) and transitionstart fires when the actual animation has begun (i.e. at the end of any delay). bubbles yes cancelable no interface transitionevent event handler property
globaleventhandlers.ontransitionstart the original target for this event is the element that had the transition applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: transitionstart. examples this code adds a listener to the transitionstart event: document.addeventliste...
Document: wheel event - Web APIs
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. ...
Using the W3C DOM Level 1 Core - Web APIs
lay the document. what does the dom level 1 core let me do? the w3c dom level 1 core allows you to change a dom tree in any way you want. this implies the ability to create any html or xml document from scratch, or to change any contents of a given html or xml document. the easiest way for web page authors to edit the dom of a document is to use javascript to access the document property of the
global object. this document object implements the document interface from the w3c's dom level 1 spec. a simple example suppose the author wants to change the header of the above document and write two paragraphs instead of one. the following script would do the job: html content <body> <input type="button" value="change this document." onclick="change()"> <h2>header</h2> <p>paragraph</p> </body> ...
Element.classList - Web APIs
oth 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. ...
Element.id - Web APIs
if the id value is not the empty string, it must be unique in a document. the id is often used with getelementbyid() to retrieve a particular element. another common case is to use an element's id as a selector when styling the document with css. note: identifiers are case-sensitive, but you should avoid creating ids that differ only in the capitalization. syntax var idstr = element.id; // get the id element.id = idstr; // set the id idstr is the identifier of the element. ...
EventTarget.addEventListener() - Web APIs
nsole.log(this.id);"><!-- `this` refers to the table; logs 'my_table' --> ... </table> note that the value of this inside a function, called by the code in the attribute value, behaves as per standard rules. this is shown in the following example: <script> function logid() { console.log(this.id); } </script> <table id="my_table" onclick="logid();"><!-- when called, `this` will refer to the
global object --> ... </table> the value of this within logid() is a reference to the
global object window (or undefined in the case of strict mode. specifying "this" using bind() the function.prototype.bind() method lets you specify the value that should be used as this for all calls to a given function. this lets you easily bypass problems where it's unclear what this will be, depending on the c...
ExtendableMessageEvent - Web APIs
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. ...
FederatedCredential - Web APIs
syntax var mycredential = new federatedcredential(init) parameters init options are: provider: a usvstring; identifying the credential provider. specifications specification status comment credential management level 1 working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. ...
FederatedCredential - Web APIs
ormation about credentials from a federated identity provider. a federated identity provider is an 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 ha...
FetchEvent.preloadResponse - Web APIs
adresponse read-only property of the fetchevent interface returns a promise that resolves to the navigation preload response if navigation preload was triggered or undefined otherwise. syntax var expectedresponse = fetchevent.preloadresponse; value a promise that resolves to a response or otherwise to undefined. example this code snippet is from the navigation preload page. the serviceworker
globalscope.onfetch event handler listens for the fetch event. when fired, pass a promise that back to the controlled page to fetchevent.respondwith(). this promise resolves to the first matching url request in the cache object. if no match is found, the code checks for a preloaded response. else it fetches a response from the network. addeventlistener('fetch', event => { event.respondwith(async func...
FetchEvent.request - Web APIs
er. this property is non-nullable (since version 46, in the case of firefox.) if a request is not provided by some other means, the constructor init object must contain a request (see fetchevent.fetchevent().) syntax var recentrequest = fetchevent.request; value a request object. example this code snippet is from the service worker fetch sample (run the fetch sample live). the serviceworker
globalscope.onfetch event handler listens for the fetch event. when fired, pass a promise that back to the controlled page to fetchevent.respondwith(). this promise resolves to the first matching url request in the cache object. if no match is found, the code fetches a response from the network. the code also handles exceptions thrown from the serviceworker
globalscope.fetch operation. note that an http...
FetchEvent - Web APIs
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. ...
Fetch basic concepts - Web APIs
is article explains some of the basic concepts of the fetch api. note: this article will be added to over time. if you find a fetch concept that you feel needs explaining better, let someone know on the mdn discussion forum, or mdn web docs room on matrix. in a nutshell at the heart of fetch are the interface abstractions of http requests, responses, headers, and body payloads, along with a
global fetch method for initiating asynchronous resource requests. because the main components of http are abstracted as javascript objects, it is easy for other apis to make use of such functionality. service workers is an example of an api that makes heavy use of fetch. fetch takes the asynchronous nature of such requests one step further. the api is completely promise-based. guard guard is a feat...
Using Fetch - Web APIs
this kind of functionality was previously achieved using xmlhttprequest. fetch provides a better alternative that can be easily used by other technologies such as service workers. fetch also provides a single logical place to define other http-related concepts such as cors and extensions to http. ...
FileSystemSync - Web APIs
operties. 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. the name must be unique across the list of exposed file systems. root readonly directoryentry the root directory of the file system. browser compatibility the compatibility table on this page is generated from structured data...
GeolocationCoordinates.longitude - Web APIs
ned by the world geodetic system 1984 specification (wgs 84). note: the zero meridian (also known as the prime meridian or the reference meridian) is not precisely the same as the greenwhich meridian that most people think of. it is, instead, the iers reference meridian, which is located 5.3 arcseconds (102 meters / 335 feet) east of the greenwich meridian. this is the same standard used by the
global positioning system (gps). examples in this simple example, we fetch the user's location and display the resulting coordinates once they're returned. javascript the javascript code below creates an event listener so that when the user clicks on a button, the location information is retrieved and displayed. let button = document.getelementbyid("get-location"); let lattext = document.getelemen...
HTMLBodyElement - Web APIs
representing the code to be called when the pageshow event is raised. windoweventhandlers.onpopstate is an eventhandler representing the code to be called when the popstate event is raised. windoweventhandlers.onrejectionhandled an eventhandler representing the code executed when the rejectionhandled event is raised, indicating that a promise was rejected and the rejection has been handled.
globaleventhandlers.onresize is an eventhandler representing the code to be called when the resize event is raised. windoweventhandlers.onstorage is an eventhandler representing the code to be called when the storage event is raised. windoweventhandlers.onunhandledrejection an eventhandler representing the code executed when the unhandledrejection event is raised, indicating that a promise was reje...
HTMLElement: input event - Web APIs
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. ...
HTMLFormElement: formdata event - Web APIs
the formdata event fires after the entry list representing the form's data is constructed. this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor. ...
HTMLFormElement: reset event - Web APIs
the reset event fires when a <form> is reset. bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface event event handler property
globaleventhandlers.onreset examples this example uses eventtarget.addeventlistener() to listen for form resets, and logs the current event.timestamp whenever that occurs. html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="reset">reset form</button> </form> <p id="log"></p> javascript function logreset(event) { log.textcontent = `form reset! time stamp: ${event.timestamp}`; } const form = document.getelementbyid('form'); const log = document.getelementbyid('log'); form.addeventlistener('reset', logreset); result s...
HTMLFormElement: submit event - Web APIs
the submit event fires when a <form> is submitted. bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface submitevent event handler property
globaleventhandlers.onsubmit note that the submit event fires on the <form> element itself, and not on any <button> or <input type="submit"> inside it. however, the submitevent which is sent to indicate the form's submit action has been triggered includes a submitter property, which is the button that was invoked to trigger the submit request. the submit event fires when the user clicks a submit button (<button> or <input type="submit">) or presses enter while editing a field (e.g. <input type="text">) in a form. the event is not sent to the form when calling ...
HTMLIFrameElement.contentWindow - Web APIs
the contentwindow property returns the window object of an htmliframeelement. you can use this window object to access the iframe's document and its internal dom. this attribute is read-only, but its properties can be manipulated like the
global window object. 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. specifications specification status comment html living standardthe definition of 'htmliframeelement: contentwindow' in that specification. living standard ...
HTMLImageElement.x - Web APIs
b.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below. let logbox = document.queryselector("pre"); let tbl = document.getelementbyid("userinfo") let log = msg => { logbox.innerhtml += `${msg}<br>`; } let cell = tbl.rows[1].cells[2]; let image = cell.queryselector("img"); log(`image's
global x: ${image.x}`); log(`image's
global y: ${image.y}`); this uses the <table>'s rows property to get a list of the rows in the table, from which it looks up row 1 (which, being a zero-based index, means the second row from the top). then it looks at that <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...
HTMLImageElement.y - Web APIs
b.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below. let logbox = document.queryselector("pre"); let tbl = document.getelementbyid("userinfo") let log = msg => { logbox.innerhtml += `${msg}<br>`; } let cell = tbl.rows[1].cells[2]; let image = cell.queryselector("img"); log(`image's
global x: ${image.x}`); log(`image's
global y: ${image.y}`); this uses the <table>'s rows property to get a list of the rows in the table, from which it looks up row 1 (which, being a zero-based index, means the second row from the top). then it looks at that <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...
HTMLMediaElement: canplay event - Web APIs
the canplay event is fired when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.oncanplay specification html5 media examples these examples add an event listener for the htmlmediaelement's canplay event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('canplay', (event) => { console.log('video can start, but not sure it will play thro...
HTMLMediaElement: canplaythrough event - Web APIs
the canplaythrough event is fired when the user agent can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.oncanplaythrough specification html5 media examples these examples add an event listener for the htmlmediaelement's canplaythrough event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('canplaythrough', (event) => { console.log('i think i can play thro...
HTMLMediaElement: durationchange event - Web APIs
the durationchange event is fired when the duration attribute has been updated. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.ondurationchange specification html5 media examples these examples add an event listener for the htmlmediaelement's durationchange event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('durationchange', (event) => { console.log('not sure why, but the duration of the video has changed.'); }); using the ondurationchange event handler property: const video = document.queryselector...
HTMLMediaElement: emptied event - Web APIs
the emptied event is fired when the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onemptied specification html5 media examples these examples add an event listener for the htmlmediaelement's emptied event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('emptied', (event) => { console.log('uh oh. the media is empty. did you call load()?'); }); ...
HTMLMediaElement: ended event - Web APIs
s stopped because the end of the media was reached or because no further data is available. this event occurs based upon htmlmediaelement (<audio> and <video>) fire ended when playback of the media reaches the end of the media. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onended specification html5 media this event is also defined in media capture and streams and web audio api examples these examples add an event listener for the htmlmediaelement's ended event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeven...
HTMLMediaElement: loadeddata event - Web APIs
the loadeddata event is fired when the frame at the current playback position of the media has finished loading; often the first frame. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onloadeddata specification html5 media note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. examples these examples add an event listener for the htmlmediaelement's loadeddata event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('loadeddata', (event) => { console.log('yay!
HTMLMediaElement: pause event - Web APIs
st commonly after the media has been paused through a call to the element's pause() method. the event is sent once the pause() method returns and after the media element's paused property has been changed to true. general info bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onpause specification html5 media examples these examples add an event listener for the htmlmediaelement's pause event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('pause', (event) => { console.log('the boolean paused property is no...
HTMLMediaElement: play event - Web APIs
the play event is fired when the paused property is changed from true to false, as a result of the play method, or the autoplay attribute. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onplay specification html5 media examples these examples add an event listener for the htmlmediaelement's play event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('play', (event) => { console.log('the boolean paused property is now false. either the ' + 'play() method was called or the autoplay attribute was toggled.'...
HTMLMediaElement: playing event - Web APIs
the playing event is fired when playback is ready to start after having been paused or delayed due to lack of data. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onplaying specification html5 media examples these examples add an event listener for the htmlmediaelement's playing event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('playing', (event) => { console.log('video is no longer paused'); }); using the onplaying event handler property: const video = document.queryselector('video'); video.onpla...
HTMLMediaElement: ratechange event - Web APIs
the ratechange event is fired when the playback rate has changed. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onratechange specification html5 media examples these examples add an event listener for the htmlmediaelement's ratechange event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('ratechange', (event) => { console.log('the playback rate changed.'); }); using the onratechange event handler property: const video = document.queryselector('video'); video.onratechange = (event) => { console.log(...
HTMLMediaElement: seeked event - Web APIs
the seeked event is fired when a seek operation completed, the current playback position has changed, and the boolean seeking attribute is changed to false. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onseeked specification html5 media examples these examples add an event listener for the htmlmediaelement's seeked event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('seeked', (event) => { console.log('video found the playback position it was looking for.'); }); using the onseeked event handler prope...
HTMLMediaElement: seeking event - Web APIs
the seeking event is fired when a seek operation starts, meaning the boolean seeking attribute has changed to true and the media is seeking a new position. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onseeking specification html5 media examples these examples add an event listener for the htmlmediaelement's seeking event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('seeking', (event) => { console.log('video is seeking a new position.'); }); using the onseeking event handler property: const video ...
HTMLMediaElement: stalled event - Web APIs
the stalled event is fired when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onstalled specification html5 media examples these examples add an event listener for the htmlmediaelement's stalled event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('stalled', (event) => { console.log('failed to fetch data, but trying.'); }); using the onstalled event handler property: const video = document.queryselector('video'); ...
HTMLMediaElement: suspend event - Web APIs
the suspend event is fired when media data loading has been suspended. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onsuspend specification html5 media examples these examples add an event listener for the htmlmediaelement's suspend event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('suspend', (event) => { console.log('data loading has been suspended.'); }); using the onsuspend event handler property: const video = document.queryselector('video'); video.onsuspend = (event) => { console.log('dat...
HTMLMediaElement: timeupdate event - Web APIs
y the frequency of the event based on the system load and the average cost of processing the event each time, so that the ui updates are not any more frequent than the user agent can comfortably handle while decoding the video. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.ontimeupdate specification html5 media examples these examples add an event listener for the htmlmediaelement's timeupdate event, then post a message when that event handler has reacted to the event firing. remember, the event frequency is dependant on the system load. using addeventlistener(): const video = document.queryselector('video'); video.addeventlisten...
HTMLMediaElement: volumechange event - Web APIs
the volumechange event is fired when the volume has changed. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onvolumechange specification html5 media examples these examples add an event listener for the htmlmediaelement's volumechange event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('volumechange', (event) => { console.log('the volume changed.'); }); using the onvolumechange event handler property: const video = document.queryselector('video'); video.onvolumechange = (event) => { console.log('t...
HTMLMediaElement: waiting event - Web APIs
the waiting event is fired when playback has stopped because of a temporary lack of data. bubbles no cancelable no interface event target element default action none event handler property
globaleventhandlers.onwaiting specification html5 media examples these examples add an event listener for the htmlmediaelement's waiting event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('waiting', (event) => { console.log('video is waiting for more data.'); }); using the onwaiting event handler property: const video = document.queryselector('video'); video.onwaiting = (event) => { ...
HTMLMediaElement - Web APIs
tead of running the normal resource selection algorithm, the source is simply set to the other element's currentsrc. this is optimized so this element gets access to all of the other element's cached and buffered data; in fact, the two elements share downloaded data, so data downloaded by either element is available to both. events inherits methods from its parent, htmlelement , defined in the
globaleventhandlers mixin. listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when the resource was not fully loaded, but not as the result of an error. canplay fired when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to st...
HTMLTimeElement.dateTime - Web APIs
mm:ss yyyy-mm-dd hh:mm:ss.mmm yyyy-mm-ddthh:mm yyyy-mm-ddthh:mm:ss yyyy-mm-ddthh:mm:ss.mmm 2013-12-25 11:12 1972-07-25 13:43:07 1941-03-15 07:06:23.678 2013-12-25t11:12 1972-07-25t13:43:07 1941-03-15t07:06:23.678 valid time-zone offset string z +hhmm +hh:mm -hhmm -hh:mm z +0200 +04:30 -0300 -08:00 valid
global date and time string any combination of a valid local date and time string followed by a valid time-zone offset string 2013-12-25 11:12+0200 1972-07-25 13:43:07+04:30 1941-03-15 07:06:23.678z 2013-12-25t11:12-08:00 valid week string yyyy-www 2013-w46 four or more ascii digits yyyy 2013, 0001 valid duration string pddthhmmss pddthhmms...
Working with the History API - Web APIs
only in its hash. in a xul document, it creates the specified xul element. in other documents, it creates an element with a null namespace uri. the replacestate() method history.replacestate() operates exactly like history.pushstate(), except that replacestate() modifies the current history entry instead of creating a new one. note that this doesn't prevent the creation of a new entry in the
global browser history. replacestate() is particularly useful when you want to update the state object or url of the current history entry in response to some user action. note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) through gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2), the passed object is serialized using json. starting in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / s...
IDBEnvironment - Web APIs
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. ...
IndexedDB API - Web APIs
idbrequest object; asynchronous operations communicate to the calling application by firing events on idbrequest objects. connecting to a database idbenvironment provides access to indexeddb functionality. it is implemented by the window and worker objects. this interface isn't part of the 2.0 specification. idbfactory provides access to a database. this is the interface implemented by the
global object indexeddb and is therefore the entry point for the api. idbopendbrequest represents a request to open a database. idbdatabase represents a connection to a database. it's the only way to get a transaction on the database. retrieving and modifying data idbtransaction represents a transaction. you create a transaction on a database, specify the scope (such as which object stores you...
Timing element visibility with the Intersection Observer API - Web APIs
n-top: 0; } .ad div { position: relative; float: right; padding: 0 4px; height: 20px; width: 120px; font-size: 14px; bottom: 30px; border: 1px solid black; background-color: rgba(255, 255, 255, 0.5); } there's nothing magic in here. it's fairly basic css. tying it together with javascript that brings us to the javascript code which makes everything work. let's start with the
global variables: let contentbox; let nextarticleid = 1; let visibleads = new set(); let previouslyvisibleads = null; let adobserver; let refreshintervalid = 0; these are used as follows: contentbox a reference to the <main> element's htmlelement object in the dom. this is where we'll insert the articles and ads. nextarticleid each article is given a unique id number; this variable tracks the ...
KeyboardEvent - Web APIs
ad only returns a number representing a system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keycode. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. events the following events are based on the keyboardevent type. they can be delivered to any object which implements
globaleventhandlers, including element, document, and window. in the list below, each event links to the documentation for the document handler for the event, which applies generally to all of the recipients. keydown a key has been pressed. keyup a key has been released. obsolete events keypress a key that normally produces a character value has been pressed. this event was highly device-d...
LocalFileSystem - Web APIs
e removed by the browser at its discretion. persistent 1 storage that stays in the browser unless the user or the app expunges it. the user must grant permission before the app can use this type of storage. methods requestfilesystem() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystem object using this
global method, window.requestfilesystem(). void requestfilesystem( in unsigned short type, in unsigned long long size, in filesystemcallback successcallback, in errorcallback errorcallback ); parameters type the storage type of the file system. the values can be either temporary or persistent. size the storage space—in bytes—that you need for your app. successcallback the success c...
MediaDevices.getUserMedia() - Web APIs
of the requested source devices cannot be used at this time. this will happen if the browsing context is insecure (that is, the page was loaded using http rather than https). it also happens if the user has specified that the current browsing instance is not permitted access to the device, the user has denied access for the current session, or the user has denied all access to user media devices
globally. on browsers that support managing media permissions with feature policy, this error is returned if feature policy is not configured to allow access to the input source(s). older versions of the specification used securityerror for this instead; securityerror has taken on a new meaning. notfounderror no media tracks of the type specified were found that satisfy the given constraints. notr...
MediaDevices - Web APIs
tion 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. getusermedia() with the user's permission through a prompt, turns on a camera and/or a microphone on the system and provides a mediastream containing a video track and/or an audio track with the input. example 'use strict'; // put variables in
global scope to make them available to the browser console. var video = document.queryselector('video'); var constraints = window.constraints = { audio: false, video: true }; var errorelement = document.queryselector('#errormsg'); navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var videotracks = stream.getvideotracks(); console.log('got stream with constraints:', const...
MediaSession - Web APIs
ons, and to report metadata 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 lis...
Metadata - Web APIs
properties modificationtime read only a date object indicating the date and time the entry was modified. ...
MouseEvent.screenX - Web APIs
syntax var x = instanceofmouseevent.screenx return value a double floating point value. early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
MouseEvent.screenY - Web APIs
syntax var y = instanceofmouseevent.screeny return value a double floating point value. early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. ...
MouseEvent - Web APIs
seevent.pagey read only the y coordinate of the mouse pointer relative to the whole document. mouseevent.region read only returns the id of the hit region affected by the event. if no hit region is affected, null is returned. mouseevent.relatedtarget read only the secondary target for the event, if there is one. mouseevent.screenx read only the x coordinate of the mouse pointer in
global (screen) coordinates. mouseevent.screeny read only the y coordinate of the mouse pointer in
global (screen) coordinates. mouseevent.shiftkey read only returns true if the shift key was down when the mouse event was fired. mouseevent.which read only the button being pressed when the mouse event was fired. mouseevent.mozpressure read only the amount of pressure applied to a touch ...
Navigator.mediaCapabilities - Web APIs
the navigator.mediacapabilities read-only property returns a mediacapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities as defined by the media capabilities api. syntax mediacapabilitiesobj =
globalobj.navigator.mediacapabilities value a mediacapabilities object. examples navigator.mediacapabilities.decodinginfo({ type : 'file', audio : { contenttype : "audio/mp3", channels : 2, bitrate : 132700, samplerate : 5200 } }).then(function(result) { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerefficient ? '' : 'not ') + 'power efficient.'...
Navigator.permissions - Web APIs
the navigator.permissions read-only property returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. syntax permissionsobj =
globalobj.navigator.permissions value a permissions object. examples navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showmap(); } else if (result.state === 'prompt') { showbuttontoenablemap(); } // don't do anything if the permission was denied. }); specification specification status comment permissions working draft initial definition. ...
Navigator - Web APIs
onstrainable 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 ui. navigator.moznotification deprecated since gecko 22 ... navigator.wakelock read only returns a wakelock interface you can use to request screen wake locks and prevent screen from dimming, turning off, or showing a screen saver. navigator.webkitnotification returns a notification object you can use to deliver notifications to the user from your web application. na...
NavigatorLanguage.languages - Web APIs
first element of the returned array. when its value changes, as the user's preferred languages are changed a languagechange event is fired on the window object. the accept-language http header in every http request from the user's browser uses the same value for the navigator.languages property except for the extra qvalues (quality values) field (e.g. en-us;q=0.8). syntax preferredlanguages =
globalobj.navigator.languages examples navigator.language //"en-us" navigator.languages //["en-us", "zh-cn", "ja-jp"] specifications specification status comment html living standardthe definition of 'navigatorlanguage: languages' in that specification. living standard initial definition ...
Node - Web APIs
endscan = false eachnode(parentnode, function(node){ if (endscan) { return false } // ignore anything which isn't a text node if (node.nodetype !== node.text_node) { return } if (typeof pattern === "string") { if (-1 !== node.textcontent.indexof(pattern)) { matches.push(node) } } else if (pattern.test(node.textcontent)) { if (!pattern.
global) { endscan = true matches = node } else { matches.push(node) } } }) return matches } for example, to find text nodes that contain typos: const typos = ["teh", "adn", "btu", "adress", "youre", "msitakes"] const pattern = new regexp("\\b(" + typos.join("|") + ")\\b", "gi") const mistakes = grep(document.body, pattern) console.log(mistakes) specifi...
NotificationAction - Web APIs
sed 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 when there is not enough space to display the notification itself. example notifications can fire notificationclick events on the serviceworker
globalscope. here a service worker shows a notification with a single "archive" action, allowing users to perform this common task from the notification without having to open the website. the user can also click the main body of the notification to open their inbox instead. self.registration.shownotification("new mail from alice", { actions: [ { action: 'archive', title: 'archive' ...
Notifications API - Web APIs
o find out more about using notifications in your own app, read using the notifications api. notifications interfaces notification defines a notification object. service worker additions serviceworkerregistration includes the serviceworkerregistration.shownotification() and serviceworkerregistration.getnotifications() method, for controlling the display of notifications. serviceworker
globalscope includes the serviceworker
globalscope.onnotificationclick handler, for firing custom functions when a notification is clicked. notificationevent a specific type of event object, based on extendableevent, which represents a notification that has fired. specifications specification status comment notifications api living standard living standard ...
PaintWorklet - Web APIs
supported. <style> textarea { background-image: url(checkerboard); background-image: paint(checkerboard); } </style> <textarea></textarea> you can also use the @supports at-rule. @supports (background: paint(id)) { background-image: paint(checkerboard); } specifications specification status comment css painting api level 1the definition of 'paintworklet
globalscope' in that specification. working draft initial definition. ...
PasswordCredential - Web APIs
syntax var mycredential = new passwordcredential(passwordcredentialdata) var mycredential = new passwordcredential(htmlformelement) parameters either of the following: passwordcredentialdata a passwordcredentialdata dictionary containing the following fields: iconurl: (optional) the url of a user's avatar image. id: the id of the user signing in. name: (optional) the name of the user signing in. ...
PasswordCredential - Web APIs
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. ...
performance.now() - Web APIs
if you cross-origin isolate your document using the cross-origin-opener-policy and cross-origin-embedder-policy headers: cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp these headers ensure a top-level document does not share a browsing context group with cross-origin documents. coop process-isolates your document and potential attackers can't access to your
global object if they were opening it in a popup, preventing a set of cross-origin attacks dubbed xs-leaks. specifications specification status comment high resolution time level 2the definition of 'performance.now()' in that specification. recommendation stricter definitions of interfaces and types. high resolution timethe definition of 'performance.now()' in th...
Performance API - Web APIs
ceresourcetiming provides methods and properties for retrieving and analyzing detailed network timing data regarding the loading of an application's resources. specifications specification status comment high resolution time recommendation initial definition. high resolution time level 2 recommendation adds performance attribute on window and worker
globalscope. high resolution time level 3 editor's draft add timeorigin property to performance interface. frame timing draft adds performanceframetiming interface. navigation timing recommendation adds the performancetiming and performancenavigation interfaces. adds timing and navigation properties to the performance interface. navigation timing lev...
Permissions.query() - Web APIs
syntax navigator.permissions.query(permissiondescriptor).then(function(permissionstatus) { ... }) parameters permissiondescriptor an object that sets options for the query operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. an up-to-date list of permission names can be found in the spec under the permissionname enum, but bear in mind that the actual permissions supported by browsers is currently much smaller than this. ...
Permissions.revoke() - Web APIs
var revokepromise = navigator.permissions.revoke(descriptor); parameters descriptor an object based on the permissiondescriptor dictionary that sets options for the operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. ...
Using the Permissions API - Web APIs
out on a google map: you can run the example live, or view the source code on github. most of the code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts. accessing the permissions api the navigator.permissions property has been added to the browser to allow access to the
global permissions object. this object will eventually include methods for querying, requesting, and revoking permissions, although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using permissions.query(). depending on ...
PromiseRejectionEvent() - Web APIs
the promiserejectionevent() constructor returns a newly created promiserejectionevent, which represents events fired when a javascript promise is rejected. with promise rejection events, it becomes possible to detect and report promises which fail and whose failures go unnoticed. it also becomes easier to write a
global handler for errors. there are two types of promiserejectionevent: unhandledrejection is sent by the javascript runtime when a promise is rejected but the rejection goes unhandled. a rejectionhandled event is emitted if a promise is rejected but the rejection is caught by a rejection handler.. syntax promiserejectionevent = promiserejectionevent(type, options); parameters the promiserejectionevent() constructor also inherits parameters from event(). type a string repres...
PromiseRejectionEvent - Web APIs
these events are particularly useful for telemetry and debugging purposes. for details on promise rejection events, see promise rejection events in using promises. ...
PublicKeyCredential.rawId - Web APIs
ject containing the identifier of the credentials. the publickeycredential.id property is a base64url encoded version of this identifier. note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax rawid = publickeycredential.rawid value a arraybuffer containing the identifier of the credentials. this identifier is expected to be
globally unique and is appointed for the current publickeycredential and its associated authenticatorassertionresponse. examples var options = { challenge: new uint8array(26) /* from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id: new uint8array(26), /* to be changed for each user */ name: "jdoe@example.com", displayname: "john doe", },...
PublicKeyCredential - Web APIs
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 identifier for this publickeycredential. this identifier can be used to look up credentials for future calls to credentialscontainer.get. publickeycredential.response read only secure context an instance of an authenticatorresponse object. it is either of type authenticatorattestationresponse if the publickeycredential was the results of a navigator.credentials.create() call, or of ty...
PushEvent - Web APIs
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. ...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
nt will occur at least once, and may occur more than once if the ice agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. the event handler can determine the current 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.geteleme...
Range() - Web APIs
syntax range = new range() example in this example we create a new range with the range() constructor, and set its beginning and end positions using the range.setstartbefore() and range.setendafter() methods. we then select the range using window.getselection() and selection.addrange(). ...
Range - Web APIs
y returns the node within which the range ends. range.endoffset read only returns a number representing where in the endcontainer the range ends. range.startcontainer read only returns the node within which the range starts. range.startoffset read only returns a number representing where in the startcontainer the range starts. constructor range() returns a range object with the
global document as its start and end. methods there are no inherited methods. range.setstart() sets the start position of a range. range.setend() sets the end position of a range. range.setstartbefore() sets the start position of a range relative to another node. range.setstartafter() sets the start position of a range relative to another node. range.setendbefore() sets the end position o...
Request() - Web APIs
st (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). errors type description typeerror since firefox 43, request() will throw a typeerror if the url has credentials, such as http://user:password@example.com. example in our fetch request example (see fetch request live) we create a new request object using the constructor, then fetch it using a
globalfetch.fetch call. since we are fetching an image, we run body.blob on the response to give it the proper mime type so it will be handled properly, then create an object url of it and display it in an <img> element. var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { return response.blob(); }).then(function(respons...
ServiceWorkerRegistration.showNotification() - Web APIs
you can also retrieve details of the notifications that have been fired from the current service worker using serviceworkerregistration.getnotifications(). specifications specification status comment notifications apithe definition of 'shownotification()' in that specification. living standard initial definition. ...
Streams API - Web APIs
queuing strategy that can be used when constructing streams. countqueuingstrategy provides a built-in chunk counting queuing strategy that can be used when constructing streams. extensions to other apis request when a new request object is constructed, you can pass it a readablestream in the body property of its requestinit dictionary. this request could then be passed to a windoworworker
globalscope.fetch() to commence fetching the stream. body the response body returned by a successful fetch request is exposed by default as a readablestream, and can have a reader attached to it, etc. bytestream-related interfaces important: these are not implemented anywhere as yet, and questions have been raised as to whether the spec details are in a finished enough state for them to be impleme...
TextTrack: cuechange event - Web APIs
the cuechange event fires when a texttrack has changed the currently displaying cues. the event is fired at both the texttrack and at the htmltrackelement in which it's being presented, if any. ...
Multi-touch interaction - Web APIs
ation uses <div> elements to represent four touch areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: 1px solid black; } #target2 { background: white; border: 1px solid black; } #target3 { background: white; border: 1px solid black; } #target4 { background: white; border: 1px solid black; } </style>
global state tpcache is used to cache touch points for processing outside of the event where they were fired. // log events flag var logevents = false; // touch point cache var tpcache = new array(); register event handlers event handlers are registered for all four touch event types. the touchend and touchcancel event types use the same handler. function set_handlers(name) { // install event ha...
WakeLock - Web APIs
methods request requests a wakelocksentinel object, which returns a promise that resolves with a wakelocksentinel object. examples the following asynchronous function requests a wakelocksentinel object. the wakelock.request method is wrapped in a try...catch statement to account for if the browser refuses the request for any reason. ...
WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
without creating a buffer filled with only one value or having to create a separate shader which uses a uniform for the color. this value will be used if a bound array buffer has not been enabled with enablevertexattribarray. attributes may be matrices, in which case columns of the matrix must be loaded into successive vertex attribute slots. the values set with vertexattribpointer are context-
global, i.e. they aren't part of the shader state (like generix vertex attribute indexes to shader variable bindings) and aren't part of the vertex array object state (like enabled vertex attribute arrays). the only way to change the values is by calling this function again. examples const a_foobar = gl.getattriblocation(shaderprogram, 'foobar'); //either set each component individually: gl.vertexattr...
Clearing with colors - Web APIs
we are giving the event // handler a name (setupwebgl) so that we can refer to the // function object within the function itself. window.addeventlistener("load", function setupwebgl (evt) { "use strict" // cleaning after ourselves. the event handler removes // itself, because it only needs to run once. window.removeeventlistener(evt.type, setupwebgl, false); // references to th...
Data in WebGL - Web APIs
vertex shader to the fragment shader. this is commonly used to share a vertex's normal vector after it has been computed by the vertex shader. <<how to use>> uniforms uniforms are set by the javascript code and are available to both the vertex and fragment shaders. they're used to provide values that will be the same for everything drawn in the frame, such as lighting positions and magnitudes,
global transformation and perspective details, and so forth. <<add details>> buffers <<add information>> textures <<add information>> ...
Matrix math for the web - Web APIs
o create matrices and how to use them with css transforms and the matrix3d transform type. while this article uses css to simplify explanations, matrices are a core concept used by many different technologies including webgl, the webxr (vr and ar) api, and glsl shaders. this article is also available as an mdn content kit. the live examples use a collection of utility functions available under a
global object named mdn. transformation matrices there are many types of matrices, but the ones we are interested in are the 3d transformation matrices. these matrices consist of a set of 16 values arranged in a 4x4 grid. in javascript, it is easy to represent a matrix as an array. let's begin by considering the identity matrix. this is a special transformation matrix which functions much like the nu...
Adding 2D content to a WebGL context - Web APIs
t shaderprogram = initshaderprogram(gl, vssource, fssource); after we've created a shader program we need to look up the locations that webgl assigned to our inputs. in this case we have one attribute and two uniforms. attributes receive values from buffers. each iteration of the vertex shader receives the next value from the buffer assigned to that attribute. uniforms are similar to javascript
global variables. they stay the same value for all iterations of a shader. since the attribute and uniform locations are specific to a single shader program we'll store them together to make them easy to pass around const programinfo = { program: shaderprogram, attriblocations: { vertexposition: gl.getattriblocation(shaderprogram, 'avertexposition'), }, uniformlocations: { ...
Animating textures in WebGL - Web APIs
o make sure the video is playing and the time has been updated. we need both of these checks because it will produce an error if you upload a video to webgl that has no data available yet. checking for both of these events guarantees there is data available and it's safe to start uploading video to a webgl texture. in the code above, we confirm whether we got both of those events; if so, we set a
global variable, copyvideo, to true to indicate that it's safe to start copying the video to a texture. and finally, we set the src attribute to start and call play to start loading and playing the video. the video must be loaded from a secure source in order to be used to provide texture data to webgl. that means that you'll not only need to deploy code like using a secure web server, but you'll need...
WebGL model view projection - Web APIs
he proper spaces to display it on the screen. it assumes a knowledge of basic matrix math using translation, scale, and rotation matrices. it explains the three core matrices that are typically used when composing a 3d scene: the model, view and projection matrices. note: this article is also available as an mdn content kit. it also uses a collection of utility functions available under the mdn
global object. the model, view, and projection matrices individual transformations of points and polygons in space in webgl are handled by the basic transformation matrices like translation, scale, and rotation. these matrices can be composed together and grouped in special ways to make them useful for rendering complicated 3d scenes. these composed matrices ultimately move the original model data ar...
Lifetime of a WebRTC session - Web APIs
realized that it would take longer to complete the transition than 32-bit addresses would last, so other smart people came up with a way to let multiple computers share the same 32-bit ip address. network address translation (nat) is a standard which supports this address sharing by handling routing of data inbound and outbound to and from devices on a lan, all of which are sharing a single wan (
global) ip address. the problem for users is that each individual computer on the internet no longer necessarily has a unique ip address, and, in fact, each device’s ip address may change not only if they move from one network to another, but if their network’s address is changed by nat and/or dhcp. for developers trying to do peer-to-peer networking, this introduces a conundrum: without a unique i...
Taking still photos with WebRTC - Web APIs
re will appear in this box."> </div> that's all of the relevant html. the rest is just some page layout fluff and a bit of text offering a link back to this page. the javascript code now let's take a look at the javascript code. we'll break it up into a few bite-sized pieces to make it easier to explain. initialization we start by wrapping the whole script in an anonymous function to avoid
global variables, then setting up various variables we'll be using. (function() { var width = 320; // we will scale the photo width to this var height = 0; // this will be computed based on the input stream var streaming = false; var video = null; var canvas = null; var photo = null; var startbutton = null; those variables are: width whatever size the incoming video is, we'r...
Using DTMF with WebRTC - Web APIs
than having each be a truly separate entity.</p> <audio id="audio" autoplay controls></audio><br/> <button name="dial" id="dial">dial</button> <div class="log"></div> javascript let's take a look at the javascript code next. keep in mind that the process of establishing the connection is somewhat contrived here; you normally don't build both ends of the connection in the same document.
global variables first, we establish
global variables. let dialstring = "12024561111"; let callerpc = null; let receiverpc = null; let dtmfsender = null; let hasaddtrack = false; let mediaconstraints = { audio: true, video: false }; let offeroptions = { offertoreceiveaudio: 1, offertoreceivevideo: 0 }; let dialbutton = null; let logelement = null; these are, in order: dialstring the...
Movement, orientation, and motion: A WebXR example - Web APIs
ed time and stored into the constants xrotationfortime, yrotationfortime, and zrotationfortime. after enabling and configuring depth testing, we check the value of the enablerotation constant to see if rotation of the cube is enabled; if it is, we use glmatrix to rotate the cubematrix (representing the cube's current orientation relative to the world space) around the three axes. with the cube's
global orientation established, we then multiply that by the inverse of the view's transform matrix to get the final model view matrix—the matrix to apply to the object to both rotate it for its animation purposes, but to also move and reorient it to simulate the viewer's motion through the space. then the view's normal matrix is computed by taking the model view matrix, inverting it, and transposing...
WebXR performance guide - Web APIs
eraction of the loop is completed, the memory is released. a simple change can optimize this significantly: const vertexlist = ... const normalmatrix = mat4.create(); const modelviewmatrix = mat4.create(); function drawscene(gl, view, programinfo, buffers, texture, deltatime) { ... for (object in scene) { ... } } now, instead of allocating variables every loop iteration, we're using
global constants(or class member constants). this has multiple benefits: the memory allocated for each value or structure will not need to be reallocated every frame. this reduces the potential for triggering garbage collection, and optimizes memory use. you can't accidentally delete the objects that contain your vectors and matrices, since they're constants. you can, however, still replace the con...
Rendering and the WebXR frame animation callback - Web APIs
to do so, the first thing you need to do is to compute the time that has elapsed since the last frame was rendered: let lastframetime = 0; function drawframe(time, frame) { /* ... schedule next frame, prepare the buffer, etc ... */ const deltatime = (time - lastframetime) * 0.001; lastframetime = time; for (let view of pose.views) { /* render each view */ } } this maintains a
global (or an object property) called lastframetime which contains the previous frame's time of rendering. in this case, since the time values are stored in milliseconds, we multiply by 0.001 to convert the time into seconds. in some cases, this saves time later. in other situations, you need the time in milliseconds, so you wouldn't need to change anything. with the elapsed time in hand, your renderin...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
then a new session is established and a reference space created to become the new world reference space. finally, the saved viewerpose is converted to the new world space's coordinate system by calling the new reference system's getoffsetreferencespace() method. with this in hand, we can resume rendering the scene as usual, with the viewer's perspective unaffected. converting b...
Controlling multiple parameters with ConstantSourceNode - Web APIs
vertical-align: middle; } .right span { vertical-align: middle; } .right input { vertical-align: baseline; } .left { width: 50%; position: absolute; left: 0; display: table-cell; vertical-align: middle; } .left span, .left input { vertical-align: middle; } javascript now let's take a look at the javascript code, a piece at a time. setting up let's start by looking at the
global variable initialization. let context = null; let playbutton = null; let volumecontrol = null; let oscnode1 = null; let oscnode2 = null; let oscnode3 = null; let constantnode = null; let gainnode1 = null; let gainnode2 = null; let gainnode3 = null; let playing = false; these variables are: context the audiocontext in which all the audio nodes live. playbutton and volumecontrol reference...
Window.close() - Web APIs
script. note also that close() has no effect when called on window objects returned by htmliframeelement.contentwindow. syntax window.close(); examples closing a window opened with window.open() this example shows a method which opens a window and a second one which closes the window; this demonstrates how to use window.close() to close a window opened by calling window.open(). ...
Window.controllers - Web APIs
the controllers property of the window interface returns the xul controllers of the chrome window. syntax controllers = window.controllers controllers is an object of type xulcontrollers (nsicontrollers). specification xul-specific. not part of specification. by default, a window's controller contains the code that supports the
global window commands. chrome code can add controllers (to be used in conjunction with the godocommand and goupdatecommand functions in
globaloverlay.js). however, the added controllers must be explicitly removed when the window is unloaded, as this is not done automatically. each missing removal can cause bug 415775: assertion: xpconnect is being called on a scope without a 'components' property! ...
Window.crypto - Web APIs
this object allows web pages access to certain cryptographic related services. although the property itself is read-only, all of its methods (and the methods of its child object, subtlecrypto) are not read-only, and therefore vulnerable to attack by polyfill. although window.crypto is available on all windows, the returned crypto object only has one usable feature in insecure contexts: the getrandomvalues() method. in general, you should use this api only in secure contexts. ...
window.dump() - Web APIs
ot specified then the output goes to stderr. output from dump() is not sent to the browser console. output can be sent to the browser console using console.log(). privileged code can also use components.utils.reporterror and nsiconsoleservice to log messages to the error console/browser console. dump() is also available to xpcom components implemented in javascript, even though window is not the
global object in components. it is also explicitly made available in sandboxes. however, this use of dump is not affected by the preference mentioned below -- it will always be shown. it is therefore advisable to either check this preference yourself or use a debugging preference of your own to make sure you don't send lots of debugging content to a user's console when they might not be interested in it...
Window.getComputedStyle() - Web APIs
the element's style property. however, the two objects have different purposes: the object from getcomputedstyle is read-only, and should be used to inspect the element's style — including those set by a <style> element or an external stylesheet. the element.style object should be used to set styles on that element, or inspect styles directly added to it from javascript manipulation or the
global style attribute. the first argument must be an element. non-elements, like a text node, will throw an error. defaultview in many code samples, getcomputedstyle is used from the document.defaultview object. in nearly all cases, this is needless, as getcomputedstyle exists on the window object as well. it's likely the defaultview pattern was a combination of folks not wanting to write a testing...
Window.isSecureContext - Web APIs
the window.issecurecontext read-only property indicates whether a context is capable of using features that require secure contexts. syntax var issecure = window.issecurecontext examples feature detection you 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.register("/offline-worker.js").then(function () { ... }); } specifications specification status comment secure contexts candidate recommendation initial definition. ...
Window: languagechange event - Web APIs
the languagechange event is fired at the
global scope object when the user's preferred language changes. bubbles no cancelable no interface event event handler onlanguagechange examples you can use the languagechange event in an addeventlistener method: window.addeventlistener('languagechange', function() { console.log('languagechange event detected!'); }); or use the onlanguagechange event handler property: window.onlanguagechange = function(event) { console.log('languagechange event detected!'); }; specification specification status html living standardthe definition of 'languagechange' in that specification. living standard ...
Window.openDialog() - Web APIs
window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). returning values from the dialog since window.close() erases all properties associated with the dialog window (i.e. the variables specified in the javascript code which gets loaded from the dialog), it is not possible to pass return values back past the close operation using
globals (or any other constructs). to be able to pass values back to the caller, you have to supply some object via the extra parameters. you can then access this object from within the dialog code and set properties on it, containing the values you want to return or preserve past the window.close() operation. var retvals = { address: null, delivery: null }; opendialog("http://example.tld/zzz.xul", "d...
Window: rejectionhandled event - Web APIs
this can be used in debugging and for general application resiliency, in tandem with the unhandledrejection event, which is sent when a promise is rejected but there is no hander for the rejection. ...
Window: unhandledrejection event - Web APIs
this is useful for debugging and for providing fallback error handling for unexpected situations. bubbles no cancelable yes interface promiserejectionevent event handler property onunhandledrejection usage notes allowing the unhandledrejection event to bubble will eventually result in an error message being output to the console. you can prevent this by calling preventdefault() on the promiserejectionevent; see preventing default handling below for an example. ...
WindowEventHandlers.onbeforeunload - Web APIs
ered on the subsequent return visit and update the content as desired. specifications the event was originally introduced by microsoft in internet explorer 4 and standardized in the html5 specification. specification status comment html living standardthe definition of 'onbeforeunload' in that specification. living standard html 5.1the definition of '
globaleventhandlers' in that specification. recommendation html5the definition of '
globaleventhandlers' in that specification. recommendation ...
WindowEventHandlers.onunload - Web APIs
ventlistener("unload", function(event) { ... }); window.onunload = function(event) { ... }; typically, it is better to use window.addeventlistener() and the unload event, instead of onunload. specifications specification status comment html living standardthe definition of 'onunload' in that specification. living standard html 5.1the definition of '
globaleventhandlers' in that specification. recommendation html5the definition of '
globaleventhandlers' in that specification. recommendation ...
WindowEventHandlers - Web APIs
terfaces 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 worker
globalscope 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 eventhandler representing the code to be called when the beforeunload event is...
Worker() - Web APIs
orker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the dedicatedworker
globalscope representing the scope of the worker, which is mainly useful for debugging purposes. exceptions a securityerror is raised if the document is not allowed to start workers, e.g. if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the worker script is incorrect. it should always be text/javascript. a syntaxerror is r...
Worker: message event - Web APIs
the message event is fired on a worker object when the worker's parent receives a message from its worker (i.e. when the worker sends a message using dedicatedworker
globalscope.postmessage()). bubbles no cancelable no interface messageevent event handler property onmessage examples this code creates a new worker and listens to messages from it using addeventlistener(): const worker = new worker("static/scripts/worker.js"); worker.addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) }); alternatively, it could listen using the onmessage event handler property: const worker = new worker("static/scripts/worker.js"); worker.onmessage = (event) => { console.log(`received message from ...
Worker.prototype.postMessage() - Web APIs
the postmessage() method of the worker interface sends a message to the worker's inner scope. this accepts a single parameter, which is the data to send to the worker. the data may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. the worker can send back information to the thread that spawned it using the dedicatedworker
globalscope.postmessage method. syntax worker.postmessage(message, [transfer]); parameters message the object to deliver to the worker; this will be in the data field in the event delivered to the dedicatedworker
globalscope.onmessage handler. this may be any value or javascript object handled by the structured clone algorithm, which includes cyclical references. if the message parameter is not provided, a t...
Worker - Web APIs
ties 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 message is sent to the parent document from the worker via dedicatedworker
globalscope.postmessage. the message is stored in the event's data property. worker.onmessageerror is an eventhandler representing the code to be called when the messageerror event is raised. methods inherits methods from its parent, eventtarget, and implements methods from abstractworker. worker.postmessage() sends a message — consisting of any javascript object — to the worker's inner ...
WorkerLocation - Web APIs
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. ...
WorkerNavigator - Web APIs
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. ...
XRSession.requestAnimationFrame() - Web APIs
again. this can be done from within the callback itself. the callback takes two parameters as inputs: an xrframe describing the state of all tracked objects for the session, and a time stamp you can use to compute any animation updates needed. you can cancel a previously scheduled animation by calling cancelanimationframe(). note: despite the obvious similarities between these methods and the
global requestanimationframe() function provided by the window interface, you must not treat these as interchangeable. there is no guarantee that the latter will work at all while an immersive xr session is underway. syntax requestid = xrsession.requestanimationframe(animationframecallback); parameters animationframecallback a function which is called before the next repaint in order to allow...
msWriteProfilerMark - Web APIs
riteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being rendered, building a waterfall view for every one of our impressions showing latency per object, which can be useful for more accurately debugging real users perf issues. internet explorer 10. this method is also available in the web worker
global scope. for windows xp, this method sends an event to an event tracing session with traceevent; for systems after windows xp, this method writes an event with eventwrite. the event includes a pointer to a window object, current markup, and the event name passed as bstrprofilermarkname. the bstrprofilermarkname property has a 32-character limit when called from script. this method is useful to ...
ARIA: dialog role - Accessibility
on the screen, it's not possible to interact with any page content outside the dialog. in other words, the main application ui or page content is considered to be temporarily disabled as long as the modal dialog 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...
Basic form hints - Accessibility
the <div>. <button aria-describedby="descriptionrevert">revert</button> <div id="descriptionrevert">reverting will undo any changes that have been made since the last save.</div> note: the aria-describedby attribute is used for other purposes, in addition to form controls. required and invalid fields note: now that required is available to more than 97% of users
globally, it is no longer recommended that you use both required and aria-required. web developers typically use presentational strategies to indicate required or invalid fields. assistive technologies (ats) cannot necessarily infer this information from the presentation. aria provides attributes for indicating that form controls are required or invalid: the aria-required property can be applied to...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
visible at the same time, because selected listbox items use the system highlight color, even when the listbox itself is not focused. other problems occur when a piece of static text which has the same color background, which will cause that text to be repeated each time the focus or highlight moves. at least one major screen reader has a feature to turn highlight tracking off, but that's only a
global setting, and turning off highlight tracking
globally also turns off the speaking of menu items. solution: don't use the system highlight color for items that you don't want spoken when the highlight or focus moves. to fix this for standard listboxes, use owner drawn list items, so that you can change the highlight color when an item doesn't have focus. for listboxes that are not focused, use a d...
Keyboard-navigable JavaScript widgets - Accessibility
ypically composed of <div> and <span> elements that do not, by nature, offer the same keyboard functionality that their desktop counterparts do. this document describes techniques to make javascript widgets accessible with the keyboard. using tabindex by default, when people use the tab key to browse a webpage, only interactive elements (like links, form controls) get focused. with the tabindex
global attribute, authors can make other elements focusable, too. when set to 0, the element becomes focusable by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the...
-moz-context-properties - CSS: Cascading Style Sheets
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. stroke-opacity expose the stoke-opacity value set on th...
-moz-float-edge - CSS: Cascading Style Sheets
the non-standard -moz-float-edge css property specifies whether the height and width properties of the element include the margin, border, or padding thickness. /* keyword values */ -moz-float-edge: border-box; -moz-float-edge: content-box; -moz-float-edge: margin-box; -moz-float-edge: padding-box; /*
global values */ -moz-float-edge: inherit; -moz-float-edge: initial; -moz-float-edge: unset; syntax values border-box the height and width properties include the content, padding and border but not the margin. content-box the height and width properties include the content, but not the padding, border or margin. margin-box the height and width properties include the content, padding, border and margin. padding-box the height and width properties include the content and pad...
-moz-image-region - CSS: Cascading Style Sheets
for certain xul elements and pseudo-elements that use an image from the list-style-image property, this property specifies a region of the image that is used in place of the whole image. this allows elements to use different pieces of the same image to improve performance. /* keyword value */ -moz-image-region: auto; /* <shape> value */ -moz-image-region: rect(0, 8px, 4px, 4px); /*
global values */ -moz-image-region: inherit; -moz-image-region: initial; -moz-image-region: unset; the syntax is similar to the clip property. all four values are relative to the upper left corner of the image. note: for a system that works on any background, see -moz-image-rect(). syntax values auto automatically defines the region of the image to use. <shape> a shape defining the part of th...
-moz-outline-radius - CSS: Cascading Style Sheets
in mozilla applications like firefox, the -moz-outline-radius css shorthand property can be used to give an element's outline rounded corners. /* one value */ -moz-outline-radius: 25px; /* two values */ -moz-outline-radius: 25px 1em; /* three values */ -moz-outline-radius: 25px 1em 12%; /* four values */ -moz-outline-radius: 25px 1em 12% 4mm; /*
global values */ -moz-outline-radius: inherit; -moz-outline-radius: initial; -moz-outline-radius: unset; constituent properties this property is a shorthand for the following css properties: -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright syntax values elliptical outlines and <percentage> values follow the syntax described in border-radius. one, two, thr...
-moz-user-input - CSS: Cascading Style Sheets
note: -moz-user-input was one of the proposals leading to the proposed css 3 user-input property, which has not yet reached candidate recommendation (call for implementations). ...
-webkit-border-before - CSS: Cascading Style Sheets
the -webkit-border-before css property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet. /* border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /*
global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: unset; -webkit-border-before can be used to set the values for one or more of: -webkit-border-before-width, -webkit-border-before-style, and -webkit-border-before-color. it maps to a physical border depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the value...
-webkit-box-reflect - CSS: Cascading Style Sheets
the -webkit-box-reflect css property lets you reflect the content of an element in one specific direction. /* direction values */ -webkit-box-reflect: above; -webkit-box-reflect: below; -webkit-box-reflect: left; -webkit-box-reflect: right; /* offset value */ -webkit-box-reflect: below 10px; /* mask value */ -webkit-box-reflect: below 0 linear-gradient(transparent, white); /*
global values */ -webkit-box-reflect: inherit; -webkit-box-reflect: initial; -webkit-box-reflect: unset; note: this feature is not intended to be used by web sites. to achieve reflection on the web, the standard way is to use the css element() function. syntax values above, below, right, left are keywords indicating in which direction the reflection is to happen. <length> indicates the size of the r...
-webkit-line-clamp - CSS: Cascading Style Sheets
end. note: this property was originally implemented in webkit and has some issues. it got standardized for legacy support. the css overflow module level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. syntax /* keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /*
global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none this value specifies that the content wonʼt be clamped. <integer> this value specifies the number of lines after which the content will be clamped. it must be greater than 0. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typeby co...
-webkit-mask-attachment - CSS: Cascading Style Sheets
ask-image is specified, -webkit-mask-attachment determines whether the mask image's position is fixed within the viewport, or scrolls along with its containing block. /* keyword values */ -webkit-mask-attachment: scroll; -webkit-mask-attachment: fixed; -webkit-mask-attachment: local; /* multiple values */ -webkit-mask-attachment: scroll, local; -webkit-mask-attachment: fixed, local, scroll; /*
global values */ -webkit-mask-attachment: inherit; -webkit-mask-attachment: initial; -webkit-mask-attachment: unset; syntax values scroll if scroll is specified, the mask image scrolls within the viewport along with the block that contains the mask image. fixed if fixed is specified, the mask image does not scroll with its containing element, instead remaining stationary within the viewport. ...
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
the -webkit-mask-repeat-x property specifies whether and how a mask image is repeated (tiled) horizontally. /* keyword values */ -webkit-mask-repeat-x: repeat; -webkit-mask-repeat-x: no-repeat; -webkit-mask-repeat-x: space; -webkit-mask-repeat-x: round; /* multiple values */ -webkit-mask-repeat-x: repeat, no-repeat, space; /*
global values */ -webkit-mask-repeat-x: inherit; -webkit-mask-repeat-x: initial; -webkit-mask-repeat-x: unset; syntax values repeat the mask image is repeated both horizontally and vertically. no-repeat the mask image is not repeated; only one copy of the mask image is drawn. the remainder of the masked element's content is not displayed. repeat the mask image is repeated both horizontally and vertically. space the image is repeated as much as pos...
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
the -webkit-mask-repeat-y property sets whether and how a mask image is repeated (tiled) vertically. /* keyword values */ -webkit-mask-repeat-y: repeat; -webkit-mask-repeat-y: no-repeat; -webkit-mask-repeat-y: space; -webkit-mask-repeat-y: round; /* multiple values */ -webkit-mask-repeat-y: repeat, no-repeat, space; /*
global values */ -webkit-mask-repeat-y: inherit; -webkit-mask-repeat-y: initial; -webkit-mask-repeat-y: unset; syntax values repeat the mask image is repeated vertically. no-repeat the mask image is not repeated vertically; only one copy of the mask image is drawn in vertical direction. the vertical remainder of the masked element's content is not displayed. repeat the mask image is repeated vertically. space the image is repeated as much as possible wit...
-webkit-print-color-adjust - CSS: Cascading Style Sheets
the -webkit-print-color-adjust property is a non-standard css extension that can be used to force printing of background colors and images in browsers based on the webkit engine. /* keyword values */ -webkit-print-color-adjust: economy; -webkit-print-color-adjust: exact; /*
global values */ -webkit-print-color-adjust: inherit; -webkit-print-color-adjust: initial; -webkit-print-color-adjust: unset; syntax the -webkit-print-color-adjust property is specified as one of the keyword values listed below. values economy normal behavior. background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog. exact background colors and images of the element to which this rule is applied are always printed, user's print settings are...
-webkit-text-fill-color - CSS: Cascading Style Sheets
the -webkit-text-fill-color css property specifies the fill color of characters of text. if this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /*
global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; syntax values <color> the foreground fill color of the element's text content. formal definition initial valuecurrentcolorapplies toall elementsinheritedyescomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb...
-webkit-text-stroke-color - CSS: Cascading Style Sheets
the -webkit-text-stroke-color css property specifies the stroke color of characters of text. if this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /*
global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; syntax values <color> the color of the stroke. formal definition initial valuecurrentcolorapplies toall elementsinheritedyescomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3...
-webkit-text-stroke-width - CSS: Cascading Style Sheets
the -webkit-text-stroke-width css property specifies the width of the stroke for text. syntax /* keyword values */ -webkit-text-stroke-width: thin; -webkit-text-stroke-width: medium; -webkit-text-stroke-width: thick; /* <length> values */ -webkit-text-stroke-width: 2px; -webkit-text-stroke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /*
global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; values <line-width> the width of the stroke. formal definition initial value0applies toall elementsinheritedyescomputed valueabsolute <length>animation typediscrete formal syntax <length> examples varying stroke widths css p { margin: 0; font-size: 4em; -webkit-text-stroke-c...
-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. /* 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. formal definition initial valueas each of the properties of the shorthand:-webkit-text-stroke-widt...
-webkit-touch-callout - CSS: Cascading Style Sheets
the -webkit-touch-callout css property controls the display of the default callout shown when you touch and hold a touch target. when a target is touched and held on ios, safari displays a callout information about the link. this property allows disabling that behavior. /* keyword values */ -webkit-touch-callout: default; -webkit-touch-callout: none; /*
global values */ -webkit-touch-callout: initial; -webkit-touch-callout: inherit; -webkit-touch-callout: unset; syntax values default the default callout is displayed. none the callout is disabled. formal definition initial valuedefaultapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax default | none examples turn off touch callout .example { -webkit-touch-callout: none;...
:root - CSS: Cascading Style Sheets
the :root css pseudo-class matches the root element of a tree representing the document. in html, :root represents the <html> element and is identical to the selector html, except that its specificity is higher. /* selects the root element of the document: <html> in the case of html */ :root { background: yellow; } syntax :root examples declaring
global css variables :root can be useful for declaring
global css variables: :root { --main-color: hotpink; --pane-padding: 5px 42px; } specifications specification status comment selectors level 4the definition of ':root' in that specification. working draft no change. selectors level 3the definition of ':root' in that specification. recommendation initial definition. ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
pted] -moz-transform-style [prefixed version still accepted] -moz-transition [prefixed version still accepted] -moz-transition-delay [prefixed version still accepted] -moz-transition-duration [prefixed version still accepted] -moz-transition-property [prefixed version still accepted] -moz-transition-timing-function [prefixed version still accepted] -moz-user-select values
global values -moz-initial -moz-appearance button button-arrow-down button-arrow-next button-arrow-previous button-arrow-up button-bevel checkbox checkbox-container checkbox-label checkmenuitem dialog groupbox listbox menuarrow menucheckbox menuimage menuitem menuitemtext menulist menulist-button menulist-text menulist-textfield menupopup menuradio menuseparator -moz-...
Specificity - CSS: Cascading Style Sheets
use that rule is most specific. (also, the rule for blue overwrites the rule for red, notwithstanding the order of the rules) as a nonsense special case for (2), duplicate simple selectors to increase specificity when you have nothing more to specify. #myid#myid span { color: yellow; } .myclass.myclass span { color: orange; } how !important can be used: a) overriding inline styles your
global css file that sets visual aspects of your site
globally may be overwritten by inline styles defined directly on individual elements. both inline styles and !important are considered very bad practice, but sometimes you need the latter to override the former. in this case, you could set certain styles in your
global css file as !important, thus overriding inline styles set directly on elements. ...
align-content - CSS: Cascading Style Sheets
end the items are packed flush to each other against the end edge of the alignment container in the cross axis. flex-start the items are packed flush to each other against the edge of th...
align-self - CSS: Cascading Style Sheets
normal the effect of this keyword is dependent of the layout mode we are in: in absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes. in static position ...
all - CSS: Cascading Style Sheets
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 properties should be changed to their initial values. inherit specifies that all t...
animation-direction - CSS: Cascading Style Sheets
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; values normal the animation plays forwards each cycle. in other words, each time the animation cycles, the animation will reset to the beginning state and start over again. this is the default value. reverse the animation plays backwards each cycle. in other words, each time the animation cyc...
animation-name - CSS: Cascading Style Sheets
ive-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 keyframes. it can be used to deactivate an animation without changing the ordering of the other identifiers, or to deactivate animations coming from the cascade. <custom-ident> a name identifying the animation. this identifier is composed of a combination of case-sensit...
animation-play-state - CSS: Cascading Style Sheets
dn/interactive-examples and send us a pull request. resuming a paused animation will start the animation from where it left off at the time it was paused, rather than starting over from the beginning of the animation sequence. syntax /* single animation */ animation-play-state: running; animation-play-state: paused; /* multiple animations */ animation-play-state: paused, running, running; /*
global values */ animation-play-state: inherit; animation-play-state: initial; animation-play-state: unset; values running the animation is currently playing. paused the animation is currently paused. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on...
aspect-ratio - CSS: Cascading Style Sheets
the aspect-ratio css property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and some other layout functions. this property is not yet implemented in browsers, however some browsers are implementing this internally in order to provide the aspect ratio mapping described below. syntax aspect-ratio: 1 / 1; /*
global values */ aspect-ratio: inherit; aspect-ratio: initial; aspect-ratio: unset; values <auto> replaced elements with an intrinsic aspect ratio use that aspect ratio, otherwise the box has no preferred aspect ratio. size calculations involving intrinsic aspect ratio always work with the content box dimensions. <ratio> the box’s preferred aspect ratio is the specified ratio of width / height. size calculations involving prefe...
backdrop-filter - CSS: Cascading Style Sheets
<filter-function-list> a space-separated list of <filter-function>s or an svg filter that will be applied to the backdrop. formal definition initial valuenoneapplies toall elements; in svg, it applies to container elements excluding the defs el...
backface-visibility - CSS: Cascading Style Sheets
eractive-examples and send us a pull request. an element's back face is a mirror image of its front face. though invisible in 2d, the back face can become visible when a transformation causes the element to be rotated in 3d space. (this property has no effect on 2d transforms, which have no perspective.) syntax /* keyword values */ backface-visibility: visible; backface-visibility: hidden; /*
global values */ backface-visibility: inherit; backface-visibility: initial; backface-visibility: unset; the backface-visibility property is specified as one of the keywords listed below. values visible the back face is visible when turned towards the user. hidden the back face is hidden, effectively making the element invisible when turned away from the user. formal definition initial valuev...
background-attachment - CSS: Cascading Style Sheets
viewport, or scrolls with its containing block. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ background-attachment: scroll; background-attachment: fixed; background-attachment: local; /*
global values */ background-attachment: inherit; background-attachment: initial; background-attachment: unset; the background-attachment property is specified as one of the keyword values from the list below. values fixed the background is fixed relative to the viewport. even if an element has a scrolling mechanism, the background doesn't move with the element. (this is not compatible with backgr...
background-blend-mode - CSS: Cascading Style Sheets
ive-examples and send us a pull request. blending modes should be defined in the same order as the background-image property. if the blending modes' and background images' list lengths are not equal, it will be repeated and/or truncated until lengths match. syntax /* one value */ background-blend-mode: normal; /* two values, one per background */ background-blend-mode: darken, luminosity; /*
global values */ background-blend-mode: initial; background-blend-mode: inherit; background-blend-mode: unset; values <blend-mode> the blending mode to be applied. there can be several values, separated by commas. formal definition initial valuenormalapplies toall elements. in svg, it applies to container elements, graphics elements, and graphics referencing elements.. it also applies to ::firs...
background-clip - CSS: Cascading Style Sheets
roperties are their initial values, and the propagated values are treated as if they were specified on the root element. it is recommended that authors of html documents specify the canvas background for the <body> element rather than the html element. syntax /* keyword values */ background-clip: border-box; background-clip: padding-box; background-clip: content-box; background-clip: text; /*
global values */ background-clip: inherit; background-clip: initial; background-clip: unset; values border-box the background extends to the outside edge of the border (but underneath the border in z-ordering). padding-box the background extends to the outside edge of the padding. no background is drawn beneath the border. content-box the background is painted within (clipped to) the content b...
background-color - CSS: Cascading Style Sheets
values <color> the uniform color of the background. it is rendered behind any background-image that is specified, although the color will still be visible through any transparency in the image. accessibility concerns it is importan...
background-origin - CSS: Cascading Style Sheets
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that background-origin is ignored when background-attachment is fixed. syntax /* keyword values */ background-origin: border-box; background-origin: padding-box; background-origin: content-box; /*
global values */ background-origin: inherit; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below. values border-box the background is positioned relative to the border box. padding-box the background is positioned relative to the padding box. content-box the background is positioned relative to the content...
background-position - CSS: Cascading Style Sheets
values <position> a <position>. a position defines an x/y coordinate, to place an item relative to the edges of an element's box. it can be defined using one to four values. if two non-keyword ...
background-size - CSS: Cascading Style Sheets
using a width value only, in which case the height defaults to auto. using both a width and a height value, in which case the first sets the width and the second sets the height. each value c...
block-size - CSS: Cascading Style Sheets
repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ block-size: 300px; block-size: 25em; /* <percentage> values */ block-size: 75%; /* keyword values */ block-size: max-content; block-size: min-content; block-size: fit-content(20em); block-size: auto; /*
global values */ block-size: inherit; block-size: initial; block-size: unset; if the writing mode is vertically oriented, the value of block-size relates to the width of the element; otherwise, it relates to the height of the element. a related property is inline-size, which defines the other dimension of the element. initial valueautoapplies tosame as width and heightinheritednopercentagesblock-size...
border-bottom-color - CSS: Cascading Style Sheets
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 /* <color> values */ border-bottom-color: red; border-bottom-color: #ffbb00; border-bottom-color: rgb(255, 0, 0); border-bottom-color: hsla(100%, 50%, 25%, 0.75); border-bottom-color: currentcolor; border-bottom-color: transparent; /*
global values */ border-bottom-color: inherit; border-bottom-color: initial; border-bottom-color: unset; the border-bottom-color property is specified as a single value. values <color> the color of the bottom border. formal definition initial valuecurrentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <...
border-bottom-style - CSS: Cascading Style Sheets
ification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-bottom-style: none; border-bottom-style: hidden; border-bottom-style: dotted; border-bottom-style: dashed; border-bottom-style: solid; border-bottom-style: double; border-bottom-style: groove; border-bottom-style: ridge; border-bottom-style: inset; border-bottom-style: outset; /*
global values */ border-bottom-style: inherit; border-bottom-style: initial; border-bottom-style: unset; the border-bottom-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <li...
border-bottom-width - CSS: Cascading Style Sheets
red in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-bottom-width: thin; border-bottom-width: medium; border-bottom-width: thick; /* <length> values */ border-bottom-width: 10em; border-bottom-width: 3vmax; border-bottom-width: 6px; /*
global keywords */ border-bottom-width: inherit; border-bottom-width: initial; border-bottom-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <length> or a keyword. if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick...
border-collapse - CSS: Cascading Style Sheets
examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when cells are collapsed, the border-style value of inset behaves like groove, and outset behaves like ridge. when cells are separated, the distance between cells is defined by the border-spacing property. syntax /* keyword values */ border-collapse: collapse; border-collapse: separate; /*
global values */ border-collapse: inherit; border-collapse: initial; border-collapse: unset; the border-collapse property is specified as a single keyword, which may be chosen from the list below. values collapse adjacent cells have shared borders (the collapsed-border table rendering model). separate adjacent cells have distinct borders (the separated-border table rendering model). formal de...
border-color - CSS: Cascading Style Sheets
when one value is specified, it applies the same color to all four sides. when two values are specified, the first color applies to the top and bottom, the second to the left and right. when three values are specified, the first colo...
border-end-end-radius - CSS: Cascading Style Sheets
dius that depends on on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-end-end-radius: 10px; border-end-end-radius: 1em; /* with two values the corner will be an ellipse */ border-end-end-radius: 1em 2em; /*
global values */ border-end-end-radius: inherit; border-end-end-radius: initial; border-end-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-right-radius property. syntax values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any...
border-end-start-radius - CSS: Cascading Style Sheets
dius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-end-start-radius: 10px; border-end-start-radius: 1em; /* with two values the corner will be an ellipse */ border-end-start-radius: 1em 2em; /*
global values */ border-end-start-radius: inherit; border-end-start-radius: initial; border-end-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-right-radius property. syntax values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in ...
border-image-outset - CSS: Cascading Style Sheets
oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> value */ border-image-outset: 1rem; /* <number> value */ border-image-outset: 1.5; /* vertical | horizontal */ border-image-outset: 1 1.2; /* top | horizontal | bottom */ border-image-outset: 30px 2 45px; /* top | right | bottom | left */ border-image-outset: 7px 12px 14px 5px; /*
global values */ border-image-outset: inherit; border-image-outset: initial; border-image-outset: unset; the border-image-outset property may be specified as one, two, three, or four values. each value is a <length> or <number>. negative values are invalid and will cause the border-image-outset declaration to be ignored. if one value is specified, it applies to all four sides. if two values are sp...
border-image-repeat - CSS: Cascading Style Sheets
le is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat: round; border-image-repeat: space; /* vertical | horizontal */ border-image-repeat: round stretch; /*
global values */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: unset; the border-image-repeat property may be specified using one or two values chosen from the list of values below. when one value is specified, it applies the same behavior on all four sides. when two values are specified, the first applies to the top and bottom, the second to the left and right. ...
border-image-slice - CSS: Cascading Style Sheets
age-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 */ border-image-slice: inherit; border-image-slice: initial; border-image-slice: unset; the border-image-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices...
border-image-source - CSS: Cascading Style Sheets
clone https://github.com/mdn/interactive-examples and send us a pull request. the border-image-slice property is used to divide the source image into regions, which are then dynamically applied to the final border image. syntax /* keyword value */ border-image-source: none; /* <image> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /*
global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; values none no border image is used. the appearance defined by border-style is displayed instead. <image> image reference to use for the border. formal definition initial valuenoneapplies toall elements, except internal table elements when border-collapse is collapse. it also applies to ::...
border-image-width - CSS: Cascading Style Sheets
. syntax /* keyword value */ border-image-width: auto; /* <length> value */ border-image-width: 1rem; /* <percentage> value */ border-image-width: 25%; /* <number> value */ border-image-width: 3; /* vertical | horizontal */ border-image-width: 2em 3em; /* top | horizontal | bottom */ border-image-width: 5% 15% 10%; /* top | right | bottom | left */ border-image-width: 5% 2em 10% auto; /*
global values */ border-image-width: inherit; border-image-width: initial; border-image-width: unset; the border-image-width property may be specified using one, two, three, or four values chosen from the list of values below. when one value is specified, it applies the same width to all four sides. when two values are specified, the first width applies to the top and bottom, the second to the lef...
border-left-color - CSS: Cascading Style Sheets
thub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ border-left-color: red; border-left-color: #ffbb00; border-left-color: rgb(255, 0, 0); border-left-color: hsla(100%, 50%, 25%, 0.75); border-left-color: currentcolor; border-left-color: transparent; /*
global values */ border-left-color: inherit; border-left-color: initial; border-left-color: unset; the border-left-color property is specified as a single value. values <color> the color of the left border. formal definition initial valuecurrentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>wher...
border-left-style - CSS: Cascading Style Sheets
est. note: the specification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-left-style: none; border-left-style: hidden; border-left-style: dotted; border-left-style: dashed; border-left-style: solid; border-left-style: double; border-left-style: groove; border-left-style: ridge; border-left-style: inset; border-left-style: outset; /*
global values */ border-left-style: inherit; border-left-style: initial; border-left-style: unset; the border-left-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <line-style...
border-left-width - CSS: Cascading Style Sheets
ample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-left-width: thin; border-left-width: medium; border-left-width: thick; /* <length> values */ border-left-width: 10em; border-left-width: 3vmax; border-left-width: 6px; /*
global keywords */ border-left-width: inherit; border-left-width: initial; border-left-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <length> or a keyword. if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick ...
border-radius - CSS: Cascading Style Sheets
this is used to set a single radius for the corners. followed optionally by "/" and one, two, three, or four <length> or <percentage> values. this is used to set an additional radius, so you can have elliptical ...
border-right-color - CSS: Cascading Style Sheets
epository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ border-right-color: red; border-right-color: #ffbb00; border-right-color: rgb(255, 0, 0); border-right-color: hsla(100%, 50%, 25%, 0.75); border-right-color: currentcolor; border-right-color: transparent; /*
global values */ border-right-color: inherit; border-right-color: initial; border-right-color: unset; the border-right-color property is specified as a single value. values <color> the color of the right border. formal definition initial valuecurrentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color...
border-right-style - CSS: Cascading Style Sheets
: the specification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-right-style: none; border-right-style: hidden; border-right-style: dotted; border-right-style: dashed; border-right-style: solid; border-right-style: double; border-right-style: groove; border-right-style: ridge; border-right-style: inset; border-right-style: outset; /*
global values */ border-right-style: inherit; border-right-style: initial; border-right-style: unset; the border-right-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <line-s...
border-right-width - 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. syntax /* keyword values */ border-right-width: thin; border-right-width: medium; border-right-width: thick; /* <length> values */ border-right-width: 10em; border-right-width: 3vmax; border-right-width: 6px; /*
global keywords */ border-right-width: inherit; border-right-width: initial; border-right-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <length> or a keyword. if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick ...
border-spacing - CSS: Cascading Style Sheets
nd the relevant (top, right, bottom, or left) padding on the table. note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing. syntax /* <length> */ border-spacing: 2px; /* horizontal <length> | vertical <length> */ border-spacing: 1cm 2em; /*
global values */ border-spacing: inherit; border-spacing: initial; border-spacing: unset; the border-spacing property may be specified as either one or two values. when one <length> value is specified, it defines both the horizontal and vertical spacings between cells. when two <length> values are specified, the first value defines the horizontal spacing between cells (i.e., the space between cell...
border-start-end-radius - CSS: Cascading Style Sheets
dius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-start-end-radius: 10px; border-start-end-radius: 1em; /* with two values the corner will be an ellipse */ border-start-end-radius: 1em 2em; /*
global values */ border-start-end-radius: inherit; border-start-end-radius: initial; border-start-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-left-radius property. syntax values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed i...
border-start-start-radius - CSS: Cascading Style Sheets
depends on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-start-start-radius: 10px; border-start-start-radius: 1em; /* with two values the corner will be an ellipse */ border-start-start-radius: 1em 2em; /*
global values */ border-start-start-radius: inherit; border-start-start-radius: initial; border-start-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-left-radius property. syntax values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expresse...
border-style - CSS: Cascading Style Sheets
when one value is specified, it applies the same style to all four sides. when two values are specified, the first style applies to the top and bottom, the second to the left and right. when three values are specified, the first styl...
border-top-color - CSS: Cascading Style Sheets
n a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ border-top-color: red; border-top-color: #ffbb00; border-top-color: rgb(255, 0, 0); border-top-color: hsla(100%, 50%, 25%, 0.75); border-top-color: currentcolor; border-top-color: transparent; /*
global values */ border-top-color: inherit; border-top-color: initial; border-top-color: unset; the border-top-color property is specified as a single value. values <color> the color of the top border. formal definition initial valuecurrentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <col...
border-top-style - CSS: Cascading Style Sheets
us a pull request. the specification doesn't define how borders of different styles connect in the corners. syntax /* keyword values */ border-top-style: none; border-top-style: hidden; border-top-style: dotted; border-top-style: dashed; border-top-style: solid; border-top-style: double; border-top-style: groove; border-top-style: ridge; border-top-style: inset; border-top-style: outset; /*
global values */ border-top-style: inherit; border-top-style: initial; border-top-style: unset; the border-top-style property is specified as a single keyword chosen from those available for the border-style property. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <line-style>whe...
border-top-width - CSS: Cascading Style Sheets
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. syntax /* keyword values */ border-top-width: thin; border-top-width: medium; border-top-width: thick; /* <length> values */ border-top-width: 10em; border-top-width: 3vmax; border-top-width: 6px; /*
global keywords */ border-top-width: inherit; border-top-width: initial; border-top-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <length> or a keyword. if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick ...
border-width - CSS: Cascading Style Sheets
when one value is specified, it applies the same width to all four sides. when two values are specified, the first width applies to the top and bottom, the second to the left and right. when three values are specified, the first wi...
border - CSS: Cascading Style Sheets
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 the values does not matter. note: the border will be invisible if its style is not defined. this is because the style defaults to none. values <line-width> sets the thickness of the border. defaults to medium if absent. see bor...
bottom - CSS: Cascading Style Sheets
her auto or 100%) both the top and bottom distances are respected. in all other situations, if height is constrained in any way or position is set to relative, the top property takes precedence and the bottom property is ignored. syntax /* <length> values */ bottom: 3px; bottom: 2.4em; /* <percentage>s of the height of the containing block */ bottom: 10%; /* keyword value */ bottom: auto; /*
global values */ bottom: inherit; bottom: initial; bottom: unset; values <length> a negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the bottom edge of the containing block. for relatively positioned elements, the distance that the element is moved above its normal position. <percentage> a <percentage> of the containing block's h...
box-align - CSS: Cascading Style Sheets
by a newer standard. the box-align css property specifies how an element aligns its contents across its layout in a perpendicular direction. the effect of the property is only visible if there is extra space in the box. see flexbox for information about the current standard. /* keyword values */ box-align: start; box-align: center; box-align: end; box-align: baseline; box-align: stretch; /*
global values */ box-lines: inherit; box-lines: initial; box-lines: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-align property is specified as one of the keyword values listed below. values start the box aligns contents at the start, leaving any extra space at the end. center the box aligns contents in the center, dividing any ex...
box-decoration-break - CSS: Cascading Style Sheets
ry. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the specified value will impact the appearance of the following properties: background border border-image box-shadow clip-path margin padding syntax /* keyword values */ box-decoration-break: slice; box-decoration-break: clone; /*
global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; the box-decoration-break property is specified as one of the keyword values listed below. values slice the element is initially rendered as if its box were not fragmented, after which the rendering for this hypothetical box is sliced into pieces for each line/column/page. note that the hypo...
box-direction - CSS: Cascading Style Sheets
n will only be used for xul while the previous standard box-direction has been replaced by flex-direction. see flexbox for information about the current standard. the box-direction css property specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge). /* keyword values */ box-direction: normal; box-direction: reverse; /*
global values */ box-direction: inherit; box-direction: initial; box-direction: unset; syntax the box-direction property is specified as one of the keyword values listed below. values normal the box lays out its contents from the start (the left or top edge). reverse the box lays out its contents from the end (the right or bottom edge). notes the edge of the box designated the start for lay...
box-flex-group - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-flex-group css property assigns the flexbox's child elements to a flex group. /* <integer> values */ box-flex-group: 1; box-flex-group: 5; /*
global values */ box-flex-group: inherit; box-flex-group: initial; box-flex-group: unset; for flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. the initial value is 1. when dividing up the box's extra space, the browser first considers all elements within the first flex group. each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibilit...
box-flex - CSS: Cascading Style Sheets
ose drafts). see flexbox for information about the current standard. the -moz-box-flex and -webkit-box-flex css properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout. /* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /*
global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <number>. if the value is 0, the box does not grow. if it is greater than 0, the box grows to fill a proportion of the available space. notes the containing box allocates the available ext...
box-lines - CSS: Cascading Style Sheets
property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-lines css property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). /* keyword values */ box-lines: single; box-lines: multiple; /*
global values */ box-lines: inherit; box-lines: initial; box-lines: unset; by default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. this behavior can be changed using the box-lines property. the default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit w...
box-ordinal-group - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-ordinal-group css property assigns the flexbox's child elements to an ordinal group. /* <integer> values */ box-ordinal-group: 1; box-ordinal-group: 5; /*
global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. when the computed box-direction is normal, a box will display its elements starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (fo...
box-orient - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-orient css property sets whether an element lays out its contents horizontally or vertically. /* keyword values */ box-orient: horizontal; box-orient: vertical; box-orient: inline-axis; box-orient: block-axis; /*
global values */ box-orient: inherit; box-orient: initial; box-orient: unset; syntax the box-orient property is specified as one of the keyword values listed below. values horizontal the box lays out its contents horizontally. vertical the box lays out its contents vertically. inline-axis (html) the box displays its children along the inline axis. block-axis (html) the box displays its chi...
box-pack - CSS: Cascading Style Sheets
en replaced by a newer standard. see flexbox for information about the current standard. the -moz-box-pack and -webkit-box-pack css properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. the effect of this is only visible if there is extra space in the box. /* keyword values */ box-pack: start; box-pack: center; box-pack: end; box-pack: justify; /*
global values */ box-pack: inherit; box-pack: initial; box-pack: unset; the direction of layout depends on the element's orientation: horizontal or vertical. syntax the box-pack property is specified as one of the keyword values listed below. values start the box packs contents at the start, leaving any extra space at the end. center the box packs contents in the center, dividing any extra sp...
box-shadow - CSS: Cascading Style Sheets
if only two values are given, they are interpreted as <offset-x><offset-y> values. if a third value is given, it is interpreted as a <blur-radius>. if a fourth value is given, it is interpreted as a <spread-radius>. optionally, th...
break-inside - CSS: Cascading Style Sheets
the break-inside css property sets how page, column, or region breaks should behave inside a generated box. if there is no generated box, the property is ignored. /* 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,...
caption-side - CSS: Cascading Style Sheets
le is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* directional values */ caption-side: top; caption-side: bottom; /* warning: non-standard values */ caption-side: left; caption-side: right; caption-side: top-outside; caption-side: bottom-outside; /*
global values */ caption-side: inherit; caption-side: initial; caption-side: unset; the caption-side property is specified as one of the keyword values listed below. values top the caption box should be positioned above the table. bottom the caption box should be positioned below the table. left the caption box should be positioned on the left side of the table. this value was proposed f...
clear - CSS: Cascading Style Sheets
resize, so that it contains floating elements inside it, you need to self-clear its children. this is called clearfix, and one way to do it is to add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } syntax /* keyword values */ clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end; /*
global values */ clear: inherit; clear: initial; clear: unset; values none is a keyword indicating that the element is not moved down to clear past floating elements. left is a keyword indicating that the element is moved down to clear past left floats. right is a keyword indicating that the element is moved down to clear past right floats. both is a keyword indicating that the element is mo...
clip-path - CSS: Cascading Style Sheets
values <clip-source> a <url> referencing an svg <clippath> element. <basic-shape> a shape whose size and position is defined by the <geometry-box> value. if no geometry box is specified, the border-box will be used as the reference bo...
clip - CSS: Cascading Style Sheets
the clip css property defines a visible portion of an element. the clip property applies only to absolutely positioned elements — that is, elements with position:absolute or position:fixed. /* keyword value */ clip: auto; /* <shape> values */ clip: rect(1px 10em 3rem 2ch); clip: rect(1px, 10em, 3rem, 2ch); /*
global values */ clip: inherit; clip: initial; clip: unset; syntax note: where possible, authors are encouraged to use the newer clip-path property instead. values <<shape>()> a rectangular <<shape>()> of the form rect(<top> <right> <bottom> <left>). the <top> and <bottom> values are offsets from the inside top border edge of the box, while <right> and <left> are offsets from the inside left border edge of the box — that is, the extent of the padding box. the <top>, <righ...
color - CSS: Cascading Style Sheets
note that the value must be a uniform color. it can't be a <gradient>, which is actually a type of <image>. values <color> sets the color of the textual and decorative parts of the element. accessibility concerns it is important to ensure that the contrast ratio between th...
column-count - CSS: Cascading Style Sheets
css property breaks an element's content into the specified number of columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ column-count: auto; /* <integer> value */ column-count: 3; /*
global values */ column-count: inherit; column-count: initial; column-count: unset; values auto the number of columns is determined by other css properties, such as column-width. <integer> is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed. if the column-width is also set to a non-auto value, it merely indicates the maximum...
column-fill - CSS: Cascading Style Sheets
ntrols how an element's contents are balanced when broken into columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ column-fill: auto; column-fill: balance; column-fill: balance-all; /*
global values */ column-fill: inherit; column-fill: initial; column-fill: unset; the column-fill property is specified as one of the keyword values listed below. the initial value is balance so the content will be balanced across the columns. values auto columns are filled sequentially. content takes up only the room it needs, this may result in some columns remaining empty. balance content is ...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
tially defined the grid-column-gap property. this prefixed property is being replaced by column-gap. however, in order to support browsers that implemented grid-column-gap and not column-gap for grid, you will need to use the prefixed property. syntax /* keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /*
global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the values listed below. values normal the browser's default spacing is used between columns. for multi-column layout this is specified as 1em. for all other layout types it is 0. <length> the size of the gap between columns, defined as a <length>. the <length> property's...
column-rule-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. syntax /* <color> values */ column-rule-color: red; column-rule-color: rgb(192, 56, 78); column-rule-color: transparent; column-rule-color: hsla(0, 100%, 50%, 0.6); /*
global values */ column-rule-color: inherit; column-rule-color: initial; column-rule-color: unset; the column-rule-color property is specified as a single <color> value. values <color> the color of the rule that separates columns. formal definition initial valuecurrentcolorapplies tomulticol elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color...
column-rule-style - CSS: Cascading Style Sheets
oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ column-rule-style: none; column-rule-style: hidden; column-rule-style: dotted; column-rule-style: dashed; column-rule-style: solid; column-rule-style: double; column-rule-style: groove; column-rule-style: ridge; column-rule-style: inset; column-rule-style: outset; /*
global values */ column-rule-style: inherit; column-rule-style: initial; column-rule-style: unset; the column-rule-style property is specified as a single <'border-style'> value. values <'border-style'> is a keyword defined by border-style describing the style of the rule. the styling must be interpreted as in the collapsing border model. formal definition initial valuenoneapplies tomulticol el...
column-rule-width - CSS: Cascading Style Sheets
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 /* keyword values */ column-rule-width: thin; column-rule-width: medium; column-rule-width: thick; /* <length> values */ column-rule-width: 1px; column-rule-width: 2.5em; /*
global values */ column-rule-width: inherit; column-rule-width: initial; column-rule-width: unset; the column-rule-width property is specified as a single <'border-width'> value. values <'border-width'> is a keyword defined by border-width describing the width of the rule. it may be either a <length> or one of the thin, medium, or thick keywords. formal definition initial valuemediumapplies tom...
column-rule - CSS: Cascading Style Sheets
venient 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 inset blue; /*
global values */ column-rule: inherit; column-rule: initial; column-rule: unset; the column-rule property is specified as one, two, or three of the values listed below, in any order. values <'column-rule-width'> is a <length> or one of the three keywords, thin, medium, or thick. see border-width for details. <'column-rule-style'> see border-style for possible values and details. <'column-rule-...
column-span - CSS: Cascading Style Sheets
syntax the column-span property is specified as one of the keyword values listed below. values none the element does not span multiple columns. all the element spans across all columns. ...
column-width - CSS: Cascading Style Sheets
rent screen sizes. especially in the presence of the column-count property (which has precedence), you must specify all related length values to achieve an exact column width. in horizontal text these are width, column-width, column-gap, and column-rule-width. syntax /* keyword value */ column-width: auto; /* <length> values */ column-width: 60px; column-width: 15.5em; column-width: 3.3vw; /*
global values */ column-width: inherit; column-width: initial; column-width: unset; the column-width property is specified as one of the values listed below. values <length> indicates the optimal column width. the actual column width may differ from the specified value: it may be wider when necessary to fill available space, and narrower when the available space is too small. the value must be st...
columns - CSS: Cascading Style Sheets
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 <'column-width'> the ideal column width, defined as a <length> or the keyword auto. the actual width may be wider or narrower to fit the available space. see column-width. <'column-count'> the ideal number of columns into which ...
contain - CSS: Cascading Style Sheets
this property creates: a new containing block (for the descendants whose position property is absolute or fixed). a new stacking context. a new block formatting context. syntax /* keyword values */ contain: none; contain: strict; contain: content; contain: size; contain: layout; contain: style; contain: paint; /* multiple keywords */ contain: size paint; contain: size layout paint; /*
global values */ contain: inherit; contain: initial; contain: unset; the contain property is specified as either one of the following: using a single none, strict, or content keyword. using one or more of the size, layout, style, and paint keywords in any order. values none indicates the element renders as normal, with no containment applied. strict indicates that all containment rules exce...
content - CSS: Cascading Style Sheets
normal computes to none for the ::before and ::after pseudo-elements. <string> specifies the "alt text" for the element. this value can be any number of text characters. non-latin characters must be encoded using their unicode escape sequences: for example, \000a9 repre...
counter-increment - CSS: Cascading Style Sheets
er using the counter-reset css property. syntax /* increment "my-counter" by 1 */ counter-increment: my-counter; /* decrement "my-counter" by 1 */ counter-increment: my-counter -1; /* increment "counter1" by 1, and decrement "counter2" by 4 */ counter-increment: counter1 counter2 -4; /* do not increment/decrement anything: used to override less specific rules */ counter-increment: none; /*
global values */ counter-increment: inherit; counter-increment: initial; counter-increment: unset; the counter-increment property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to increment as you want, with each name or name-number pair separated by a space. the keyword value none. values ...
counter-reset - CSS: Cascading Style Sheets
the counter's value can be increased or decreased using the counter-increment css property. syntax /* set "my-counter" to 0 */ counter-reset: my-counter; /* set "my-counter" to -1 */ counter-reset: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-reset: counter1 1 counter2 4; /* cancel any reset that could have been set in less specific rules */ counter-reset: none; /*
global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; the counter-reset property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the...
counter-set - CSS: Cascading Style Sheets
: the counter's value can be incremented or decremented using the counter-increment css property. syntax /* set "my-counter" to 0 */ counter-set: my-counter; /* set "my-counter" to -1 */ counter-set: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-set: counter1 1 counter2 4; /* cancel any counter that could have been set in less specific rules */ counter-set: none; /*
global values */ counter-set: inherit; counter-set: initial; counter-set: unset; the counter-set property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-number pair separated by a space. the keyword value none. values <custom-ident> the name of...
cursor - CSS: Cascading Style Sheets
ike to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ cursor: pointer; cursor: auto; /* url, with a keyword fallback */ cursor: url(hand.cur), pointer; /* url and coordinates, with a keyword fallback */ cursor: url(cursor1.png) 4 12, auto; cursor: url(cursor2.png) 2 2, pointer; /*
global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each <url> should point to an image file. the browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or i...
direction - CSS: Cascading Style Sheets
r attribute in html, the direction property is not inherited from table columns into table cells, since css inheritance follows the document tree, and table cells are inside of rows but not inside of columns. the direction and unicode-bidi properties are the two only properties which are not affected by the all shorthand property. syntax /* keyword values */ direction: ltr; direction: rtl; /*
global values */ direction: inherit; direction: initial; direction: unset; values ltr text and other elements go from left to right. this is the default value. rtl text and other elements go from right to left. for the direction property to have any effect on inline-level elements, the unicode-bidi property's value must be embed or override. formal definition initial valueltrapplies toall el...
display - CSS: Cascading Style Sheets
s until the two keyword values are better supported. for example, using two values you might specify an inline flex container as follows: .container { display: inline flex; } this can currently be specified using a single value. .container { display: inline-flex; } for more information on these changes to the specification, see the article adapting to the new two-value syntax of display.
global /*
global values */ display: inherit; display: initial; display: unset; description the individual pages for the different types of value that display can have set on it feature multiple examples of those values in action — see the syntax section. in addition, see the following material, which covers the various values of display in depth. adapting to the new two-value syntax of display ...
empty-cells - CSS: Cascading Style Sheets
no visible content. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has an effect only when the border-collapse property is separate. syntax /* keyword values */ empty-cells: show; empty-cells: hide; /*
global values */ empty-cells: inherit; empty-cells: initial; empty-cells: unset; the empty-cells property is specified as one of the keyword values listed below. values show borders and backgrounds are drawn like in normal cells. hide no borders or backgrounds are drawn. formal definition initial valueshowapplies totable-cell elementsinheritedyescomputed valueas specifiedanimation typediscre...
env() - CSS: Cascading Style Sheets
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, un...
filter - CSS: Cascading Style Sheets
s.svg#filter-id"); /* <filter-function> values */ filter: blur(5px); filter: brightness(0.4); filter: contrast(200%); filter: drop-shadow(16px 16px 20px blue); filter: grayscale(50%); filter: hue-rotate(90deg); filter: invert(75%); filter: opacity(25%); filter: saturate(30%); filter: sepia(60%); /* multiple filters */ filter: contrast(175%) brightness(3%); /* use no filter */ filter: none; /*
global values */ filter: inherit; filter: initial; filter: unset; with a function, use the following: filter: <filter-function> [<filter-function>]* | none for a reference to an svg <filter> element, use the following: filter: url(file.svg#filter-element-id) interpolation if both the beginning and end filters have a function list of the same length without <url>, each of their filter functions ...
flex-basis - CSS: Cascading Style Sheets
width (or height in case of flex-direction: column) are set for an element, flex-basis has priority. syntax /* specify <'width'> */ flex-basis: 10em; flex-basis: 3px; flex-basis: auto; /* intrinsic sizing keywords */ flex-basis: fill; flex-basis: max-content; flex-basis: min-content; flex-basis: fit-content; /* automatically size based on the flex item’s content */ flex-basis: content; /*
global values */ flex-basis: inherit; flex-basis: initial; flex-basis: unset; the flex-basis property is specified as either the keyword content or a <'width'>. values <'width'> an absolute <length>, a <percentage> of the parent flex container's main size property, or the keyword auto. negative values are invalid. defaults to auto. content indicates automatic sizing, based on the flex item’s ...
flex-direction - CSS: Cascading Style Sheets
rtl, row represents the axis oriented from the right to the left, and row-reverse from the left to the right. syntax /* the direction text is laid out in a line */ flex-direction: row; /* like <row>, but reversed */ flex-direction: row-reverse; /* the direction in which lines of text are stacked */ flex-direction: column; /* like <column>, but reversed */ flex-direction: column-reverse; /*
global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; values the following values are accepted: row the flex container's main-axis is defined to be the same as the text direction. the main-start and main-end points are the same as the content direction. row-reverse behaves the same as row but the main-start and main-end points are permuted. column the flex ...
flex-flow - CSS: Cascading Style Sheets
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 specifiedanima...
flex-grow - CSS: Cascading Style Sheets
the flex-grow css property sets the flex grow factor of a flex item main size. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <number> values */ flex-grow: 3; flex-grow: 0.6; /*
global values */ flex-grow: inherit; flex-grow: initial; flex-grow: unset; the flex-grow property is specified as a single <number>. values <number> see <number>. negative values are invalid. defaults to 0. description this property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). the main size is either width or height of the item which is dependent ...
flex-shrink - CSS: Cascading Style Sheets
side the other flex properties flex-grow and flex-basis, and normally defined using the flex shorthand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <number> values */ flex-shrink: 2; flex-shrink: 0.6; /*
global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; the flex-shrink property is specified as a single <number>. values <number> see <number>. negative values are invalid. defaults to 1. formal definition initial value1applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples...
flex-wrap - CSS: Cascading Style Sheets
re stacked. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see using css flexible boxes for more properties and information. syntax flex-wrap: nowrap; /* default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /*
global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-start is either equivalent to start or before depending on the flex-direction...
flex - CSS: Cascading Style Sheets
one-value syntax: the value must be one of: a <number>: in this case it is interpreted as flex: <number> 1 0; the <flex-shrink> value is assumed to be 1 and the <flex-basis> value is assumed to be 0. one of the keywords: none, auto, or initial. two-value sy...
float - CSS: Cascading Style Sheets
loat. this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and escape <label>'s "for" as "htmlfor"). syntax /* keyword values */ float: left; float: right; float: none; float: inline-start; float: inline-end; /*
global values */ float: inherit; float: initial; float: unset; the float property is specified as a single keyword, chosen from the list of values below. values left the element must float on the left side of its containing block. right the element must float on the right side of its containing block. none the element must not float. inline-start the element must float on the start side of ...
font-family - CSS: Cascading Style Sheets
each font family is specified as either a <family-name> or a <generic-name> value. the example below lists two font families, the first with a <family-name> and the second with a <generic-name>: font-family: gill sans extrabold, sans-serif; ...
font-feature-settings - CSS: Cascading Style Sheets
like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* use the default settings */ font-feature-settings: normal; /* set values for opentype feature tags */ font-feature-settings: "smcp"; font-feature-settings: "smcp" on; font-feature-settings: "swsh" 2; font-feature-settings: "smcp", "swsh" 2; /*
global values */ font-feature-settings: inherit; font-feature-settings: initial; font-feature-settings: unset; whenever possible, web authors should instead use the font-variant shorthand property or an associated longhand property such as font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position. these lead to more effec...
font-language-override - CSS: Cascading Style Sheets
the font-language-override css property controls the use of language-specific glyphs in a typeface. /* keyword value */ font-language-override: normal; /* <string> values */ font-language-override: "eng"; /* use english glyphs */ font-language-override: "trk"; /* use turkish glyphs */ /*
global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset; by default, html's lang attribute tells browsers to display glyphs designed specifically for that language. for example, a lot of fonts have a special character for the digraph fi that merge the dot on the "i" with the "f." however, if the language is set to turkish the typeface will likely know not to use the merged glyph; turkish has two versions of the "i," one with a dot (i) and one witho...
font-optical-sizing - CSS: Cascading Style Sheets
ts whether text rendering is optimized for viewing at different sizes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ font-optical-sizing: none; font-optical-sizing: auto; /* default */ /*
global values */ font-optical-sizing: inherit; font-optical-sizing: initial; font-optical-sizing: unset; values none the browser will not modify the shape of glyphs for optimal viewing. auto the browser will modify the shape of glyphs for optimal viewing. description optical sizing is enabled by default for fonts that have an optical size variation axis. the optical size variation axis is rep...
font-size-adjust - CSS: Cascading Style Sheets
the font-size-adjust css property sets the size of lower-case letters relative to the current font size (which defines the size of upper-case letters). /* use the specified font size */ font-size-adjust: none; /* use a font size that makes lowercase letters half the specified font size */ font-size-adjust: 0.5; /*
global values */ font-size-adjust: inherit; font-size-adjust: initial; font-size-adjust: unset; the property is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the fo...
font-stretch - CSS: Cascading Style Sheets
densed, or expanded face from a font. /* keyword values */ font-stretch: ultra-condensed; font-stretch: extra-condensed; font-stretch: condensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; /* percentage values */ font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /*
global values */ font-stretch: inherit; font-stretch: initial; font-stretch: unset; syntax this property may be specified as a single keyword value or a single <percentage> value. values normal specifies a normal font face. semi-condensed, condensed, extra-condensed, ultra-condensed specifies a more condensed font face than normal, with ultra-condensed as the most condensed. semi-expanded, ex...
font-style - CSS: Cascading Style Sheets
e than their unstyled counterparts, while oblique faces are usually just sloped versions of the regular face. when the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use font-synthesis to control this behavior). syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 10deg; /*
global values */ font-style: inherit; font-style: initial; font-style: unset; the font-style property is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is oblique. values normal selects a font that is classified as normal within a font-family. italic selects a font that is classified as italic. if no italic version of the...
font-variant-caps - CSS: Cascading Style Sheets
junctive eta (ή/Ή). also, diphthongs with an accent on the first vowel lose the accent and gain a diacritic on the second vowel (άι/ΑΪ). syntax /* keyword values */ font-variant-caps: normal; font-variant-caps: small-caps; font-variant-caps: all-small-caps; font-variant-caps: petite-caps; font-variant-caps: all-petite-caps; font-variant-caps: unicase; font-variant-caps: titling-caps; /*
global values */ font-variant-caps: inherit; font-variant-caps: initial; font-variant-caps: unset; the font-variant-caps property is specified using a single keyword value from the list below. in each case, if the font doesn't support the opentype value, then it synthesizes the glyphs. values normal deactivates of the use of alternate glyphs. small-caps enables display of small capitals (openty...
font-variant-position - CSS: Cascading Style Sheets
the font-variant-position css property controls the use of alternate, smaller glyphs that are positioned as superscript or subscript. the glyphs are positioned relative to the baseline of the font, which remains unchanged. these glyphs are typically used in <sub> and <sup> elements. /* keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /*
global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; when the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. these alternate glyphs share the same em-box and the s...
font-variant - CSS: Cascading Style Sheets
ive 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: font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric syntax font-variant: small-caps; font-variant: common-ligatures small-caps; /*
global values */ font-variant: inherit; font-variant: initial; font-variant: unset; values normal specifies a normal font face; each of the longhand properties has an initial value of normal. longhand properties of font-variant are: font-variant-caps, font-variant-numeric, font-variant-alternates, font-variant-ligatures, and font-variant-east-asian. none sets the value of the font-variant-ligatu...
font-variation-settings - CSS: Cascading Style Sheets
eir values. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* use the default settings */ font-variation-settings: normal; /* set values for variable font axis names */ font-variation-settings: "xhgt" 0.7; /*
global values */ font-variation-settings: inherit; font-variation-settings: initial; font-variation-settings: unset; values this property's value can take one of two forms: normal text is laid out using default settings. <string> <number> when rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features. each setting is always one o...
font-weight - CSS: Cascading Style Sheets
s and send us a pull request. syntax /* keyword values */ font-weight: normal; font-weight: bold; /* keyword values relative to the parent */ font-weight: lighter; font-weight: bolder; /* numeric keyword values */ font-weight: 100; font-weight: 200; font-weight: 300; font-weight: 400;// normal font-weight: 500; font-weight: 600; font-weight: 700;// bold font-weight: 800; font-weight: 900; /*
global values */ font-weight: inherit; font-weight: initial; font-weight: unset; the font-weight property is specified using any one of the values listed below. values normal normal font weight. same as 400. bold bold font weight. same as 700. lighter one relative font weight lighter than the parent element. note that only four font weights are considered for relative weight calculation; see ...
gap (grid-gap) - CSS: Cascading Style Sheets
ctive example above. syntax /* one <length> value */ gap: 20px; gap: 1em; gap: 3vmin; gap: 0.5cm; /* one <percentage> value */ gap: 16%; gap: 100%; /* two <length> values */ gap: 20px 10px; gap: 1em 0.5em; gap: 3vmin 2vmax; gap: 0.5cm 2mm; /* one or two <percentage> values */ gap: 16% 100%; gap: 21px 82%; /* calc() values */ gap: calc(10% + 20px); gap: calc(20px + 10%) calc(10% - 5px); /*
global values */ gap: inherit; gap: initial; gap: unset; this property is specified as a value for <'row-gap'> followed optionally by a value for <'column-gap'>. if <'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. <percen...
grid-area - CSS: Cascading Style Sheets
<custom-ident> if there is a named line with the name '<custom-ident>-start'/'<custom-ident>-end', it contributes the first such line to the grid item’s placement. n...
grid-auto-columns - CSS: Cascading Style Sheets
<percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr speci...
grid-auto-flow - CSS: Cascading Style Sheets
nto the grid. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ grid-auto-flow: row; grid-auto-flow: column; grid-auto-flow: dense; grid-auto-flow: row dense; grid-auto-flow: column dense; /*
global values */ grid-auto-flow: inherit; grid-auto-flow: initial; grid-auto-flow: unset; this property may take one of two forms: a single keyword: one of row, column, or dense. two keywords: row dense or column dense. values row items are placed by filling each row in turn, adding new rows as necessary. if neither row nor column is provided, row is assumed. column items are placed by fil...
grid-auto-rows - CSS: Cascading Style Sheets
<percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr specifying the...
grid-column-start - CSS: Cascading Style Sheets
s and send us a pull request. syntax /* keyword value */ grid-column-start: auto; /* <custom-ident> value */ grid-column-start: somegridarea; /* <integer> + <custom-ident> values */ grid-column-start: 2; grid-column-start: somegridarea 4; /* span + <integer> + <custom-ident> values */ grid-column-start: span 3; grid-column-start: span somegridarea; grid-column-start: span somegridarea 5; /*
global values */ grid-column-start: inherit; grid-column-start: initial; grid-column-start: unset; this property is specified as a single <grid-line> value. a <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <int...
grid-row-end - CSS: Cascading Style Sheets
github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ grid-row-end: auto; /* <custom-ident> values */ grid-row-end: somegridarea; /* <integer> + <custom-ident> values */ grid-row-end: 2; grid-row-end: somegridarea 4; /* span + <integer> + <custom-ident> values */ grid-row-end: span 3; grid-row-end: span somegridarea; grid-row-end: 5 somegridarea span; /*
global values */ grid-row-end: inherit; grid-row-end: initial; grid-row-end: unset; values auto is a keyword indicating that the property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> if there is a named line with the name '<custom-ident>-end', it contributes the first such line to the grid item’s placem...
grid-row-start - CSS: Cascading Style Sheets
/interactive-examples and send us a pull request. syntax /* keyword value */ grid-row-start: auto; /* <custom-ident> values */ grid-row-start: somegridarea; /* <integer> + <custom-ident> values */ grid-row-start: 2; grid-row-start: somegridarea 4; /* span + <integer> + <custom-ident> values */ grid-row-start: span 3; grid-row-start: span somegridarea; grid-row-start: 5 somegridarea span; /*
global values */ grid-row-start: inherit; grid-row-start: initial; grid-row-start: unset; this property is specified as a single <grid-line> value. a <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or ...
inset-block-end - CSS: Cascading Style Sheets
riting mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-block-end: 3px; inset-block-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-end: 10%; /* keyword value */ inset-block-end: auto; /*
global values */ inset-block-end: inherit; inset-block-end: initial; inset-block-end: unset; syntax values the inset-block-end property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are l...
inset-block-start - CSS: Cascading Style Sheets
ode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-block-start: 3px; inset-block-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-start: 10%; /* keyword value */ inset-block-start: auto; /*
global values */ inset-block-start: inherit; inset-block-start: initial; inset-block-start: unset; syntax values the inset-block-start property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directio...
inset-block - CSS: Cascading Style Sheets
ponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ 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 conta...
inset-inline-end - CSS: Cascading Style Sheets
ng mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* keyword value */ inset-inline-end: auto; /*
global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; the shorthand for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-end property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame a...
inset-inline-start - CSS: Cascading Style Sheets
directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-start: 3px; inset-inline-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-start: 10%; /* keyword value */ inset-inline-start: auto; /*
global values */ inset-inline-start: inherit; inset-inline-start: initial; inset-inline-start: unset; the shorthand for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-start property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed val...
inset-inline - CSS: Cascading Style Sheets
to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-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 ...
inset - CSS: Cascading Style Sheets
ttom, 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; syntax values the inset 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...
isolation - CSS: Cascading Style Sheets
stacking context. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property is especially helpful when used in conjunction with mix-blend-mode. syntax /* keyword values */ isolation: auto; isolation: isolate; /*
global values */ isolation: inherit; isolation: initial; isolation: unset; the isolation property is specified as one of the keyword values listed below. values auto a new stacking context is created only if one of the properties applied to the element requires it. isolate a new stacking context must be created. formal definition initial valueautoapplies toall elements. in svg, it applies to...
justify-content - CSS: Cascading Style Sheets
end the items are packed flush to each other toward the end edge of the alignment container in the main axis. flex-start the items are packed flush to each other toward the edge of t...
justify-items - CSS: Cascading Style Sheets
baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center, start, end, flex-start, flex-end, self-start, self-end, left, or right. pl...
justify-self - CSS: Cascading Style Sheets
youts. */ justify-self: self-start; justify-self: self-end; justify-self: left; /* pack item from the left */ justify-self: right; /* pack item from the right */ /* baseline alignment */ justify-self: baseline; justify-self: first baseline; justify-self: last baseline; /* overflow alignment (for positional alignment only) */ justify-self: safe center; justify-self: unsafe center; /*
global values */ justify-self: inherit; justify-self: initial; justify-self: unset; this property can take one of three different forms: basic keywords: one of the keyword values normal, auto, or stretch. baseline alignment: the baseline keyword, plus optionally one of first or last. positional alignment: one of: center, start, end, flex-start, flex-end, self-start, self-end, left, or right...
left - CSS: Cascading Style Sheets
d elements. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ left: 3px; left: 2.4em; /* <percentage>s of the width of the containing block */ left: 10%; /* keyword value */ left: auto; /*
global values */ left: inherit; left: initial; left: unset; values <length> a negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the left edge of the containing block. for relatively positioned elements, the distance that the element is moved to the right of its normal position. <percentage> a <percentage> of the containing block's...
letter-spacing - CSS: Cascading Style Sheets
haracters closer together. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ letter-spacing: normal; /* <length> values */ letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /*
global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; values normal the normal letter spacing for the current font. unlike a value of 0, this keyword allows the user agent to alter the space between characters in order to justify text. <length> specifies extra inter-character space in addition to the default space between characters. values may be negative, bu...
line-height - CSS: Cascading Style Sheets
b repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ line-height: normal; /* unitless values: use this number multiplied by the element's font size */ line-height: 3.5; /* <length> values */ line-height: 3em; /* <percentage> values */ line-height: 34%; /*
global values */ line-height: inherit; line-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <number> a <length> a <percentage> the keyword normal. values normal depends on the user agent. desktop browsers (including firefox) use a default value of roughly 1.2, depending on the element's font-family. <number> (unitless) the used va...
list-style-image - CSS: Cascading Style Sheets
end us a pull request. note: this property is applied to list items, i.e. elements with display: list-item; by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. syntax /* keyword values */ list-style-image: none; /* <url> values */ list-style-image: url('starsolid.gif'); /*
global values */ list-style-image: inherit; list-style-image: initial; list-style-image: unset; values <url> location of image to use as the marker. none specifies that no image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. formal definition initial valuenoneapplies tolist itemsinheritedyescomputed valuenone or the image with its uri ...
list-style-position - CSS: Cascading Style Sheets
g behavior when a block element is placed first within a list element declared as list-style-position: inside. chrome and safari both place this element on the same line as the marker box, whereas firefox, internet explorer, and opera place it on the next line. for more information on this, see bug 36854. syntax /* keyword values */ list-style-position: inside; list-style-position: outside; /*
global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below. values inside the ::marker is the first element among the list item's contents. outside the ::marker is outside the principal block box. formal definition initial valueoutsideapplies tolist itemsinher...
list-style - CSS: Cascading Style Sheets
if list-style-type and list-style-image are both set, then list-style-type is used as a fallback if the image is unavailable. values list-style-type see list-style-type. list-style-image see list-style-image. list-style-position see li...
margin-block-end - CSS: Cascading Style Sheets
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ margin-block-end: 10px; /* an absolute length */ margin-block-end: 1em; /* relative to the text size */ margin-block-end: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-block-end: auto; /*
global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to margin-block-start, margin-inline-start, and margin-inline-end, which define the other margins of the element. values the...
margin-block-start - CSS: Cascading Style Sheets
te to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ margin-block-start: 10px; /* an absolute length */ margin-block-start: 1em; /* relative to the text size */ margin-block-start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-block-start: auto; /*
global values */ margin-block-start: inherit; margin-block-start: initial; margin-block-start: unset; it corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to margin-block-end, margin-inline-start, and margin-inline-end, which define the other margins of the element. values ...
margin-block - CSS: Cascading Style Sheets
margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-block: 10px 20px; /* an absolute length */ margin-block: 1em 2em; /* relative to the text size */ margin-block: 5% 2%; /* relative to the nearest block container's width */ margin-block: 10px; /* sets both start and end values */ /* keyword values */ margin-block: auto; /*
global values */ margin-block: inherit; margin-block: initial; margin-block: unset; these values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-block-end margin-block-start syn...
margin-bottom - CSS: Cascading Style Sheets
m/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. syntax /* <length> values */ margin-bottom: 10px; /* an absolute length */ margin-bottom: 1em; /* relative to the text size */ margin-bottom: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-bottom: auto; /*
global values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; the margin-bottom property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the b...
margin-inline-end - CSS: Cascading Style Sheets
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ margin-inline-end: 10px; /* an absolute length */ margin-inline-end: 1em; /* relative to the text size */ margin-inline-end: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-inline-end: auto; /*
global values */ margin-inline-end: inherit; margin-inline-end: initial; margin-inline-end: unset; it relates to margin-block-start, margin-block-end, and margin-inline-start, which define the other margins of the element. values the margin-inline-end property takes the same values as the margin-left property. formal definition initial value0applies tosame as margininheritednopercentagesdepends o...
margin-inline-start - CSS: Cascading Style Sheets
o the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ margin-inline-start: 10px; /* an absolute length */ margin-inline-start: 1em; /* relative to the text size */ margin-inline-start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-inline-start: auto; /*
global values */ margin-inline-start: inherit; it relates to margin-block-start, margin-block-end, and margin-inline-end, which define the other margins of the element. values the margin-inline-start 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, ...
margin-inline - CSS: Cascading Style Sheets
ding on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-inline: 10px 20px; /* an absolute length */ margin-inline: 1em 2em; /* relative to the text size */ margin-inline: 5% 2%; /* relative to the nearest block container's width */ margin-inline: 10px; /* sets both start and end values */ /* keyword values */ margin-inline: auto; /*
global values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; this property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-inline-end margin-inline-st...
margin-left - CSS: Cascading Style Sheets
ng, the content area, and margin-right are defined), margin-left is ignored, and will have the same calculated value as if the auto value was specified. syntax /* <length> values */ margin-left: 10px; /* an absolute length */ margin-left: 1em; /* relative to the text size */ margin-left: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-left: auto; /*
global values */ margin-left: inherit; margin-left: initial; margin-left: unset; the margin-left property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the left marg...
margin-right - CSS: Cascading Style Sheets
hub.com/mdn/interactive-examples and send us a pull request. the vertical margins of two adjacent boxes may fuse. this is called margin collapsing. syntax /* <length> values */ margin-right: 20px; /* an absolute length */ margin-right: 1em; /* relative to the text size */ margin-right: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-right: auto; /*
global values */ margin-right: inherit; margin-right: initial; margin-right: unset; the margin-right property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the right...
margin-top - CSS: Cascading Style Sheets
ps://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. syntax /* <length> values */ margin-top: 10px; /* an absolute length */ margin-top: 1em; /* relative to the text size */ margin-top: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-top: auto; /*
global values */ margin-top: inherit; margin-top: initial; margin-top: unset; the margin-top property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selec...
margin - CSS: Cascading Style Sheets
on-replaced inline elements, such as <span> or <code>. note: margins create extra space around an element. in contrast, padding creates extra space within an element. syntax /* apply to all four sides */ margin: 1em; margin: -3px; /* vertical | horizontal */ margin: 5% auto; /* top | horizontal | bottom */ margin: 1em auto 2em; /* top | right | bottom | left */ margin: 2px 1em 0 auto; /*
global values */ margin: inherit; margin: initial; margin: unset; the margin property may be specified using one, two, three, or four values. each value is a <length>, a <percentage>, or the keyword auto. negative values draw the element closer to its neighbors than it would be by default. when one value is specified, it applies the same margin to all four sides. when two values are specified, the...
mask-border-outset - CSS: Cascading Style Sheets
roperty specifies the distance by which an element's mask border is set out from its border box. syntax /* <length> value */ mask-border-outset: 1rem; /* <number> value */ mask-border-outset: 1.5; /* vertical | horizontal */ mask-border-outset: 1 1.2; /* top | horizontal | bottom */ mask-border-outset: 30px 2 45px; /* top | right | bottom | left */ mask-border-outset: 7px 12px 14px 5px; /*
global values */ mask-border-outset: inherit; mask-border-outset: initial; mask-border-outset: unset; the mask-border-outset property may be specified as one, two, three, or four values. each value is a <length> or <number>. negative values are invalid. when one value is specified, it applies the same outset to all four sides. when two values are specified, the first outset applies to the top and ...
mask-border-repeat - CSS: Cascading Style Sheets
the mask-border-repeat css property sets how the edge regions of a source image are adjusted to fit the dimensions of an element's mask border. syntax /* keyword value */ mask-border-repeat: stretch; mask-border-repeat: repeat; mask-border-repeat: round; mask-border-repeat: space; /* vertical | horizontal */ mask-border-repeat: round stretch; /*
global values */ mask-border-repeat: inherit; mask-border-repeat: initial; mask-border-repeat: unset; the mask-border-repeat property may be specified using one or two values chosen from the list of values below. when one value is specified, it applies the same behavior on all four sides. when two values are specified, the first applies to the top and bottom, the second to the left and right. values stretch the source image's edge region...
mask-border-slice - CSS: Cascading Style Sheets
source into regions. these regions are used to form the components of an element's mask border. syntax /* all sides */ mask-border-slice: 30%; /* vertical | horizontal */ mask-border-slice: 10% 30%; /* top | horizontal | bottom */ mask-border-slice: 30 30% 45; /* top | right | bottom | left */ mask-border-slice: 7 12 14 5; /* using the `fill` keyword */ mask-border-slice: 10% fill 7 12; /*
global values */ mask-border-slice: inherit; mask-border-slice: initial; mask-border-slice: unset; the mask-border-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at ...
mask-border-source - CSS: Cascading Style Sheets
source css property sets the source image used to create an element's mask border. the mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. syntax /* keyword value */ mask-border-source: none; /* <image> values */ mask-border-source: url(image.jpg); mask-border-source: linear-gradient(to top, red, yellow); /*
global values */ mask-border-source: inherit; mask-border-source: initial; mask-border-source: unset; values none no mask border is used. <image> image reference to use for the mask border. formal definition initial valuenoneapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specified, but with <url>...
mask-border-width - CSS: Cascading Style Sheets
border. syntax /* keyword value */ mask-border-width: auto; /* <length> value */ mask-border-width: 1rem; /* <percentage> value */ mask-border-width: 25%; /* <number> value */ mask-border-width: 3; /* vertical | horizontal */ mask-border-width: 2em 3em; /* top | horizontal | bottom */ mask-border-width: 5% 15% 10%; /* top | right | bottom | left */ mask-border-width: 5% 2em 10% auto; /*
global values */ mask-border-width: inherit; mask-border-width: initial; mask-border-width: unset; the mask-border-width property may be specified using one, two, three, or four values chosen from the list of values below. when one value is specified, it applies the same width to all four sides. when two values are specified, the first width applies to the top and bottom, the second to the left an...
mask-clip - CSS: Cascading Style Sheets
values content-box the painted content is clipped to the content box. padding-box the painted content is clipped to the padding box. border-box the painted content is clipped to the border box. margin-box the painted content is clipped to t...
mask-composite - CSS: Cascading Style Sheets
the mask-composite css property represents a compositing operation used on the current mask layer with the mask layers below it. /* keyword values */ mask-composite: add; mask-composite: subtract; mask-composite: intersect; mask-composite: exclude; /*
global values */ mask-composite: inherit; mask-composite: initial; mask-composite: unset; syntax one or more of the keyword values listed below, separated by commas. values for the composition the current mask layer is referred to as source, while all layers below it are referred to as destination. add the source is placed over the destination. subtract the source is placed, where it falls outside of the destination. intersect the parts of source that overlap the destination, replace the destination. exclude the non-overlapping re...
mask-image - CSS: Cascading Style Sheets
the image that is used as mask layer for an element. /* keyword value */ mask-image: none; /* <mask-source> value */ mask-image: url(masks.svg#mask1); /* <image> values */ mask-image: linear-gradient(rgba(0, 0, 0, 1.0), transparent); mask-image: image(url(mask.png), skyblue); /* multiple values */ mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /*
global values */ mask-image: inherit; mask-image: initial; mask-image: unset; syntax values none this keyword is interpreted as a transparent black image layer. <mask-source> a <url> reference to a <mask> or to a css image. <image> an image value used as mask image layer. formal definition initial valuenoneapplies toall elements; in svg, it applies to container elements excluding the defs ...
mask-mode - CSS: Cascading Style Sheets
the mask-mode css property sets whether the mask reference defined by mask-image is treated as a luminance or alpha mask. /* keyword values */ mask-mode: alpha; mask-mode: luminance; mask-mode: match-source; /* multiple values */ mask-mode: alpha, match-source; /*
global values */ mask-mode: inherit; mask-mode: initial; mask-mode: unset; syntax the mask-mode property is specified as one or more of the keyword values listed below, separated by commas. values alpha this keyword indicates that the transparency (alpha channel) values of the mask layer image should be used as the mask values. luminance this keyword indicates that the luminance values of the mask layer image should be used as the mask values. match-source if the mask-image property is of type <mask-source>, the lumi...
mask-origin - CSS: Cascading Style Sheets
in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as multiple boxes, such as inline boxes on several lines or boxes on several pages, it specifies ...
mask-position - CSS: Cascading Style Sheets
relative to the mask position layer set by mask-origin, for each defined mask image. /* keyword values */ mask-position: top; mask-position: bottom; mask-position: left; mask-position: right; mask-position: center; /* <position> values */ mask-position: 25% 75%; mask-position: 0px 0px; mask-position: 10% 8em; /* multiple values */ mask-position: top right; mask-position: 1rem 1rem, center; /*
global values */ mask-position: inherit; mask-position: initial; mask-position: unset; syntax one or more <position> values, separated by commas. values <position> one to four values representing a 2d position regarding the edges of the element's box. relative or absolute offsets can be given. note that the position can be set outside of the element's box. formal definition initial valuecent...
mask - CSS: Cascading Style Sheets
px */ mask: url(masks.svg#star) repeat-x; /* element within svg graphic used as horizontally repeated mask */ mask: url(masks.svg#star) stroke-box; /* element within svg graphic used as mask extending to the box enclosed by the stroke */ mask: url(masks.svg#star) exclude; /* element within svg graphic used as mask and combined with background using non-overlapping parts */ /*
global values */ mask: inherit; mask: initial; mask: unset; /* multiple masks */ mask: url(masks.svg#star) left / 16px repeat-y, /* element within svg graphic is used as a mask on the left-hand side with a width of 16px */ url(masks.svg#circle) right / 16px repeat-y; /* element within svg graphic is used as a mask on the right-hand side with a width of 16px */ values <mask-reference> set...
max-block-size - CSS: Cascading Style Sheets
o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ max-block-size: 300px; max-block-size: 25em; /* <percentage> values */ max-block-size: 75%; /* keyword values */ max-block-size: auto; max-block-size: max-content; max-block-size: min-content; max-block-size: fit-content(20em); /*
global values */ max-block-size: inherit; max-block-size: initial; max-block-size: unset; values the max-block-size property's value can be any value that's legal for the max-width and max-height properties: <length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the containing block's width. auto the browser will calculate and select a max-w...
max-height - CSS: Cascading Style Sheets
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. max-height overrides height, but min-height overrides max-height. syntax /* <length> value */ max-height: 3.5em; /* <percentage> value */ max-height: 75%; /* keyword values */ max-height: none; max-height: max-content; max-height: min-content; max-height: fit-content(20em); /*
global values */ max-height: inherit; max-height: initial; max-height: unset; values <length> defines the max-height as an absolute value. <percentage> defines the max-height as a percentage of the containing block's height. auto the browser will calculate and select a max-height for the specified element. none no limit on the size of the box. max-content the intrinsic preferred max-height...
max-inline-size - CSS: Cascading Style Sheets
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ max-inline-size: 300px; max-inline-size: 25em; /* <percentage> values */ max-inline-size: 75%; /* keyword values */ max-inline-size: auto; max-inline-size: max-content; max-inline-size: min-content; max-inline-size: fit-content(20em); /*
global values */ max-inline-size: inherit; max-inline-size: initial; max-inline-size: unset; values the max-inline-size property takes the same values as the max-width and max-height properties. formal definition initial value0applies tosame as width and heightinheritednopercentagesinline-size of containing blockcomputed valuesame as max-width and max-heightanimation typea length, percentage or cal...
max-width - CSS: Cascading Style Sheets
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. max-width overrides width, but min-width overrides max-width. syntax /* <length> value */ max-width: 3.5em; /* <percentage> value */ max-width: 75%; /* keyword values */ max-width: none; max-width: max-content; max-width: min-content; max-width: fit-content(20em); /*
global values */ max-width: inherit; max-width: initial; max-width: unset; values <length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the containing 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-c...
min-block-size - CSS: Cascading Style Sheets
sitory. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ min-block-size: 100px; min-block-size: 5em; /* <percentage> values */ min-block-size: 10%; /* keyword values */ min-block-size: max-content; min-block-size: min-content; min-block-size: fit-content(20em); /*
global values */ min-block-size: inherit; min-block-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 ...
min-height - CSS: Cascading Style Sheets
t, please clone https://github.com/mdn/interactive-examples and send us a pull request. the element's height is set to the value of min-height whenever min-height is larger than max-height or height. syntax /* <length> value */ min-height: 3.5em; /* <percentage> value */ min-height: 10%; /* keyword values */ min-height: max-content; min-height: min-content; min-height: fit-content(20em); /*
global values */ min-height: inherit; min-height: initial; min-height: unset; values <length> defines the min-height as an absolute value. <percentage> defines the min-height as a percentage of the containing block's height. auto the browser will calculate and select a min-height for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-height...
min-inline-size - CSS: Cascading Style Sheets
. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ min-inline-size: 100px; min-inline-size: 5em; /* <percentage> values */ min-inline-size: 10%; /* keyword values */ min-inline-size: max-content; min-inline-size: min-content; min-inline-size: fit-content(20em); /*
global values */ min-inline-size: inherit; min-inline-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 ...
min-width - CSS: Cascading Style Sheets
les project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the element's width is set to the value of min-width whenever min-width is larger than max-width or width. syntax /* <length> value */ min-width: 3.5em; /* <percentage> value */ min-width: 10%; /* keyword values */ min-width: max-content; min-width: min-content; min-width: fit-content(20em); /*
global values */ min-width: inherit; min-width: initial; min-width: unset; values <length> defines the min-width as an absolute value. <percentage> defines the min-width as a percentage of the containing block's width. auto the browser will calculate and select a min-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-width. min-c...
object-position - CSS: Cascading Style Sheets
e) is adjusted to fit within the element's box using the object-fit property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <position> values */ object-position: center top; object-position: 100px 50px; /*
global values */ object-position: inherit; object-position: initial; object-position: unset; values <position> from one to four values that define the 2d position of the element. relative or absolute offsets can be used. note: the position can be set so that the replaced element is drawn outside its box. formal definition initial value50% 50%applies toreplaced elementsinheritedyespercentages...
offset-path - CSS: Cascading Style Sheets
offset-path: ray(45deg closest-side contain); /* url */ offset-path: url(#path); /* shapes */ offset-path: circle(50% at 25% 25%); offset-path: inset(50% 50% 50% 50%); offset-path: polygon(30% 0%, 70% 0%, 100% 50%, 30% 100%, 0% 70%, 0% 30%); offset-path: path('m 0,200 q 200,200 260,80 q 290,20 400,0 q 300,100 400,200'); /* geometry boxes */ offset-path: margin-box; offset-path: stroke-box; /*
global values */ offset-path: inherit; offset-path: initial; offset-path: unset; values ray() taking up to three values, defines a path that is a line segment starting from the position of the box and proceeds in the direction defined by the specified angle similar to the css gradient angle where 0deg is up, with positive angles increasing in the clockwise direction, with the size value being simi...
offset-position - CSS: Cascading Style Sheets
<position> a <position>. a position defines an x/y coordinate, to place an item relative to the edges of an element's box. it can be defined using one to four values. if two non-keyword values are used, the fi...
order - CSS: Cascading Style Sheets
ex or grid container. items in a container are sorted by ascending order value and then by their source code order. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <integer> values */ order: 5; order: -5; /*
global values */ order: inherit; order: initial; order: unset; since order is only meant to affect the visual order of elements and not their logical or tab order. order must not be used on non-visual media such as speech. values <integer> represents the ordinal group to be used by the item. accessibility concerns using the order property will create a disconnect between the visual presentatio...
orphans - CSS: Cascading Style Sheets
(the paragraph continues on a following page.) syntax values <integer> the minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. the value must be positive. ...
outline-color - CSS: Cascading Style Sheets
lement's outline. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <color> values */ outline-color: #f92525; outline-color: rgb(30,222,121); outline-color: blue; /* keyword value */ outline-color: invert; /*
global values */ outline-color: inherit; outline-color: initial; outline-color: unset; the outline-color property is specified as any one of the values listed below. values <color> the color of the outline, specified as a <color>. invert to ensure the outline is visible, performs a color inversion of the background. note that browsers are not required to support this value; if they don't, this ...
outline-offset - CSS: Cascading Style Sheets
ss property sets the amount of space between an outline and the edge or border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ outline-offset: 3px; outline-offset: 0.2em; /*
global values */ outline-offset: inherit; outline-offset: initial; outline-offset: unset; values <length> the width of the space between the element and its outline. a negative value places the outline inside the element. a value of 0 places the outline so that there is no space between it and the element. description an outline is a line that is drawn around an element, outside the border edge...
outline-style - CSS: Cascading Style Sheets
les and send us a pull request. it is often more convenient to use the shorthand property outline when defining the appearance of an outline. syntax /* keyword values */ outline-style: auto; outline-style: none; outline-style: dotted; outline-style: dashed; outline-style: solid; outline-style: double; outline-style: groove; outline-style: ridge; outline-style: inset; outline-style: outset; /*
global values */ outline-style: inherit; outline-style: initial; outline-style: unset; the outline-style property is specified as any one of the values listed below. values auto permits the user agent to render a custom outline style. none no outline is used. the outline-width is 0. dotted the outline is a series of dots. dashed the outline is a series of short line segments...
outline-width - CSS: Cascading Style Sheets
e to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often more convenient to use the shorthand property outline when defining the appearance of an outline. syntax /* keyword values */ outline-width: thin; outline-width: medium; outline-width: thick; /* <length> values */ outline-width: 1px; outline-width: 0.1em; /*
global values */ outline-width: inherit; the outline-width property is specified as any one of the values listed below. values <length> the width of the outline specified as a <length>. thin depends on the user agent. typically equivalent to 1px in desktop browsers (including firefox). medium depends on the user agent. typically equivalent to 3px in desktop browsers (including firefox). thic...
outline - CSS: Cascading Style Sheets
ase 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 of the values does not matter. note: the outline will be invisible for many elements if its style is not defined. this is because the style defaults to none. a notable exception is input elements, which are given default styling by ...
overflow-anchor - CSS: Cascading Style Sheets
position to minimize content shifts. scroll anchoring behavior is enabled by default in any browser that supports it. therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /*
global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. none the element won't be selected as a potential anchor. formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | none examples preve...
overflow-block - CSS: Cascading Style Sheets
k css property sets what shows when content overflows the block start and block end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-block property maps to overflow-y or overflow-x depending on the writing mode of the document. syntax /* keyword values */ overflow-block: visible; overflow-block: hidden; overflow-block: scroll; overflow-block: auto; /*
global values */ overflow-block: inherit; overflow-block: initial; overflow-block: unset; the overflow-block property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's block start and block end edges. hidden content is clipped if necessary to fit the block dimension in the padding box. no sc...
overflow-inline - CSS: Cascading Style Sheets
e css property sets what shows when content overflows the inline start and end edges of a box. this may be nothing, a scroll bar, or the overflow content. the overflow-inline property maps to overflow-y or overflow-x depending on the writing mode of the document. syntax /* keyword values */ overflow-inline: visible; overflow-inline: hidden; overflow-inline: scroll; overflow-inline: auto; /*
global values */ overflow-inline: inherit; overflow-inline: initial; overflow-inline: unset; the overflow-inline property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's inline start and end edges. hidden content is clipped if necessary to fit the inline dimension in the padding box. no sc...
overflow-wrap - CSS: Cascading Style Sheets
re word cannot be placed on its own line without overflowing. the property was originally a nonstandard and unprefixed microsoft extension called word-wrap, and was implemented by most browsers with the same name. it has since been renamed to overflow-wrap, with word-wrap being an alias. syntax /* keyword values */ overflow-wrap: normal; overflow-wrap: break-word; overflow-wrap: anywhere; /*
global values */ overflow-wrap: inherit; overflow-wrap: initial; overflow-wrap: unset; the overflow-wrap property is specified as a single keyword chosen from the list of values below. values normal lines may only break at normal word break points (such as a space between two words). anywhere to prevent overflow, an otherwise unbreakable string of characters — like a long word or url — may ...
overflow-x - CSS: Cascading Style Sheets
g, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ overflow-x: visible; overflow-x: hidden; overflow-x: clip; overflow-x: scroll; overflow-x: auto; /*
global values */ overflow-x: inherit; overflow-x: initial; overflow-x: unset; the overflow-x property is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's left and right edges. if overflow-y is hidden, scroll or auto and this property is visible, it will implicitly compute to auto. hidden conte...
overflow-y - CSS: Cascading Style Sheets
g, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ overflow-y: visible; overflow-y: hidden; overflow-y: clip; overflow-y: scroll; overflow-y: auto; /*
global values */ overflow-y: inherit; overflow-y: initial; overflow-y: unset; the overflow-y property is specified as a single keyword chosen from the list of values below. if overflow-x is hidden, scroll or auto and this property is visible (default) it will implicitly compute to auto. values visible content is not clipped and may be rendered outside the padding box's top and bottom edges. hid...
overflow - CSS: Cascading Style Sheets
e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: overflow-x overflow-y syntax /* keyword values */ overflow: visible; overflow: hidden; overflow: clip; overflow: scroll; overflow: auto; overflow: hidden visible; /*
global values */ overflow: inherit; overflow: initial; overflow: unset; the overflow property is specified as one or two keywords chosen from the list of values below. if two keywords are specified, the first applies to overflow-x and the second to overflow-y. otherwise, both overflow-x and overflow-y are set to the same value. values visible content is not clipped and may be rendered outside the...
overscroll-behavior-block - CSS: Cascading Style Sheets
the overscroll-behavior-block css property sets the browser's behavior when the block direction boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-block: auto; /* default */ overscroll-behavior-block: contain; overscroll-behavior-block: none; /*
global values */ overscroll-behavior-block: inherit; overscroll-behavior-block: initial; overscroll-behavior-block: unset; syntax the overscroll-behavior-block property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to nei...
overscroll-behavior-inline - CSS: Cascading Style Sheets
the overscroll-behavior-inline css property sets the browser's behavior when the inline direction boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-inline: auto; /* default */ overscroll-behavior-inline: contain; overscroll-behavior-inline: none; /*
global values */ overscroll-behavior-inline: inherit; overscroll-behavior-inline: initial; overscroll-behavior-inline: unset; syntax the overscroll-behavior-inline property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occu...
overscroll-behavior-x - CSS: Cascading Style Sheets
the overscroll-behavior-x css property sets the browser's behavior when the horizontal boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-x: auto; /* default */ overscroll-behavior-x: contain; overscroll-behavior-x: none; /*
global values */ overscroll-behavior-x: inherit; overscroll-behavior-x: initial; overscroll-behavior-x: unset; syntax the overscroll-behavior-x property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. under...
overscroll-behavior-y - CSS: Cascading Style Sheets
the overscroll-behavior-y css property sets the browser's behavior when the vertical boundary of a scrolling area is reached. see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-y: auto; /* default */ overscroll-behavior-y: contain; overscroll-behavior-y: none; /*
global values */ overscroll-behavior-y: inherit; overscroll-behavior-y: initial; overscroll-behavior-y: unset; initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax the overscroll-behavior-y property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is ob...
overscroll-behavior - CSS: Cascading Style Sheets
the overscroll-behavior css property sets what a browser does when reaching the boundary of a scrolling area. it's a shorthand for overscroll-behavior-x and overscroll-behavior-y. /* keyword values */ overscroll-behavior: auto; /* default */ overscroll-behavior: contain; overscroll-behavior: none; /* two values */ overscroll-behavior: auto contain; /*
global values */ overscroll-behavior: inherit; overscroll-behavior: initial; overscroll-behavior: unset; by default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached. you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying pag...
padding-block-end - CSS: Cascading Style Sheets
bute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ padding-block-end: 10px; /* an absolute length */ padding-block-end: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-block-end: 5%; /* a padding relative to the block container's width */ /*
global values */ padding-block-end: inherit; padding-block-end: initial; padding-block-end: unset; values the padding-block-end property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to ...
padding-block-start - CSS: Cascading Style Sheets
o the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ padding-block-start: 10px; /* an absolute length */ padding-block-start: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-block-start: 5%; /* a padding relative to the block container's width */ /*
global values */ padding-block-start: inherit; padding-block-start: initial; padding-block-start: unset; values the padding-block-start property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it rel...
padding-block - CSS: Cascading Style Sheets
cal padding properties depending on the element's writing mode, directionality, and text orientation. /* <length> values */ padding-block: 10px 20px; /* an absolute length */ padding-block: 1em 2em; /* relative to the text size */ padding-block: 10px; /* sets both start and end values */ /* <percentage> values */ padding-block: 5% 2%; /* relative to the nearest block container's width */ /*
global values */ padding-block: inherit; padding-block: initial; padding-block: unset; these values corresponds to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: padding-block-end padding-block-st...
padding-bottom - CSS: Cascading Style Sheets
ub.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. syntax /* <length> values */ padding-bottom: 0.5em; padding-bottom: 0; padding-bottom: 2cm; /* <percentage> value */ padding-bottom: 10%; /*
global values */ padding-bottom: inherit; padding-bottom: initial; padding-bottom: unset; the padding-bottom property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of t...
padding-inline-end - CSS: Cascading Style Sheets
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ padding-inline-end: 10px; /* an absolute length */ padding-inline-end: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-inline-end: 5%; /* a padding relative to the block container's width */ /*
global values */ padding-inline-end: inherit; padding-inline-end: initial; padding-inline-end: unset; values the padding-inline-end property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates...
padding-inline-start - CSS: Cascading Style Sheets
bute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ padding-inline-start: 10px; /* an absolute length */ padding-inline-start: 1em; /* a length relative to the text size */ /* <percentage> value */ padding-inline-start: 5%; /* a padding relative to the block container's width */ /*
global values */ padding-inline-start: inherit; padding-inline-start: initial; padding-inline-start: unset; values the padding-inline-start property takes the same values as the padding-left property. description this property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. i...
padding-inline - CSS: Cascading Style Sheets
padding properties depending on the element's writing mode, directionality, and text orientation. /* <length> values */ padding-inline: 10px 20px; /* an absolute length */ padding-inline: 1em 2em; /* relative to the text size */ padding-inline: 10px; /* sets both start and end values */ /* <percentage> values */ padding-inline: 5% 2%; /* relative to the nearest block container's width */ /*
global values */ padding-inline: inherit; padding-inline: initial; padding-inline: unset; constituent properties this property is a shorthand for the following css properties: padding-inline-end padding-inline-start syntax values the padding-inline property takes the same values as the padding-left property. description values for this property correspond to the padding-top and padding-bott...
padding-left - CSS: Cascading Style Sheets
tps://github.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. syntax /* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /*
global values */ padding-left: inherit; padding-left: initial; padding-left: unset; the padding-left property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the conta...
padding-right - CSS: Cascading Style Sheets
//github.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. syntax /* <length> values */ padding-right: 0.5em; padding-right: 0; padding-right: 2cm; /* <percentage> value */ padding-right: 10%; /*
global values */ padding-right: inherit; padding-right: initial; padding-right: unset; the padding-right property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the c...
padding-top - CSS: Cascading Style Sheets
https://github.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. syntax /* <length> values */ padding-top: 0.5em; padding-top: 0; padding-top: 2cm; /* <percentage> value */ padding-top: 10%; /*
global values */ padding-top: inherit; padding-top: initial; padding-top: unset; the padding-top property is specified as a single value chosen from the list below. unlike margins, negative values are not allowed for padding. values <length> the size of the padding as a fixed value. must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the containin...
padding - CSS: Cascading Style Sheets
s extra space around an element. constituent properties this property is a shorthand for the following css properties: padding-bottom padding-left padding-right padding-top syntax /* apply to all four sides */ padding: 1em; /* vertical | horizontal */ padding: 5% 10%; /* top | horizontal | bottom */ padding: 1em 2em 2em; /* top | right | bottom | left */ padding: 5px 1em 0 2em; /*
global values */ padding: inherit; padding: initial; padding: unset; the padding property may be specified using one, two, three, or four values. each value is a <length> or a <percentage>. negative values are invalid. when one value is specified, it applies the same padding to all four sides. when two values are specified, the first padding applies to the top and bottom, the second to the left an...
page-break-after - CSS: Cascading Style Sheets
this property has been replaced by the break-after property. the page-break-after css property adjusts page breaks after the current element. /* keyword values */ page-break-after: auto; page-break-after: always; page-break-after: avoid; page-break-after: left; page-break-after: right; page-break-after: recto; page-break-after: verso; /*
global values */ page-break-after: inherit; page-break-after: initial; page-break-after: unset; this property applies to block elements that generate a box. it won't apply on an empty <div> that won't generate a box. syntax values auto initial value. automatic page breaks (neither forced nor forbidden). always always force page breaks after the element. avoid avoid page breaks after the element. left force page breaks after the element so that...
page-break-before - CSS: Cascading Style Sheets
ak-before css property adjusts page breaks before the current element. this property applies to block elements that generate a box. it won't apply on an empty <div> that won't generate a box. /* keyword values */ page-break-before: auto; page-break-before: always; page-break-before: avoid; page-break-before: left; page-break-before: right; page-break-before: recto; page-break-before: verso; /*
global values */ page-break-before: inherit; page-break-before: initial; page-break-before: unset; syntax values auto initial value. automatic page breaks (neither forced nor forbidden). always always force page breaks before the element. avoid avoid page breaks before the element. left force page breaks before the element so that the next page is formatted as a left page. right force pa...
page-break-inside - CSS: Cascading Style Sheets
automatic page breaks (neither forced nor forbidden). avoid avoid page breaks inside the element. page break aliases the page-break-inside property is now a legacy property, replaced by break-inside. ...
perspective-origin - CSS: Cascading Style Sheets
ild transformed in 3-dimensional space, unlike the perspective() transform function which is placed on the element being transformed. syntax /* one-value syntax */ perspective-origin: x-position; /* two-value syntax */ perspective-origin: x-position y-position; /* when both x-position and y-position are keywords, the following is also valid */ perspective-origin: y-position x-position; /*
global values */ perspective-origin: inherit; perspective-origin: initial; perspective-origin: unset; values x-position indicates the position of the abscissa of the vanishing point. it can have one of the following values: <length-percentage> indicating the position as an absolute length value or relative to the width of the element. the value may be negative. left, a keyword being a shortc...
perspective - CSS: Cascading Style Sheets
in order to give a 3d-positioned element some perspective. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ perspective: none; /* <length> values */ perspective: 20px; perspective: 3.5em; /*
global values */ perspective: inherit; perspective: initial; perspective: unset; values none indicates that no perspective transform is to be applied. <length> a <length> giving the distance from the user to the z=0 plane. it is used to apply a perspective transform to the element and its content. if the value is 0 or a negative number, no perspective transform is applied. description each 3d...
place-content - CSS: Cascading Style Sheets
important: if the second value is not present, the first value is used for both, provided it is a valid value for both. if it is invalid for one or the other, the whole value will be invalid. values start the items are pa...
place-self - CSS: Cascading Style Sheets
normal the effect of this keyword is dependent of the layout mode we are in: in absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes. in static position ...
pointer-events - CSS: Cascading Style Sheets
values auto the element behaves as it would if the pointer-events property were not specified. in svg content, this value and the value visiblepainted have the same effect. none the element is never the targe...
quotes - CSS: Cascading Style Sheets
you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ quotes: none; quotes: auto; /* <string> values */ quotes: "«" "»"; /* set open-quote and close-quote to the french quotation marks */ quotes: "«" "»" "‹" "›"; /* set two levels of quotation marks */ /*
global values */ quotes: inherit; quotes: initial; quotes: unset; values none the open-quote and close-quote values of the content property produce no quotation marks. auto appropriate quote marks will be used for whatever language value is set on the selected elements (i.e. via the lang attribute). [<string> <string>]+ one or more pairs of <string> values for open-quote and close-quote. the f...
resize - CSS: Cascading Style Sheets
esizable, and if so, in which directions. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ resize: none; resize: both; resize: horizontal; resize: vertical; resize: block; resize: inline; /*
global values */ resize: inherit; resize: initial; resize: unset; the resize property is specified as a single keyword value from the list below. values none the element offers no user-controllable method for resizing it. both the element displays a mechanism for allowing the user to resize it, which may be resized both horizontally and vertically. horizontal the element displays a mechanism...
revert - CSS: Cascading Style Sheets
t 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;">this will still have font-weight: normal, but color: black</h3> <p>just some tex...
right - CSS: Cascading Style Sheets
ements. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ right: 3px; right: 2.4em; /* <percentage>s of the width of the containing block */ right: 10%; /* keyword value */ right: auto; /*
global values */ right: inherit; right: initial; right: unset; values <length> a negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the right edge of the containing block. for relatively positioned elements, the distance that the element is moved to the left of its normal position. <percentage> a <percentage> of the containing bloc...
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
defined the grid-row-gap property. this prefixed property is being replaced by row-gap. however, in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* <length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /*
global values */ row-gap: inherit; row-gap: initial; row-gap: unset; values <length-percentage> is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element. formal definition initial valuenormalapplies tomulti-column elements, flex containers, grid containersinheritednopercentagesrefer to corresponding dimension of the content areacomputed va...
ruby-position - CSS: Cascading Style Sheets
the ruby-position css property defines the position of a ruby element relatives to its base element. it can be position over the element (over), under it (under), or between the characters, on their right side (inter-character). /* keyword values */ ruby-position: over; ruby-position: under; ruby-position: inter-character; /*
global values */ ruby-position: inherit; ruby-position: initial; ruby-position: unset; syntax values over is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. inter-character is a keyword indicating that the ruby has to be placed ...
scroll-behavior - CSS: Cascading Style Sheets
te that any other scrolls, such as those performed by the user, are not affected by this property. when this property is specified on the root element, it applies to the viewport instead. this property specified on the body element will not propagate to the viewport. user agents are allowed to ignore this property. syntax /* keyword values */ scroll-behavior: auto; scroll-behavior: smooth; /*
global values */ scroll-behavior: inherit; scroll-behavior: initial; scroll-behavior: unset; the scroll-behavior property is specified as one of the keyword values listed below. values auto the scrolling box scrolls instantly. smooth the scrolling box scrolls in a smooth fashion using a user-agent-defined timing function over a user-agent-defined period of time. user agents should follow platfo...
scroll-margin-block-end - CSS: Cascading Style Sheets
e scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-block-end: 10px; scroll-margin-block-end: 1em; /*
global values */ scroll-margin-block-end: inherit; scroll-margin-block-end: initial; scroll-margin-block-end: unset; values <length> an outset from the block end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status ...
scroll-margin-block-start - CSS: Cascading Style Sheets
oll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-block-start: 10px; scroll-margin-block-start: 1em; /*
global values */ scroll-margin-block-start: inherit; scroll-margin-block-start: initial; scroll-margin-block-start: unset; values <length> an outset from the block start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification st...
scroll-margin-block - CSS: Cascading Style Sheets
repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: scroll-margin-block-end scroll-margin-block-start syntax /* <length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /*
global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; values <length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, fin...
scroll-margin-bottom - CSS: Cascading Style Sheets
in the scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-bottom: 10px; scroll-margin-bottom: 1em; /*
global values */ scroll-margin-bottom: inherit; scroll-margin-bottom: initial; scroll-margin-bottom: unset; values <length> an outset from the bottom edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status comment ...
scroll-margin-inline-end - CSS: Cascading Style Sheets
scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-inline-end: 10px; scroll-margin-inline-end: 1em; /*
global values */ scroll-margin-inline-end: inherit; scroll-margin-inline-end: initial; scroll-margin-inline-end: unset; values <length> an outset from the inline end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> examples simple demonstration this example im...
scroll-margin-inline-start - CSS: Cascading Style Sheets
ll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-inline-start: 10px; scroll-margin-inline-start: 1em; /*
global values */ scroll-margin-inline-start: inherit; scroll-margin-inline-start: initial; scroll-margin-inline-start: unset; values <length> an outset from the inline start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> examples simple demonstration this ex...
scroll-margin-inline - CSS: Cascading Style Sheets
the scroll-margin-inline shorthand property sets the scroll margins of an element in the inline dimension. constituent properties this property is a shorthand for the following css properties: scroll-margin-inline-end scroll-margin-inline-start syntax /* <length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /*
global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; values <length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned ...
scroll-margin-left - CSS: Cascading Style Sheets
ned in the scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-left: 10px; scroll-margin-left: 1em; /*
global values */ scroll-margin-left: inherit; scroll-margin-left: initial; scroll-margin-left: unset; values <length> an outset from the left edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status comment ...
scroll-margin-right - CSS: Cascading Style Sheets
d in the scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-right: 10px; scroll-margin-right: 1em; /*
global values */ scroll-margin-right: inherit; scroll-margin-right: initial; scroll-margin-right: unset; values <length> an outset from the right edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status comment ...
scroll-margin-top - CSS: Cascading Style Sheets
ligned in the scroll container’s coordinate space), then adding the specified outsets. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ scroll-margin-top: 10px; scroll-margin-top: 1em; /*
global values */ scroll-margin-top: inherit; scroll-margin-top: initial; scroll-margin-top: unset; values <length> an outset from the top edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <length> specifications specification status comment css ...
scroll-margin - CSS: Cascading Style Sheets
e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top syntax /* <length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /*
global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; values <length> an outset from the corresponding edge of the scroll container. description you can see the effect of scroll-margin by scrolling to a point partway between two of the "pages" of the example's content. the value specified for scroll-margin determines how much of the page that's primarily outside...
scroll-padding-block-end - CSS: Cascading Style Sheets
ce for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-block-end: auto; /* <length> values */ scroll-padding-block-end: 10px; scroll-padding-block-end: 1em; scroll-padding-block-end: 10%; /*
global values */ scroll-padding-block-end: inherit; scroll-padding-block-end: initial; scroll-padding-block-end: unset; values <length-percentage> an inwards offset from the block end edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is...
scroll-padding-block-start - CSS: Cascading Style Sheets
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 /* keyword values */ scroll-padding-block-start: auto; /* <length> values */ scroll-padding-block-start: 10px; scroll-padding-block-start: 1em; scroll-padding-block-start: 10%; /*
global values */ scroll-padding-block-start: inherit; scroll-padding-block-start: initial; scroll-padding-block-start: unset; values <length-percentage> an inwards offset from the block start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero ...
scroll-padding-block - CSS: Cascading Style Sheets
ut more breathing room between a targeted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-block-end scroll-padding-block-start syntax /* keyword values */ scroll-padding-block: auto; /* <length> values */ scroll-padding-block: 10px; scroll-padding-block: 1em .5em; scroll-padding-block: 10%; /*
global values */ scroll-padding-block: inherit; scroll-padding-block: initial; scroll-padding-block: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more ap...
scroll-padding-bottom - 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 /* keyword values */ scroll-padding-bottom: auto; /* <length> values */ scroll-padding-bottom: 10px; scroll-padding-bottom: 1em; scroll-padding-bottom: 10%; /*
global values */ scroll-padding-bottom: inherit; scroll-padding-bottom: initial; scroll-padding-bottom: unset; values <length-percentage> an inwards offset from the bottom edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more approp...
scroll-padding-inline-end - CSS: Cascading Style Sheets
or this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-inline-end: auto; /* <length> values */ scroll-padding-inline-end: 10px; scroll-padding-inline-end: 1em; scroll-padding-inline-end: 10%; /*
global values */ scroll-padding-inline-end: inherit; scroll-padding-inline-end: initial; scroll-padding-inline-end: unset; values <length-percentage> an inwards offset from the inline end edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero valu...
scroll-padding-inline-start - CSS: Cascading Style Sheets
interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-inline-start: auto; /* <length> values */ scroll-padding-inline-start: 10px; scroll-padding-inline-start: 1em; scroll-padding-inline-start: 10%; /*
global values */ scroll-padding-inline-start: inherit; scroll-padding-inline-start: initial; scroll-padding-inline-start: unset; values <length-percentage> an inwards offset from the inline start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-z...
scroll-padding-inline - CSS: Cascading Style Sheets
breathing room between a targetted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-inline-end scroll-padding-inline-start syntax /* keyword values */ scroll-padding-inline: auto; /* <length> values */ scroll-padding-inline: 10px; scroll-padding-inline: 1em .5em; scroll-padding-inline: 10%; /*
global values */ scroll-padding-inline: inherit; scroll-padding-inline: initial; scroll-padding-inline: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more...
scroll-padding-left - CSS: Cascading Style Sheets
ollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-left: auto; /* <length> values */ scroll-padding-left: 10px; scroll-padding-left: 1em; scroll-padding-left: 10%; /*
global values */ scroll-padding-left: inherit; scroll-padding-left: initial; scroll-padding-left: unset; values <length-percentage> an inwards offset from the left edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. ...
scroll-padding-right - CSS: Cascading Style Sheets
ort. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-right: auto; /* <length> values */ scroll-padding-right: 10px; scroll-padding-right: 1em; scroll-padding-right: 10%; /*
global values */ scroll-padding-right: inherit; scroll-padding-right: initial; scroll-padding-right: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
scroll-padding-top - CSS: Cascading Style Sheets
scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-top: auto; /* <length> values */ scroll-padding-top: 10px; scroll-padding-top: 1em; scroll-padding-top: 10%; /*
global values */ scroll-padding-top: inherit; scroll-padding-top: initial; scroll-padding-top: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. for...
scroll-padding - CSS: Cascading Style Sheets
g room between a targeted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-bottom scroll-padding-left scroll-padding-right scroll-padding-top syntax /* keyword values */ scroll-padding: auto; /* <length> values */ scroll-padding: 10px; scroll-padding: 1em .5em 1em 1em; scroll-padding: 10%; /*
global values */ scroll-padding: inherit; scroll-padding: initial; scroll-padding: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid <length> or a <percentage>. auto the offset is determind by the user agent. this will generally be 0px, but the user agent is free to detect and do something else if a non-zero value is more appropriate. ...
scroll-snap-align - CSS: Cascading Style Sheets
ap container’s snapport (as the alignment container). the two values specify the snapping alignment in the block axis and inline axis, respectively. if only one value is specified, the second value defaults to the same value. syntax /* keyword values */ scroll-snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /*
global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; values none the box does not define a snap position in that axis. start the start alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. end the end alignment of this box's scroll snap area, within the scroll container's snapport is a sna...
scroll-snap-coordinate - CSS: Cascading Style Sheets
the x and y coordinate positions within an element that will align with its nearest ancestor scroll container's scroll-snap-destination for each respective axis. /* keyword value */ scroll-snap-coordinate: none; /* <position> values */ scroll-snap-coordinate: 50px 50px; /* single coordinate */ scroll-snap-coordinate: 100px 100px, 100px bottom; /* multiple coordinates */ /*
global values */ scroll-snap-coordinate: inherit; scroll-snap-coordinate: initial; scroll-snap-coordinate: unset; if the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is displayed. syntax values none specifies that the element does not contribute to a snap point. <position> specifies the offset of the snap coord...
scroll-snap-destination - CSS: Cascading Style Sheets
the scroll-snap-destination css property defines the position in x and y coordinates within the scroll container's visual viewport which element snap points align with. /* <position> value */ scroll-snap-destination: 400px 600px; /*
global values */ scroll-snap-destination: inherit; scroll-snap-destination: initial; scroll-snap-destination: unset; syntax values <position> specifies the offset of the snap destination from the start edge of the scroll container’s visual viewport. the first value gives the x coordinate of the snap destination, the second value its y coordinate. formal definition initial value0px 0pxapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative lengths co...
scroll-snap-points-x - CSS: Cascading Style Sheets
the scroll-snap-points-x css property defines the horizontal positioning of snap points within the content of the scroll container they are applied to. /* keyword value */ scroll-snap-points-x: none; /* repeating snap points */ scroll-snap-points-x: repeat(400px); /*
global values */ scroll-snap-points-x: inherit; scroll-snap-points-x: initial; scroll-snap-points-x: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive lengths are allowed. percentages refer to the width of the container. formal definition ini...
scroll-snap-points-y - CSS: Cascading Style Sheets
the scroll-snap-points-y css property defines the vertical positioning of snap points within the content of the scroll container they are applied to. /* keyword value */ scroll-snap-points-y: none; /* repeated snap points */ scroll-snap-points-y: repeat(400px); /*
global values */ scroll-snap-points-y: inherit; scroll-snap-points-y: initial; scroll-snap-points-y: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive lengths are allowed. percentages refer to the width of the container. formal definition initi...
scroll-snap-type-x - CSS: Cascading Style Sheets
type-x css property defines how strictly snap points are enforced on the horizontal axis of the scroll container in case there is one. specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* keyword values */ scroll-snap-type-x: none; scroll-snap-type-x: mandatory; scroll-snap-type-x: proximity; /*
global values */ scroll-snap-type-x: inherit; scroll-snap-type-x: initial; scroll-snap-type-x: unset; syntax values none when the visual viewport of this scroll container is scrolled horizontally, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled horizontally. that means it snaps on that point when the scr...
scroll-snap-type-y - CSS: Cascading Style Sheets
p-type-y css property defines how strictly snap points are enforced on the vertical axis of the scroll container in case there is one. specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* keyword values */ scroll-snap-type-y: none; scroll-snap-type-y: mandatory; scroll-snap-type-y: proximity; /*
global values */ scroll-snap-type-y: inherit; scroll-snap-type-y: initial; scroll-snap-type-y: unset; syntax values none when the visual viewport of this scroll container is scrolled vertically, it must ignore snap points. mandatory the visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled vertically. that means it snaps on that point when the scroll ...
scroll-snap-type - CSS: Cascading Style Sheets
those snap points is not covered by this property but instead left up to the user agent. /* keyword values */ scroll-snap-type: none; scroll-snap-type: x; scroll-snap-type: y; scroll-snap-type: block; scroll-snap-type: inline; scroll-snap-type: both; /* optional mandatory | proximity*/ scroll-snap-type: x mandatory; scroll-snap-type: y proximity; scroll-snap-type: both mandatory; /* etc */ /*
global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; syntax values none when the visual viewport of this scroll container is scrolled, it must ignore snap points. x the scroll container snaps to snap positions in its horizontal axis only. y the scroll container snaps to snap positions in its vertical axis only. block the scroll container snaps to s...
scrollbar-color - CSS: Cascading Style Sheets
egardless of the scrolling position. the thumb refers to the moving part of the scrollbar, which usually floats on top of the track. syntax /* keyword values */ scrollbar-color: auto; scrollbar-color: dark; scrollbar-color: light; /* <color> values */ scrollbar-color: rebeccapurple green; /* two valid colors. the first applies to the thumb of the scrollbar, the second to the track. */ /*
global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: unset; values <scrollbar-color> defines the color of the scrollbar. auto default platform rendering for the track portion of the 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 p...
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown. initial valueautoapplies toscrolling boxesinheritednocomputed valueas specifiedanimation typediscrete syntax /* keyword values */ scrollbar-width: auto; scrollbar-width: thin; scrollbar-width: none; /*
global values */ scrollbar-width: inherit; scrollbar-width: initial; scrollbar-width: unset; values <scrollbar-width> defines the width of the scrollbar as a keyword. it must be one of the following values: auto the default scrollbar width for the platform. thin a thin scrollbar width variant on platforms that provide that option, or a thinner scrollbar than the default platform scrollbar width. none no scrollbar...
shape-image-threshold - CSS: Cascading Style Sheets
clone https://github.com/mdn/interactive-examples and send us a pull request. any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. for example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. /* <number> value */ shape-image-threshold: 0.7; /*
global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; syntax values <alpha-value> sets the threshold used for extracting a shape from an image. the shape is defined by the pixels whose alpha value is greater than the threshold. values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) are clamped to this range. formal definit...
shape-margin - CSS: Cascading Style Sheets
ository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the margin lets you adjust the distance between the edges of the shape (the float element) and the surrounding content. syntax /* <length> values */ shape-margin: 10px; shape-margin: 20mm; /* <percentage> value */ shape-margin: 60%; /*
global values */ shape-margin: inherit; shape-margin: initial; shape-margin: unset; values <length-percentage> sets the margin of the shape to a <length> value or to a <percentage> of the width of the element's containing block. formal definition initial value0applies tofloatsinheritednopercentagesrefer to the width of the containing blockcomputed valueas specified, but with relative lengths co...
shape-outside - CSS: Cascading Style Sheets
the float area determines the shape around which inline content (float elements) wrap. values none the float area is unaffected. inline content wraps around the element's margin box, lik...
table-layout - CSS: Cascading Style Sheets
he table-layout css property sets the algorithm used to lay out <table> cells, rows, and columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ table-layout: auto; table-layout: fixed; /*
global values */ table-layout: inherit; table-layout: initial; table-layout: unset; values auto by default, most browsers use an automatic table layout algorithm. the widths of the table and its cells are adjusted to fit the content. fixed table and column widths are set by the widths of table and col elements or by the width of the first row of cells. cells in subsequent rows do not affect colu...
text-align-last - CSS: Cascading Style Sheets
active example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ text-align-last: auto; text-align-last: start; text-align-last: end; text-align-last: left; text-align-last: right; text-align-last: center; text-align-last: justify; /*
global values */ text-align-last: inherit; text-align-last: initial; text-align-last: unset; values auto the affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to start. start the same as left if direction is left-to-right and right if direction is right-to-left. end the same as right if direction ...
text-align - CSS: Cascading Style Sheets
st. syntax /* keyword values */ text-align: left; text-align: right; text-align: center; text-align: justify; text-align: justify-all; text-align: start; text-align: end; text-align: match-parent; /* character-based alignment in a table column */ text-align: "."; text-align: "." center; /* block alignment values (non-standard syntax) */ text-align: -moz-center; text-align: -webkit-center; /*
global values */ text-align: inherit; text-align: initial; text-align: unset; the text-align property is specified in one of the following ways: using the keyword values start, end, left, right, center, justify, justify-all, or match-parent. using a <string> value only, in which case the other value defaults to right. using both a keyword value and a <string> value. values start the same ...
text-combine-upright - CSS: Cascading Style Sheets
ect that is known as tate-chū-yoko (縦中横) in japanese, or as 直書橫向 in chinese. /* keyword values */ text-combine-upright: none; text-combine-upright: all; /* digits values */ text-combine-upright: digits; /* fits 2 consecutive digits horizontally inside vertical text */ text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally inside vertical text */ /*
global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset; syntax values none there is no special processing. all attempts to typeset all consecutive characters within the box horizontally, such that they take up the space of a single character within the vertical line of the box. digits <integer>? attempts to display a sequence of consecutive ...
text-decoration-color - CSS: Cascading Style Sheets
g elements, applying a different line type to each element (with the text-decoration-line property), and specifying the line color (with text-decoration-color) on a per-element basis. syntax /* <color> values */ text-decoration-color: currentcolor; text-decoration-color: red; text-decoration-color: #00ff00; text-decoration-color: rgba(255, 128, 128, 0.5); text-decoration-color: transparent; /*
global values */ text-decoration-color: inherit; text-decoration-color: initial; text-decoration-color: unset; values <color> the color of the line decoration. accessibility concerns it is important to ensure that the contrast ratio between the color of the text, the background the text is placed over, and the text decoration line is high enough that people experiencing low vision conditions wi...
text-decoration-line - CSS: Cascading Style Sheets
ty 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-decoration-line: overline underline line-through; /* multiple decoration lines */ /*
global values */ text-decoration-line: inherit; text-decoration-line: initial; text-decoration-line: unset; the text-decoration-line property is specified as none, or one or more space-separated values from the list below. values none produces no text decoration. underline each line of text has a decorative line beneath it. overline each line of text has a decorative line above it. line-thro...
text-decoration-skip-ink - CSS: Cascading Style Sheets
active example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. text-decoration-skip-ink is not part of the text-decoration shorthand. syntax /* single keyword */ text-decoration-skip-ink: none; text-decoration-skip-ink: auto; text-decoration-skip-ink: all; /*
global keywords */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; values none underlines and overlines are drawn across the full length of the text content, including parts that cross over glyph descenders and ascenders. auto the default — the browser may interrupt underlines and overlines so that they do not touch or closely approach a glyph. that i...
text-decoration-skip - CSS: Cascading Style Sheets
the simpler text-decoration-skip-ink property. /* keyword values */ text-decoration-skip: none; text-decoration-skip: objects; text-decoration-skip: spaces; text-decoration-skip: edges; text-decoration-skip: box-decoration; /* multiple keywords */ text-decoration-skip: objects spaces; text-decoration-skip: leading-spaces trailing-spaces; text-decoration-skip: objects edges box-decoration; /*
global values */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; syntax values none nothing is skipped. thus, text decoration is drawn for all text content and across atomic inline-level boxes. objects the entire margin box of the element is skipped if it is an atomic inline such as an image or inline-block. spaces all spacing is skipped: all unicode...
text-decoration-style - CSS: Cascading Style Sheets
in some cases, the semantic meaning won't disappear in such a situation. when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. syntax /* keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /*
global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset; values solid draws a single line. double draws a double line. dotted draws a dotted line. dashed draws a dashed line. wavy draws a wavy line. -moz-none draws no line. use text-decoration-line: none instead. formal definition initial valuesolidapplies toall elements. it also ...
text-decoration-thickness - CSS: Cascading Style Sheets
coration-thickness css property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline. syntax /* single keyword */ text-decoration-thickness: auto; text-decoration-thickness: from-font; /* length */ text-decoration-thickness: 0.1em; text-decoration-thickness: 3px; /* percentage */ text-decoration-thickness: 10%; /*
global values */ text-decoration-thickness: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; values auto the browser chooses an appropriate width for the text decoration line. from-font if the font file includes information about a preferred thickness, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choo...
text-emphasis-color - CSS: Cascading Style Sheets
the text-emphasis-color css property sets the color of emphasis marks. this value can also be set using the text-emphasis shorthand. /* initial value */ text-emphasis-color: currentcolor; /* <color> */ text-emphasis-color: #555; text-emphasis-color: blue; text-emphasis-color: rgba(90, 200, 160, 0.8); text-emphasis-color: transparent; /*
global values */ text-emphasis-color: inherit; text-emphasis-color: initial; text-emphasis-color: unset; syntax values <color> defines the color of the emphasis marks. if no color is present, it defaults to currentcolor. formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-colo...
text-emphasis-position - CSS: Cascading Style Sheets
drawn. like ruby text, if there isn't enough room for emphasis marks, the line height is increased. /* initial value */ text-emphasis-position: over right; /* keywords value */ text-emphasis-position: over left; text-emphasis-position: under right; text-emphasis-position: under left; text-emphasis-position: left over; text-emphasis-position: right under; text-emphasis-position: left under; /*
global values */ text-emphasis-position: inherit; text-emphasis-position: initial; text-emphasis-position: unset; syntax values over draw marks over the text in horizontal writing mode. under draw marks under the text in horizontal writing mode. right draws marks to the right of the text in vertical writing mode. left draw marks to the left of the text in vertical writing mode. descript...
text-emphasis-style - CSS: Cascading Style Sheets
text-emphasis-style: '*'; text-emphasis-style: 'foo'; /* should not be used. it may be computed to or rendered as 'f' only */ /* keyword values */ text-emphasis-style: filled; text-emphasis-style: open; text-emphasis-style: dot; text-emphasis-style: circle; text-emphasis-style: double-circle; text-emphasis-style: triangle; text-emphasis-style: filled sesame; text-emphasis-style: open sesame; /*
global values */ text-emphasis-style: inherit; text-emphasis-style: initial; text-emphasis-style: unset; syntax values none no emphasis marks. filled the shape is filled with solid color. if neither filled nor open is present, this is the default. open the shape is hollow. dot display small circles as marks. the filled dot is '•' (u+2022), and the open dot is '◦' (u+25e6). circle disp...
text-emphasis - CSS: Cascading Style Sheets
g> value */ text-emphasis: 'x'; text-emphasis: '点'; text-emphasis: '\25b2'; text-emphasis: '*' #555; text-emphasis: 'foo'; /* should not use. it may be computed to or rendered as 'f' only */ /* keywords value */ text-emphasis: filled; text-emphasis: open; text-emphasis: filled sesame; text-emphasis: open sesame; /* keywords value combined with a color */ text-emphasis: filled sesame #555; /*
global values */ text-emphasis: inherit; text-emphasis: initial; text-emphasis: unset; values none no emphasis marks. filled the shape is filled with solid color. if neither filled nor open is present, this is the default. open the shape is hollow. dot display small circles as marks. the filled dot is '•' (u+2022), and the open dot is '◦' (u+25e6). circle display large circles as marks...
text-indent - CSS: Cascading Style Sheets
pacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. syntax /* <length> values */ text-indent: 3mm; text-indent: 40px; /* <percentage> value relative to the containing block width */ text-indent: 15%; /* keyword values */ text-indent: 5em each-line; text-indent: 5em hanging; text-indent: 5em hanging each-line; /*
global values */ text-indent: inherit; text-indent: initial; text-indent: unset; values <length> indentation is specified as an absolute <length>. negative values are allowed. see <length> values for possible units. <percentage> indentation is a <percentage> of the containing block's width. each-line indentation affects the first line of the block container as well as each line after a force...
text-orientation - CSS: Cascading Style Sheets
r this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ text-orientation: mixed; text-orientation: upright; text-orientation: sideways-right; text-orientation: sideways; text-orientation: use-glyph-orientation; /*
global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; the text-orientation property is specified as a single keyword from the list below. values mixed rotates the characters of horizontal scripts 90° clockwise. lays out the characters of vertical scripts naturally. default value. upright lays out the characters of horizontal scripts naturally (upright)...
text-rendering - CSS: Cascading Style Sheets
the text-rendering css property provides information to the rendering engine about what to optimize for when rendering text. the browser makes trade-offs among speed, legibility, and geometric precision. /* keyword values */ text-rendering: auto; text-rendering: optimizespeed; text-rendering: optimizelegibility; text-rendering: geometricprecision; /*
global values */ text-rendering: inherit; text-rendering: initial; text-rendering: unset; note: the text-rendering property is an svg property that is not defined in any css standard. however, gecko and webkit browsers let you apply this property to html and xml content on windows, macos, and linux. one very visible effect is optimizelegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for example...
text-shadow - CSS: Cascading Style Sheets
equest. syntax /* offset-x | offset-y | blur-radius | color */ text-shadow: 1px 1px 2px black; /* color | offset-x | offset-y | blur-radius */ text-shadow: #fc0 1px 0 10px; /* offset-x | offset-y | color */ text-shadow: 5px 5px #558abb; /* color | offset-x | offset-y */ text-shadow: white 2px 5px; /* offset-x | offset-y /* use defaults for color and blur-radius */ text-shadow: 5px 10px; /*
global values */ text-shadow: inherit; text-shadow: initial; text-shadow: unset; this property is specified as a comma-separated list of shadows. each shadow is specified as two or three <length> values, followed optionally by a <color> value. the first two <length> values are the <offset-x> and <offset-y> values. the third, optional, <length> value is the <blur-radius>. the<color> value is the shado...
text-size-adjust - CSS: Cascading Style Sheets
the text-size-adjust css property controls the text inflation algorithm used on some smartphones and tablets. other browsers will ignore this property. /* keyword values */ text-size-adjust: none; text-size-adjust: auto; /* <percentage> value */ text-size-adjust: 80%; /*
global values */ text-size-adjust: inherit; text-size-adjust: initial; text-size-adjust: unset; because many websites have not been developed with small devices in mind, mobile browsers differ from desktop browsers in the way they render web pages. instead of laying out pages at the width of the device screen, they lay them out using a viewport that is much wider, usually 800 or 1000 pixels. to map the extra-wide layout back to the original device size, they either show only part of the whole render or scale the ...
text-transform - CSS: Cascading Style Sheets
ase). the language is defined by the lang html attribute or the xml:lang xml attribute. note: support for language-specific cases varies between browsers, so check the browser compatibility table. syntax /* keyword values */ text-transform: none; text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: full-width; text-transform: full-size-kana; /*
global values */ text-transform: inherit; text-transform: initial; text-transform: unset; capitalize is a keyword that converts the first letter of each word to uppercase. other characters remain unchanged (they retain their original case as written in the element's text). a letter is defined as a character that is part of unicode's letter or number general categories ; thus, any punctuation mar...
text-underline-offset - CSS: Cascading Style Sheets
the text-decoration shorthand. while an element can have multiple text-decoration lines, text-underline-offset only impacts underlining, and not other possible line decoration options such as overline or line-through. syntax /* single keyword */ text-underline-offset: auto; /* length */ text-underline-offset: 0.1em; text-underline-offset: 3px; /* percentage */ text-underline-offset: 20%; /*
global values */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; the text-underline-offset property is specified as a single value from the list below. values auto the browser chooses the appropriate offset for underlines. <length> specifies the offset of underlines as a <length>, overriding the font file suggestion and the browser default. it is re...
top - CSS: Cascading Style Sheets
ecified (either auto or 100%) both the top and bottom distances are respected. in all other situations, if height is constrained in any way or position is set to relative, the top property takes precedence and the bottom property is ignored. syntax /* <length> values */ top: 3px; top: 2.4em; /* <percentage>s of the height of the containing block */ top: 10%; /* keyword value */ top: auto; /*
global values */ top: inherit; top: initial; top: unset; values <length> a negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the top edge of the containing block. for relatively positioned elements, the distance that the element is moved below its normal position. <percentage> a <percentage> of the containing block's height. auto...
touch-action - CSS: Cascading Style Sheets
css property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built into the browser). /* keyword values */ touch-action: auto; touch-action: none; touch-action: pan-x; touch-action: pan-left; touch-action: pan-right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /*
global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. by explicitly specifying which gestures should be handled by the browser, an application can supply its o...
transform-origin - CSS: Cascading Style Sheets
offsets that are not explicitly defined are reset to their corresponding initial values. if two or more values are defined and either no value is a keyword, or the only used keyword is cen...
transform-style - CSS: Cascading Style Sheets
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. syntax /* keyword values */ transform-style: flat; transform-style: preserve-3d; /*
global values */ transform-style: inherit; transform-style: initial; transform-style: unset; values flat indicates that the children of the element are lying in the plane of the element itself. preserve-3d indicates that the children of the element should be positioned in the 3d-space. formal definition initial valueflatapplies totransformable elementsinheritednocomputed valueas specifiedanim...
transform - CSS: Cascading Style Sheets
if perspective() is one of multiple function values, it must be listed first. values <transform-function> one or more of the css transform functions to be applied. the transform functions are multiplied ...
transition-delay - CSS: Cascading Style Sheets
operty, which acts as a master list. if there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. if there are more delays, the list of delay values will be truncated to match the number of properties. in both cases, the css declaration remains valid. syntax /* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms; /*
global values */ transition-delay: inherit; transition-delay: initial; transition-delay: unset; values <time> denotes the amount of time to wait between a property's value changing and the start of the transition effect. formal definition initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time>#...
transition-duration - CSS: Cascading Style Sheets
master list. if there are fewer durations specified than in the master list, the user agent repeat the list of durations. if there are more durations, the list is simply truncated to the right size. in both case the css declaration stays valid. syntax /* <time> values */ transition-duration: 6s; transition-duration: 120ms; transition-duration: 1s, 15s; transition-duration: 10s, 30s, 230ms; /*
global values */ transition-duration: inherit; transition-duration: initial; transition-duration: unset; values <time> is a <time> denoting the amount of time the transition from the old value of a property to the new value should take. a time of 0s indicates that no transition will happen, that is the switch between the two states will be instantaneous. a negative value for the time renders the d...
transition-property - CSS: Cascading Style Sheets
t can be animated will be. syntax /* keyword values */ transition-property: none; transition-property: all; /* <custom-ident> values */ transition-property: test_05; transition-property: -specific; transition-property: sliding-vertically; /* multiple values */ transition-property: test1, animation4; transition-property: all, height, color; transition-property: all, -moz-specific, sliding; /*
global values */ transition-property: inherit; transition-property: initial; transition-property: unset; values none no properties will transition. all all properties that can transition will. <custom-ident> a string identifying the property to which a transition effect should be applied when its value changes. formal definition initial valueallapplies toall elements, ::before and ::after p...
transition - CSS: Cascading Style Sheets
each single-property transition describes the transition that should be applied to a single property (or the special values all and none). it includes: zero or one value representing the property to which the transition ...
unicode-bidi - CSS: Cascading Style Sheets
ection properties are the only properties that are not affected by the all shorthand. note: this property is intended for document type definition (dtd) designers. web designers and similar authors should not override it. /* keyword values */ unicode-bidi: normal; unicode-bidi: embed; unicode-bidi: isolate; unicode-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /*
global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; syntax values normal the element does not offer an additional level of embedding with respect to the bidirectional algorithm. for inline elements, implicit reordering works across element boundaries. embed if the element is inline, this value opens an additional level of embedding with respect to the bidirectiona...
vertical-align - CSS: Cascading Style Sheets
ou can't use it to vertically align block-level elements. syntax /* keyword values */ vertical-align: baseline; vertical-align: sub; vertical-align: super; vertical-align: text-top; vertical-align: text-bottom; vertical-align: middle; vertical-align: top; vertical-align: bottom; /* <length> values */ vertical-align: 10em; vertical-align: 4px; /* <percentage> values */ vertical-align: 20%; /*
global values */ vertical-align: inherit; vertical-align: initial; vertical-align: unset; the vertical-align property is specified as one of the values listed below. values for inline elements parent-relative values these values vertically align the element relative to its parent element: baseline aligns the baseline of the element with the baseline of its parent. the baseline of some replaced ...
visibility - CSS: Cascading Style Sheets
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. to both hide an element and remove it from the document layout, set the display property to none instead of using visibility. syntax /* keyword values */ visibility: visible; visibility: hidden; visibility: collapse; /*
global values */ visibility: inherit; visibility: initial; visibility: unset; the visibility property is specified as one of the keyword values listed below. values visible the element box is visible. hidden the element box is invisible (not drawn), but still affects layout as normal. descendants of the element will be visible if they have visibility set to visible. the element cannot receive f...
white-space - CSS: Cascading Style Sheets
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: to make words break within themselves, use overflow-wrap, word-break, or hyphens instead. syntax /* keyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /*
global values */ white-space: inherit; white-space: initial; white-space: unset; the white-space property is specified as a single keyword chosen from the list of values below. values normal sequences of white space are collapsed. newline characters in the source are handled the same as other white space. lines are broken as necessary to fill line boxes. nowrap collapses white space as for norm...
widows - CSS: Cascading Style Sheets
(the paragraph is continued from a prior page.) syntax values <integer> the minimum number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. the value must be positive. ...
width - CSS: Cascading Style Sheets
d like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the min-width and max-width properties override width. syntax /* <length> values */ width: 300px; width: 25em; /* <percentage> value */ width: 75%; /* keyword values */ width: max-content; width: min-content; width: fit-content(20em); width: auto; /*
global values */ width: inherit; width: initial; width: unset; the width property is specified as either: one of the following keyword values: min-content, max-content, fit-content, auto. a <length> or a <percentage>. values <length> defines the width as an absolute value. <percentage> defines the width as a percentage of the containing block's width. auto the browser will calculate and ...
will-change - CSS: Cascading Style Sheets
o deal with existing performance problems. it should not be used to anticipate performance problems. /* keyword values */ will-change: auto; will-change: scroll-position; will-change: contents; will-change: transform; /* example of <custom-ident> */ will-change: opacity; /* example of <custom-ident> */ will-change: left, top; /* example of two <animateable-feature> */ /*
global values */ will-change: inherit; will-change: initial; will-change: unset; proper usage of this property can be a bit tricky: don't apply will-change to too many elements. the browser already tries as hard as it can to optimize everything. some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this ...
word-break - CSS: Cascading Style Sheets
erwise overflow its content box. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /*
global values */ word-break: inherit; word-break: initial; word-break: unset; the word-break property is specified as a single keyword chosen from the list of values below. values normal use the default line break rule. break-all to prevent overflow, word breaks should be inserted between any two characters (excluding chinese/japanese/korean text). keep-all word breaks should not be used for ...
word-spacing - CSS: Cascading Style Sheets
ce for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ word-spacing: normal; /* <length> values */ word-spacing: 3px; word-spacing: 0.3em; /* <percentage> values */ word-spacing: 50%; word-spacing: 200%; /*
global values */ word-spacing: inherit; word-spacing: initial; word-spacing: unset; values normal the normal inter-word spacing, as defined by the current font and/or the browser. <length> specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font. <percentage> specifies extra spacing as a percentage of the affected character’s advance width. examples html...
writing-mode - CSS: Cascading Style Sheets
nd us a pull request. this property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. thus, it also determines the ordering of block-level content. syntax /* keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr; /*
global values */ writing-mode: inherit; writing-mode: initial; writing-mode: unset; the writing-mode property is specified as one of the values listed below. the flow direction in horizontal scripts is also affected by the directionality of that script, either left-to-right (ltr, like english and most other languages) or right-to-left (rtl, like hebrew or arabic). values horizontal-tb for ltr scri...
z-index - CSS: Cascading Style Sheets
equest. for a positioned box (that is, one with any position other than static), the z-index property specifies: the stack level of the box in the current stacking context. whether the box establishes a local stacking context. syntax /* keyword value */ z-index: auto; /* <integer> values */ z-index: 0; z-index: 3; z-index: 289; z-index: -1; /* negative values to lower the priority */ /*
global values */ z-index: inherit; z-index: initial; z-index: unset; the z-index property is specified as either the keyword auto or an <integer>. values auto the box does not establish a new local stacking context. the stack level of the generated box in the current stacking context is the same as its parent's box. <integer> this <integer> is the stack level of the generated box in the current...
zoom - CSS: Cascading Style Sheets
the non-standard zoom css property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. however, unlike css transforms, zoom affects the layout size of the element. /* keyword values */ zoom: normal; zoom: reset; /* <percentage> values */ zoom: 50%; zoom: 200%; /* <number> values */ zoom: 1.1; zoom: 0.7; /*
global values */ zoom: inherit; zoom: initial; zoom: unset; syntax values normal render this element at its normal size. reset do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing ctrl-- or ctrl++ keyboard shortcuts) to the document. only supported by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values larger t...
regexp:replace() - EXSLT
x regexp:replace(originalstring, regexpstring, flagsstring, replacestring) parameters originalstring the string perform a search-and-replace operation upon. regexpstring the javascript style regular expression to evaluate. flagsstring the string containing character flags. replacestring the string with which the matched substrings are to be replaced. the character flags are: g -
global replace if this flag is specified, all occurrences of the regular expression within the originalstring are replaced. otherwise only the first occurrence is replaced. i - case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns the revised version of the string. specifications exslt - regexp:replace ...
regexp:test() - EXSLT
ions, xpath functions, xpath axes regexp:test() tests to see whether a string matches a specified regular expression. syntax regexp:test(teststring, regexpstring[, flagsstring]) parameters teststring the string to test.. regexpstring the javascript style regular expression to evaluate. flagsstringoptional an optional string containing character flags. the character flags are: g
global match has no effect for this function; it's allowed for consistency with other regexp functions. i case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns true if the specified regexp matches the test string. specifications exslt - regexp:test ...
Getting Started - Developer guides
ript "object expected" error after the line where you tried to access an xml element. note 2: if you do not set header cache-control: no-cache the browser will cache the response and never re-submit the request, making debugging challenging. you can also add an always-different get parameter, like a timestamp or random number (see bypassing the cache) note 3: if the httprequest variable is used
globally, competing functions calling makerequest() can overwrite each other, causing a race condition. declaring the httprequest variable local to a closure containing the ajax functions avoids this. in the event of a communication error (such as the server going down), an exception will be thrown in the onreadystatechange method when accessing the response status. to mitigate this problem, you could ...
Constraint validation - Developer guides
patternmismatch constraint violation min range, number a valid number the value must be greater than or equal to the value. rangeunderflow constraint violation date, month, week a valid date datetime, datetime-local, time a valid date and time max range, numb...
Using HTML sections and outlines - Developer guides
all-out box inside. using html5 elements in non-html5 browsers sections and headings elements can be made to work in most non-html5 browsers with a couple of extra steps, and in this section we'll show you how. if a significant percentage of your particular target audience is using internet explorer 8 or older, then you can follow the below instructions to make them behave as expected. however,
global usage of these browsers is now very small, so this is unlikely. html5 semantic elements don't need a special dom interface, but they will need a specific css styling in older browser that don't support them explicitly. unknown elements are styled as display: inline by default, so you'll want to set them to display: block: article, aside, footer, header, nav, section { display: block; } of c...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
anvasrenderingcontext2d) in the variable context. the canvas's size is adjusted to match the received image, then the image is drawn into the canvas using drawimage(). the canvas is then inserted into the document so the image is visible. now it's time to actually save the image locally. to do this, we use the web storage api's local storage mechanism, which is accessed through the localstorage
global. the canvas method todataurl() is used to convert the image into a data:// url representing a png image, which is then saved into local storage using setitem(). you can try out or remix this example on glitch. ...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
both the starting and ending tag are mandatory. permitted parents any element that accepts flow content; don't use a heading element as a child of the <hgroup> element — it is now deprecated. implicit aria role heading permitted aria roles tab, presentation or none dom interface htmlheadingelement attributes these elements only include the
global attributes. the align attribute is obsolete; don't use it. usage notes heading information may be used by user agents, for example, to construct a table of contents for a document automatically. avoid using heading tags to resize text. instead, use the css font-size property. headings use size to indicate their relative importance, but css is preferred for general-purpose resizing. avoid...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
ntent, palpable content permitted content phrasing content tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only supports the
global attributes. the title attribute has a specific semantic meaning when used with the <abbr> element; it must contain a full human-readable description or expansion of the abbreviation. this text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element. each <abbr> element you use is independent from all others; providing a title for one does not automatically a...
<address>: The Contact Address element - HTML: Hypertext Markup Language
parent, can not have nested <address> element, then the same <address> content can not have <address> tag as its parent). implicit aria role no corresponding role permitted aria roles any dom interface htmlelement prior to gecko 2.0 (firefox 4), gecko implemented this element using the htmlspanelement interface attributes this element only includes the
global attributes. usage notes it used to be the case that an <address> element was only supposed to be used to represent the contact information of the document's author. in the latest spec versions however, its definition has been updated so it can now be used to mark up arbitrary addresses. this element should not contain more information than the contact information, like a publication date (wh...
<article>: The Article Contents element - HTML: Hypertext Markup Language
d ending tag are mandatory. permitted parents any element that accepts flow content. note that an <article> element must not be a descendant of an <address> element. implicit aria role article permitted aria roles application, document, feed, main, none, presentation, region dom interface htmlelement attributes this element only includes the
global attributes. usage notes each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element. when an <article> element is nested, the inner element represents an article related to the outer element. for example, the comments of a blog post can be <article> elements nested in the <article> representing the blog post. author informati...
<aside>: The Aside element - HTML: Hypertext Markup Language
starting and ending tag are mandatory. permitted parents any element that accepts flow content. note that an <aside> element must not be a descendant of an <address> element. implicit aria role complementary permitted aria roles feed, none, note, presentation, region, search dom interface htmlelement attributes this element only includes the
global attributes. usage notes do not use the <aside> element to tag parenthesized text, as this kind of text is considered part of the main flow. examples using <aside> this example uses <aside> to mark up a paragraph in an article. the paragraph is only indirectly related to the main article content: <article> <p> the disney movie <cite>the little mermaid</cite> was first released t...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
ia we want to embed inside the src attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc. the content inside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element. attributes this element's attributes include the
global attributes. autoplay a boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading. note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. if you must offer autoplay functionality, you shoul...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes use the <b> for cases like keywords in a summary, product names in a review, or other spans of text whose typical presentation would be boldfaced (but not including any special importance). do not confuse the <b> element with the <strong>, <em>, or <mark> elements. the <strong> element represents text of certain importance, <em> puts some emphasis on the text and the ...
<base>: The Document Base URL element - HTML: Hypertext Markup Language
permitted content none, it is an empty element. tag omission there must be no closing tag. permitted parents a <head> that doesn't contain another <base> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlbaseelement attributes this element's attributes include the
global attributes. if either of the following attributes are specified, this element must come before other elements with attribute values of urls, such as <link>’s href attribute. href the base url to be used throughout the document for relative urls. absolute and relative urls are allowed. target a keyword or author-defined name of the default browsing context to show the results of navigat...
<basefont> - HTML: Hypertext Markup Language
ch 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 the client's browser supports. if no font listed is installed on the local system, the browser typically defaults t...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes like all other html elements, this element supports the
global attributes, except that the dir attribute behaves differently than normal: it defaults to auto, meaning its value is never inherited from the parent element. this means that unless you specify a value of either rtl or ltr for dir, the user agent will determine the correct directionality to use based on the contents of the <bdi>. examples no <bdi> with only ltr this example lists the winners of...
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
ing and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element's attributes include the
global attributes. dir the direction in which text should be rendered in this element's contents. possible values are: ltr: indicates that the text should go in a left-to-right direction. rtl: indicates that the text should go in a right-to-left direction. examples <!-- switch text direction --> <p>this text will go left to right.</p> <p><bdo dir="rtl">this text will go right to left.</...
<big>: The Bigger Text element - HTML: Hypertext Markup Language
l larger than the surrounding text (medium becomes large, for example). the size is capped at the browser's maximum permitted font size. usage note: as it was purely presentational, this element has been removed in html5 and shouldn't be used anymore. instead web developers should use the css font-size property to adjust the font size. attributes this element has no other attributes than the
global attributes, common to all elements. examples here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern css syntax instead. using <big> this example uses the obsolete <big> element to increase the size of some text. html <p> this is the first sentence. <big>this whole sentence is in bigger letters.</big> </p> result ...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
palpable content. permitted content flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface 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 ...
<body>: The Document Body element - HTML: Hypertext Markup Language
mitted parents it must be the second element of an <html> element. implicit aria role document permitted aria roles no role permitted dom interface htmlbodyelement the <body> element exposes the htmlbodyelement interface. you can access the <body> element through the document.body property. attributes this element includes the
global attributes. alink color of text for hyperlinks when selected. this method is non-conforming, use css color property in conjunction with the :active pseudo-class instead. background uri of a image to use as a background. this method is non-conforming, use css background property on the element instead. bgcolor background color for the document. this method is non-conforming, use css ...
<br>: The Line Break element - HTML: Hypertext Markup Language
est. as you can see from the above example, a <br> element is included at each point where we want the text to break. the text after the <br> begins again at the start of the next line of the text block. note: do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the css margin property to control their size. attributes this element's attributes include the
global attributes. deprecated attributes clear indicates where to begin the next line after the break. styling with css the <br> element has a single, well-defined purpose — to create a line break in a block of text. as such, it has no dimensions or visual output of its own, and there is very little you can do to style it. you can set a margin on <br> elements themselves to increase the spaci...
<button>: The Button element - HTML: Hypertext Markup Language
ag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role button permitted aria roles checkbox, link, menuitem, menuitemcheckbox, menuitemradio, option, radio, switch, tab dom interface htmlbuttonelement attributes this element's attributes include the
global attributes. autofocus html5 this boolean attribute specifies that the button should have input focus when the page loads. only one element in a document can have this attribute. autocomplete this attribute on a <button> is nonstandard and firefox-specific. unlike other browsers, firefox persists the dynamic disabled state of a <button> across page loads. setting autocomplete="off" on the ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
ents whose type attribute is checkbox, radio, or button. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlcanvaselement attributes this element's attributes include the
global attributes. height the height of the coordinate space in css pixels. defaults to 150. moz-opaque lets the canvas know whether or not translucency will be a factor. if the canvas knows there's no translucency, painting performance can be optimized. this is only supported by mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) instead. width the width o...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
tag omission the end tag can be omitted if the element is not immediately followed by ascii whitespace or a comment. permitted parents a <table> element, as its first descendant. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecaptionelement attributes this element includes the
global attributes. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute indicates how the caption must be aligned with respect to the table. it may have one of the following values: left the caption is displayed to the left o...
<cite>: The Citation element - HTML: Hypertext Markup Language
e starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the
global attributes. usage notes in the context of the <cite> element, a creative work that might be cited could be, for example, one of the following: a book a research paper an essay a poem a musical score a song a play or film script a film a television show a game a sculpture a painting a theatrical production a play an opera a musical an exhibition a legal case report a comput...
<code>: The Inline Code element - HTML: Hypertext Markup Language
e starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the
global attributes. example a paragraph of text that includes <code>: <p>the function <code>selectall()</code> highlights all the text in the input field so the user can, for example, copy or delete the text.</p> the output generated by this html looks like this: notes to represent multiple lines of code, wrap the <code> element within a <pre> element. the <code> element by itself only represent...
<col> - HTML: Hypertext Markup Language
tart 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 have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element includes the
global attributes. span this attribute contains a positive integer indicating the number of consecutive columns the <col> element spans. if not present, its default value is 1. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attrib...
<colgroup> - HTML: Hypertext Markup Language
or a comment. permitted parents a <table> element. the <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element's attributes include the
global attributes. span this attribute contains a positive integer indicating the number of consecutive columns the <colgroup> element spans. if not present, its default value is 1. note: this attribute is applied on the attributes of the column group, it has no effect on the css styling rules associated with it or, even more, to the cells of the column's members of the group. the span attrib...
<command>: The HTML Command element - HTML: Hypertext Markup Language
n empty element. tag omission the start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. permitted parent elements <colgroup> only, though it can be implicitly defined as its start tag is not mandatory. the <colgroup> must not have a <span> as child. dom interface htmlcommandelement attributes this element includes the
global attributes. checked indicates whether the command is selected. must be omitted unless the type attribute is checkbox or radio. disabled indicates that the command is not available. icon gives a picture which represents the command. label the name of the command as shown to the user. radiogroup this attribute gives the name of the group of commands, with a type of radio, that will be t...
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
spec to work with newer versions of the specification. content categories transparent content. permitted content flow content. tag omission none, both the starting and ending tag are mandatory. permitted parent elements any element that accepts flow content. dom interface htmlcontentelement attributes this element includes the
global attributes. select a comma-separated list of selectors. these have the same syntax as css selectors. they select the content to insert in place of the <content> element. example here is a simple example of using the <content> element. it is an html file with everything needed in it. note: for this code to work, the browser you display it in must support web components. see enabling web c...
<data> - HTML: Hypertext Markup Language
e content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmldataelement attributes this element's attributes include the
global attributes. value this attribute specifies the machine-readable translation of the content of the element. examples the following example displays product names but also associates each name with a product number. <p>new products</p> <ul> <li><data value="398">mini ketchup</data></li> <li><data value="399">jumbo ketchup</data></li> <li><data value="400">mega jumbo ketchup</data></li> <...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
ing content or zero or more <option> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the
global attributes, common to all elements. examples <label for="mybrowser">choose a browser from this list:</label> <input list="browsers" id="mybrowser" name="mybrowser" /> <datalist id="browsers"> <option value="chrome"> <option value="firefox"> <option value="internet explorer"> <option value="opera"> <option value="safari"> <option value="microsoft edge"> </datalist> result specif...
<dd>: The Description Details element - HTML: Hypertext Markup Language
dt> element, or if there is no more content in the parent element. permitted parents <dl> or (in whatwg html) a <div> that is inside a <dl>. previous sibling <dt> or another <dd> element. implicit aria role definition permitted aria roles no role permitted dom interface htmlelement attributes this element's attributes include the
global attributes. nowrap if the value of this attribute is set to yes, the definition text will not wrap. the default value is no. example for an example, see <dl> examples. specifications specification status comment html living standardthe definition of '<dd>' in that specification. living standard html5the definition of '<dd>' in that specificat...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
or flow content. permitted content transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlmodelement attributes this element's attributes include the
global attributes. cite a uri for a resource that explains the change (for example, meeting minutes). datetime this attribute indicates the time and date of the change and must be a valid date string with an optional time. if the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. for the format of the string without a time, see date s...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
permitted content one <summary> element followed by flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role group permitted aria roles no role permitted dom interface htmldetailselement attributes this element includes the
global attributes. open this boolean attribute indicates whether or not the details — that is, the contents of the <details> element — are currently visible. the default, false, means the details are not visible. events in addition to the usual events supported by html elements, the <details> element supports the toggle event, which is dispatched to the <details> element whenever its state ch...
<dfn>: The Definition element - HTML: Hypertext Markup Language
rmitted content phrasing content, but no <dfn> element must be a descendant. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role term permitted aria roles any dom interface htmlelement attributes this element's attributes include the
global attributes. in html5, the title attribute has special meaning, as noted below. usage notes there are some not-entirely-obvious aspects to using the <dfn> element. we examine those here. specifying the term being defined the term being defined is identified following these rules: if the <dfn> element has a title attribute, the value of the title attribute is considered to be the term being...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
ries flow content, sectioning root permitted content flow content tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role dialog permitted aria roles alertdialog dom interface htmldialogelement attributes this element includes the
global attributes. the tabindex attribute must not be used on the <dialog> element. open indicates that the dialog is active and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usage notes <form> elements can close a dialog if they have the attribute method="dialog". when such a form is submitted, the dialog closes with its returnvalue p...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
ld use the <ul> element for lists, including lists of files. usage note: do not use this element. though present in early html specifications, it has been deprecated in html 4, and has since been removed entirely. no major browsers support this element. dom interface this element implements the htmldirectoryelement interface. attributes like all other html elements, this element supports the
global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent and it doesn't work in all browsers. usage note: do not use this attribute, as it has been deprecated: the <dir> element should be styled using css. to give a similar effect as that achieved with the compact attribute, the css pr...
<div>: The Content Division element - HTML: Hypertext Markup Language
th <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. 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 cont...
<dt>: The Description Term element - HTML: Hypertext Markup Language
permitted parents before a <dt> or a <dd> element, inside a <dl> or (in whatwg html) a <div> that is inside a <dl>. implicit aria role term permitted aria roles listitem dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the
global attributes. example for an example, see the example provided for the <dl> element. specifications specification status comment html living standardthe definition of '<dt>' in that specification. living standard html5the definition of '<dt>' in that specification. recommendation html 4.01 specificationthe definition of '<dt>' in that ...
<element>: The Custom Element element (Obsolete) - HTML: Hypertext Markup Language
as been removed from the specification. see this for more information from the editor of the specification. content categories transparent content. permitted content ??? tag omission none, both the starting and ending tag are mandatory. permitted parent elements ??? dom interface htmlelement attributes this element includes the
global attributes. specifications the <element> element was formerly in a draft specification of custom elements but it has been removed. 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 e...
<em>: The Emphasis element - HTML: Hypertext Markup Language
e starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement up to gecko 1.9.2 (firefox 4) inclusive, firefox implements the htmlspanelement interface for this element. attributes this element only includes the
global attributes. usage notes the <em> element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself. typically this element is displayed in italic type. however, it should not be used simply to apply italic styling; use the css font-style property for that purpose. use the <cite...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
empty element. tag omission must have a start tag, and must not have an end tag. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, img, none, presentation dom interface htmlembedelement attributes this element's attributes include the
global attributes. height the displayed height of the resource, in css pixels. this must be an absolute value; percentages are not allowed. src the url of the resource being embedded. type the mime type to use to select the plug-in to instantiate. width the displayed width of the resource, in css pixels. this must be an absolute value; percentages are not allowed. usage notes you can use th...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
nested <legend> element providing a caption for the <fieldset>. it takes few attributes, the most notable of which are form, which can contain the id of a <form> on the same page, allowing you to make the <fieldset> part of that <form> even if it is not nested inside it, and disabled, which allows you to disable the <fieldset> and all its contents in one go. attributes this element includes the
global attributes. disabled if this boolean attribute is set, all form controls that are descendants of the <fieldset>, are disabled, meaning they are not editable and won't be submitted along with the <form>. they won't receive any browsing events, like mouse clicks or focus-related events. by default browsers display such controls grayed out. note that form elements inside the <legend> element won...
<figcaption>: The Figure Caption element - HTML: Hypertext Markup Language
low content. tag omission none, both the starting and ending tag are mandatory. permitted parents a <figure> element; the <figcaption> element must be its first or last child. implicit aria role no corresponding role permitted aria roles group, none, presentation dom interface htmlelement attributes this element only includes the
global attributes. examples please see the <figure> page for examples on <figcaption>. specifications specification status comment html living standardthe definition of '<figcaption>' in that specification. living standard html5the definition of '<figcaption>' in that specification. recommendation ...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
> element; or flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role figure permitted aria roles with no figcaption descendant: any, otherwise no permitted roles dom interface htmlelement attributes this element only includes the
global attributes. usage notes usually a <figure> is an image, illustration, diagram, code snippet, etc., that is referenced in the main flow of a document, but that can be moved to another part of the document or to an appendix without affecting the main flow. being a sectioning root, the outline of the content of the <figure> element is excluded from the main outline of the document. a caption c...
<font> - HTML: Hypertext Markup Language
ing 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 supports. if no font listed is installed on the local system, the browser typi...
<footer> - HTML: Hypertext Markup Language
<header> or another <footer> element. implicit aria role contentinfo, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement attributes this element only includes the
global attributes. usage notes enclose information about the author in an <address> element that can be included into the <footer> element. the <footer> element is not sectioning content and therefore doesn't introduce a new section in the outline. examples <footer> some copyright info or perhaps some author info for an <article>? </footer> accessibility concerns the voiceover scree...
<form> - HTML: Hypertext Markup Language
tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role form if the form has an accessible name, otherwise no corresponding role permitted aria roles search, none or presentation dom interface htmlformelement attributes this element includes the
global attributes. accept comma-separated content types the server accepts. this attribute was removed in html5 and should not be used. instead, use the accept attribute on <input type=file> elements. accept-charset space-separated character encodings the server accepts. the browser uses them in the order in which they are listed. the default value means the same encoding as the page. (in pr...
<frame> - HTML: Hypertext Markup Language
articular area in which another html document can be displayed. a frame should be used within a <frameset>. using the <frame> element is not encouraged because of certain disadvantages such as performance problems and lack of accessibility for users with screen readers. instead of the <frame> element, <iframe> may be preferred. attributes like all other html elements, this element supports the
global attributes. src this attribute specifies the document that will be displayed by the frame. name this attribute is used for labeling frames. without labeling, every link will open in the frame that it’s in – the closest parent frame. see the target attribute for more information. noresize this attribute prevents resizing of frames by users. scrolling this attribute defines the existe...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
lement is an element. the end tag may be omitted if the first thing following the <head> element is not a space character or a comment. permitted parents an <html> element, as its first child. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlheadelement attributes this element includes the
global attributes. profile the uris of one or more metadata profiles, separated by white space. example <!doctype html> <html> <head> <title>document title</title> </head> </html> notes html5-compliant browsers automatically create a <head> element if its tags are omitted in the markup. this auto-creation is not guaranteed in ancient browsers. specifications specification ...
<header> - HTML: Hypertext Markup Language
historical usage although the <header> element didn't make its way into specifications until html5, it actually existed at the very beginning of html. as seen in the very first website, it was originally used as the <head> element. at some point, it was decided to use a different name. this allowed <header> to be free to fill a different role later on. attributes this element only includes the
global attributes. examples page header <header> <h1>main page title</h1> <img src="mdn-logo-sm.png" alt="mdn logo"> </header> article header <article> <header> <h2>the planet earth</h2> <p>posted on wednesday, <time datetime="2017-10-04">4 october 2017</time> by jane smith</p> </header> <p>we live on a planet that's blue and green, with so many things still unseen.</p> <p><a h...
<hgroup> - HTML: Hypertext Markup Language
rmitted content one or more <h1>, <h2>, <h3>, <h4>, <h5>, and/or <h6>. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes the <hgroup> element has been removed from the html5 (w3c) specification, but it still is in the whatwg version of html. it is partially implemented in most browsers, though, so is unlikely to go away. however, given that a key purpose of the <hgroup> element is to affect how headings are displayed by the outline algorithm defined in the html specification—but the ht...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
permitted content none, it is an empty element. tag omission it must have start tag, but must not have an end tag. permitted parents any element that accepts flow content. implicit aria role separator permitted aria roles presentation or none dom interface htmlhrelement attributes this element's attributes include the
global attributes. align sets the alignment of the rule on the page. if no value is specified, the default value is left. color sets the color of the rule through color name or hexadecimal value. noshade sets the rule to have no shading. size sets the height, in pixels, of the rule. width sets the length of the rule on the page through a pixel or percentage value. example html ...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
the <html> element is not a comment. the end tag may be omitted if the <html> element is not immediately followed by a comment. permitted parents none. this is the root element of a document. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlhtmlelement attributes this element includes the
global attributes. manifest specifies the uri of a resource manifest indicating resources that should be cached locally. see using the application cache for details. version specifies the version of the html document type definition that governs the current document. this attribute is not needed, because it is redundant with the version information in the document type declaration. xmlns spe...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes use the <i> element for text that is set off from the normal prose for readability reasons. this would be a range of text with different semantic meaning than the surrounding text. among the use cases for the <i> element are spans of text representing a different quality or mode of text, such as: alternative voice or mood taxonomic designations (such as the g...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
ermitted content none. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, img, none, presentation dom interface htmliframeelement attributes this element includes the
global attributes. allow specifies a feature policy for the <iframe>. see the article privacy, permissions, and information security for details on security issues and how <iframe> works with feature policy to keep systems safe. allowfullscreen set to true if the <iframe> can activate fullscreen mode by calling the requestfullscreen() method. this attribute is considered a legacy attribute and ...
<img>: The Image Embed element - HTML: Hypertext Markup Language
l is the same as the url of the page the user is currently on. the image is corrupted in some way that prevents it from being loaded. the image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the image is in a format not supported by the user agent. attributes this element includes the
global attributes. alt defines an alternative text description of the image. note: browsers do not always display images. there are a number of situations in which a browser might not display images, such as: non-visual browsers (such as those used by people with visual impairments) the user chooses not to display images (saving bandwidth, privacy reasons) the image is invalid or an unsu...
<input type="search"> - HTML: Hypertext Markup Language
equently than an implementation-defined interval. mozactionhint a mozilla extension, supported by firefox for android, which provides a hint as to what sort of action will be taken if the user presses the enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the
global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. results the results attribute—supported only by safari—is a numeric value that lets you override the maximum number of e...
<input type="tel"> - HTML: Hypertext Markup Language
able automatic correction and text substitutions. mozactionhint a mozilla extension, supported by firefox for android, which provides a hint as to what sort of action will be taken if the user presses the enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the
global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. using tel inputs telephone numbers are a very commonly collected type of data on the web. when creating any kind of registratio...
<ins> - HTML: Hypertext Markup Language
ing content or flow content. permitted content transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlmodelement attributes this element includes the
global attributes. cite this attribute defines the uri of a resource that explains the change, such as a link to meeting minutes or a ticket in a troubleshooting system. datetime this attribute indicates the time and date of the change and must be a valid date with an optional time string. if the value cannot be parsed as a date with an optional time string, the element does not have an associated...
<isindex> - HTML: Hypertext Markup Language
ry string. when sent, the server would return a list of pages matching the query. its support depended on both the browser and the server to react to the query. <isindex> is removed html standard. it was deprecated in html 4.01. the same behaviour can be achieved with an html form. all major browsers have now removed <isindex>. attributes like all other html elements, this element accepted the
global attributes. prompt this attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. example <head> <isindex prompt="search document..." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search do...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes other elements can be used in tandem with <kbd> to represent more specific scenarios: nesting a <kbd> element within another <kbd> element represents an actual key or other unit of input as a portion of a larger input. see representing keystrokes within an input below. nesting a <kbd> element inside a <samp> element represents input that has been echoed back to the u...
<keygen> - HTML: Hypertext Markup Language
ittable, resettable form-associated element, palpable content. permitted content none, it is an empty element. tag omission must have a start tag and must not have an end tag. permitted parents any element that accepts phrasing content. permitted aria roles none dom interface htmlkeygenelement attributes this element includes the
global attributes. autofocus this boolean attribute lets you specify that 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 element in a document can have the autofocus attribute, which is a boolean. challenge a challenge string that is submitted along with the public key. defaults to an empty string i...
<label> - HTML: Hypertext Markup Language
put type="checkbox" name="peas"> </label> other usage notes: the form control that the label is labeling is called the labeled control of the label element. one input can be associated with multiple labels. when a <label> is clicked or tapped and it is associated with a form control, the resulting click event is also raised for the associated control. attributes this element includes the
global attributes. for the id of a labelable form-related element in the same document as the <label> element. the first element in the document with an id matching the value of the for attribute is the labeled control for this label element, if it is a labelable element. if it is not labelable then the for attribute has no effect. if there are other elements which also match the id value, later in ...
<legend> - HTML: Hypertext Markup Language
ent and headings (h1–h6 elements). tag omission none, both the starting and ending tag are mandatory. permitted parents a <fieldset> whose first child is this <legend> element implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmllegendelement attributes this element only includes the
global attributes. examples see <form> for examples on <legend>. specifications specification status comment html living standardthe definition of '<legend>' in that specification. living standard definition of the legend element html5the definition of '<legend>' in that specification. recommendation html 4.01 specificationthe definition of ...
<li> - HTML: Hypertext Markup Language
an <ul>, <ol>, or <menu> element. though not a conforming usage, the obsolete <dir> can also be a parent. implicit aria role listitem when child of an ol, ul or menu permitted aria roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem dom interface htmllielement attributes this element includes the
global attributes. value this integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. the only allowed value for this attribute is a number, even if the list is displayed with roman numerals or letters. list items that follow this one continue numbering from the value set. the value attribute has no meaning for unordered lists (<ul>) or for menus (<menu...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
der's img-src directive is not preventing access to it. the html and xhtml specifications define event handlers for the <link> element, but it is unclear how they would be used. under xhtml 1.0, empty elements such as <link> require a trailing slash: <link />. webtv supports the use of the value next for rel to preload the next page in a document series. attributes this element includes the
global attributes. as this attribute is only used when rel="preload" or rel="prefetch" has been set on the <link> element. it specifies the type of content being loaded by the <link>, which is necessary for request matching, application of correct content security policy, and setting of correct accept request header. furthermore, rel="preload" uses this as a signal for request prioritization. the ta...
<listing> - HTML: Hypertext Markup Language
ternal html! instead use the <pre> element or if semantically adequate the <code> element, eventually escaping the html '<' and '>' so that they don't get interpreted. a monospaced font can also be obtained on a simple <div> element, by applying an adequate css style using monospace as the generic-font value in a font-family property. attributes this element has no other attributes than the
global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn...
<main> - HTML: Hypertext Markup Language
content flow content. tag omission none; both the starting and ending tags are mandatory. permitted parents where flow content is expected, but only if it is a hierarchically correct main element. implicit aria role main permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the
global attributes. usage notes the content of a <main> element should be unique to the document. content that is repeated across a set of documents or document sections such as sidebars, navigation links, copyright information, site logos, and search forms shouldn't be included unless the search form is the main function of the page. <main> doesn't contribute to the document's outline; that is, unlik...
<map> - HTML: Hypertext Markup Language
t. permitted content any transparent element. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmapelement attributes this element includes the
global attributes. name the name attribute gives the map a name so that it can be referenced. the attribute must be present and must have a non-empty value with no space characters. the value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another <map> element in the same document. if the id attribute is also specified, both attributes must ha...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes typical use cases for <mark> include: when used in a quotation (<q>) or block quote (<blockquote>), it generally indicates text which is of special interest but is not marked in the original source material, or material which needs special scrutiny even though the original author didn't think it was of particular importance. think of this like using a highlighter pen ...
<menu> - HTML: Hypertext Markup Language
tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar or tree dom interface htmlmenuelement attributes this element includes the
global attributes. label the name of the menu as shown to the user. used within nested menus, to provide a label through which the submenu can be accessed. must only be specified when the parent element is a <menu> in the context menu state. type this attribute indicates the kind of menu being declared, and can be one of two values. context : indicates the popup menu state, which represent...
<menuitem> - HTML: Hypertext Markup Language
nd tag. permitted parents the <menu> element, where that element is in the popup menu state. (if specified, the type attribute of the <menu> element must be popup; if missing, the parent element of the <menu> must itself be a <menu> in the popup menu state.) permitted aria roles none dom interface htmlmenuitemelement attributes this element includes the
global attributes; in particular title can be used to describe the command, or provide usage hints. checked boolean attribute which indicates whether the command is selected. may only be used when the type attribute is checkbox or radio. command specifies the id of a separate element, indicating a command to be invoked indirectly. may not be used within a menu item that also includes the attribute...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
s set, the meta element is a pragma directive, providing information equivalent to what can be given by a similarly-named http header. if the charset attribute is set, the meta element is a charset declaration, giving the character encoding in which the document is encoded. if the itemprop attribute is set, the meta element provides user-defined metadata. attributes this element includes the
global attributes. note: the attribute name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same <meta> element that has any existing name, http-equiv or charset attributes. charset this attribute declares the document's character encoding. if the attribute is present, its value must be an ascii case-insensitive match for the string "utf-8". conte...
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
there must be no <meter> element among its descendants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmeterelement attributes this element includes the
global attributes. value the current numeric value. this must be between the minimum and maximum values (min attribute and max attribute) if they are specified. if unspecified or malformed, the value is 0. if specified, but not within the range given by the min attribute and max attribute, the value is equal to the nearest end of the range. note: unless the value attribute is between 0 and 1 (inclu...
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
content, palpable content. permitted content flow content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role navigation permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the
global attributes. usage notes it's not necessary for all links to be contained in a <nav> element. <nav> is intended only for major block of navigation links; typically the <footer> element often has a list of links that don't need to be in a <nav> element. a document may have several <nav> elements, for example, one for site navigation and one for intra-page navigation. aria-labelledby can be use...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
ion 2 strict level 2 this excludes these depreciated elements and also forbids such constructs as nesting a header (<h*> element) within a link (<a> element), or having a forms <input> element which is not within a block level element such as <p> html version 3.2 <nextid> has vanished altogether, never to be heard from again. attributes like all other html elements, this element accepts the
global attributes. n reference to anchor. example the user enters four section headings into the table of contents (and presumably also writing paragraph material within these sections). the heading for each of the four sections would be assigned name values of "z0", "z1", "z2", and "z3". the first of these would produce an entry in the table of contents like this: <a name="z0" href="#z4">first s...
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
o present an alternate form of the site that doesn't use frames but still offers the same or similar functionality. in html 5 and later, <noframes> is obsolete and shouldn't be used, since the <frame> and <frameset> elements are also obsolete. when frames are needed at all, they should be presented using the <iframe> element. attributes like all other html elements, this element supports the
global attributes. it has no other attributes available. example in this example, we see a frameset with two frames. in addition, <noframes> is used to present an explanatory message if the user agent doesn't support frames. <frameset cols="50%,50%"> <frame src="https://developer.mozilla.org/en/html/element/frameset" /> <frame src="https://developer.mozilla.org/en/html/element/frame" /> <nofram...
<noscript> - HTML: Hypertext Markup Language
ents any element that accepts phrasing content, if there are no ancestor <noscript> element, or in a <head> element (but only for an html document), here again if there are no ancestor <noscript> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the
global attributes. examples <noscript> <!-- anchor linking to external file --> <a href="https://www.mozilla.com/">external link</a> </noscript> <p>rocks!</p> result with scripting enabled rocks! result with scripting disabled external link rocks! specifications specification status comment html living standardthe definition of '<noscript>' in that specification...
<object> - HTML: Hypertext Markup Language
or more <param> elements, then transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, image dom interface htmlobjectelement attributes this element includes the
global attributes. archivehtml 4 onlyobsolete since html5 a space-separated list of uris for archives of resources for the object. borderdeprecated since html4.01obsolete since html5 the width of a border around the control, in pixels. classidhtml 4 onlyobsolete since html5 the uri of the object's implementation. it can be used together with, or in place of, the data attribute. codebasehtml 4 o...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the
global attributes. reversed this boolean attribute specifies that the list’s items are in reverse order. items will be numbered from high to low. start an integer to start counting from for the list items. always an arabic numeral (1, 2, 3, etc.), even when the numbering type is letters or roman numerals. for example, to start numbering elements from the letter "d" or the roman numeral "iv," use...
<optgroup> - HTML: Hypertext Markup Language
optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content. permitted parents a <select> element. implicit aria role group permitted aria roles no role permitted dom interface htmloptgroupelement note: optgroup elements may not be nested. attributes this element includes the
global attributes. disabled if this boolean attribute is set, none of the items in this option group is selectable. often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones. label the name of the group of options, which the browser can use when labeling the options in the user interface. this attribute is mandatory if this element is us...
<option>: The HTML Option element - HTML: Hypertext Markup Language
optional if this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content. permitted parents a <select>, an <optgroup> or a <datalist> element. implicit aria role option permitted aria roles no role permitted dom interface htmloptionelement attributes this element includes the
global attributes. disabled if this boolean attribute is set, this option is not checkable. often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. if this attribute is not set, the element can still be disabled if one of its ancestors is a disabled <optgroup> element. label this attribute is text for the label indicating the meaning o...
<output>: The Output element - HTML: Hypertext Markup Language
sociated element, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role status permitted aria roles any dom interface htmloutputelement attributes this element includes the
global attributes. for a space-separated list of other elements’ ids, indicating that those elements contributed input values to (or otherwise affected) the calculation. form the <form> element to associate the output with (its form owner). the value of this attribute must be the id of a <form> in the same document. (if this attribute is not set, the <output> is associated with its ancestor <for...
<p>: The Paragraph element - HTML: Hypertext Markup Language
tion>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlparagraphelement attributes this element only includes the
global attributes. note: the align attribute on <p> tags is obsolete and shouldn't be used. example html <p>this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text.</p> <p>this is the second paragraph. this is the second paragraph. this is the second paragraph. this is the second paragraph.</p> ...
<param>: The Object Parameter element - HTML: Hypertext Markup Language
it is an empty element. tag omission as it is a void element, the start tag must be present and the end tag must not be present. permitted parents an <object> before any flow content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlparamelement attributes this element includes the
global attributes. name name of the parameter. value specifies the value of the parameter. deprecated attributes type only used if the valuetype is set to ref. specifies the mime type of values found at the uri specified by value. valuetype specifies the type of the value attribute. possible values are: data: default value. the value is passed to the object's implementation...
<picture>: The Picture element - HTML: Hypertext Markup Language
ptionally intermixed with script-supporting elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that allows embedded content. implicit aria role no corresponding 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 chan...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as html. a monospaced font can be applied to any html element via a css font-family style with the monospace generic value. attributes this element has no other attributes than the
global attributes common to all elements. dom interface this element implements the htmlelement interface. implementation note: in gecko 1.9.2 and before, firefox implements the interface htmlspanelement for this element. ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
ent, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlpreelement attributes this element only includes the
global attributes. cols contains the preferred count of characters that a line should have. it was a non-standard synonym of width. to achieve such an effect, use css width instead. width contains the preferred count of characters that a line should have. though technically still implemented, this attribute has no visual effect; to achieve such an effect, use css width instead. wrap is a ...
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
but there must be no <progress> element among its descendants. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role progressbar permitted aria roles no role permitted dom interface htmlprogresselement attributes this element includes the
global attributes. max this attribute describes how much work the task indicated by the progress element requires. the max attribute, if present, must have a value greater than 0 and be a valid floating point number. the default value is 1. value this attribute specifies how much of the task that has been completed. it must be a valid floating point number between 0 and max, or between 0 and 1 if ...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks around text inside a <q> element. a style rule may be needed to add quotation marks in older browsers. attributes this element includes the
global attributes. cite the value of this attribute is a url that designates a source document or message for the information quoted. this attribute is intended to point to information explaining the context or the reference for the quote. example <p>according to mozilla's website, <q cite="https://www.mozilla.org/about/history/details/">firefox 1.0 was released in 2004 and became a big suc...
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
of a <ruby> element. tag omission the end tag can be omitted if the element is immediately followed by an <rt>, <rtc>, or <rp> element or another <rb> element, or if there is no more content in the parent element. permitted parents a <ruby> element. permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes ruby annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters. the <rb> element is used to separate out each segment of the ruby base text. even though <rb> is not an empty element, it is common to just include the opening tag of each element in the source code, so that the ruby markup is less co...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
ately followed by an <rt> or another <rp> element, or if there is no more content in the parent element. permitted parents a <ruby> element. <rp> must be positioned immediately before or after an <rt> element. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes ruby annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters. the <rp> element is used in the case of lack of <ruby> element support; the <rp> content provides what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses. examples this example uses ruby ...
<rt>: The Ruby Text element - HTML: Hypertext Markup Language
tag omission the end tag may be omitted if the <rt> element is immediately followed by an <rt> or <rp> element, or if there is no more content in the parent element permitted parents a <ruby> element. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. examples this simple example provides romaji transliteration for the kanji characters within the <ruby> element: <ruby> 漢 <rt>kan</rt> 字 <rt>ji</rt> </ruby> body { font-size: 22px; } the output looks like this in your browser: on a browser without ruby support, this example might look like this: 漢 kan 字 ji body { font-size: 22px; } specification...
<rtc>: The Ruby Text Container element - HTML: Hypertext Markup Language
permitted content phrasing content or <rt> elements. tag omission the closing tag can be omitted if it is immediately followed by a <rb>, <rtc> or <rt> element opening tag or by its parent closing tag. permitted parents a <ruby> element. permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. examples <div class="info"> <ruby> <rbc> <rb>旧</rb><rt>jiù</rt> <rb>金</rb><rt>jīn</rt> <rb>山</rb><rt>shān</rt> </rbc> <rtc>san francisco</rtc> </ruby> </div> .info { padding-top: 10px; font-size: 36px; } specifications specification status comment html 5.2the definition of '<rtc>' in that specificati...
<ruby> - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. examples example 1: character <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> example 2: word <ruby> 明日 <rp>(</rp><rt>ashita</rt><rp>)</rp> </ruby> specifications specification status comment html living standardthe definition of '<ruby>' in that specification. living standard html5the...
<s> - HTML: Hypertext Markup Language
tent or flow content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. examples <s>today's special: salmon</s> sold out<br> <span style="text-decoration:line-through;">today's special: salmon</span> sold out accessibility concerns the presence of the s element is not announced by most screen reading technology in its default confi...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes you can use a css rule to override the browser's default font face for the <samp> element; however, it's possible that the browser's preferences may take precedence over any css you specify. the css to override the default font face would look like this: samp { font-family: "courier"; } if you need an element which will serve as a container for output generated by ...
<script>: The Script element - HTML: Hypertext Markup Language
ascript. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts metadata content, or any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlscriptelement attributes this element includes the
global attributes. asynchtml5 for classic scripts, if the async attribute is present, then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available. for module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as ...
<section>: The Generic Section element - HTML: Hypertext Markup Language
usage notes each <section> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <section> element. if it makes sense to separately syndicate the content of a <section> element, use an <article> element instead. do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for sty...
<select>: The HTML Select element - HTML: Hypertext Markup Language
and size to specify how many options should be shown at once. it also accepts most of the general form input attributes such as required, disabled, autofocus, etc. you can further nest <option> elements inside <optgroup> elements to create separate groups of options inside the dropdown. for further examples, see the native form widgets: drop-down content. attributes this element includes the
global attributes. autocomplete a domstring providing a hint for a user agent's autocomplete feature. see the html autocomplete attribute for a complete list of values and details on how to use autocomplete. autofocus this boolean attribute lets you specify that a form control should have input focus when the page loads. only one form element in a document can have the autofocus attribute. disabl...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
not useful in ordinary html. content categories transparent content permitted content flow content tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. permitted aria roles none dom interface htmlshadowelement attributes this element includes the
global attributes. example here is a simple example of using the <shadow> element. it is an html file with everything needed in it. note: this is an experimental technology. for this code to work, the browser you display it in must support web components. see enabling web components in firefox. <html> <head></head> <body> <!-- this <div> will hold the shadow roots. --> <div> <!-- this...
<slot> - HTML: Hypertext Markup Language
tted content transparent events slotchange tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlslotelement attributes this element includes the
global attributes. name the slot's name. a named slot is a <slot> element with a name attribute. examples <template id="element-details-template"> <style> details {font-family: "open sans light", helvetica, arial, sans-serif } .name {font-weight: bold; color: #217ac0; font-size: 120% } h4 { margin: 10px 0 -8px 0; background: #217ac0; color: white; padding: 2...
<small>: the side comment element - HTML: Hypertext Markup Language
tted content phrasing content tag omission none, must have both a start tag and an end tag. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. examples basic usage <p>this is the first sentence. <small>this whole sentence is in small letters.</small> </p> css alternative <p>this is the first sentence. <span style="font-size:0.8em">this whole sentence is in small letters.</span> </p> specifications specification status comments html living standardthe definition of '<small>' in th...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
permitted parents a media element—<audio> or <video>—and it must be placed before any flow content or <track> element. a <picture> element, and it must be placed before the <img> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlsourceelement attributes this element includes the
global attributes. media media query of the resource's intended media; this should be used only in a <picture> element. sizes is a list of source sizes that describes the final rendered width of the image represented by the source. each source size consists of a comma-separated list of media condition-length pairs. this information is used by the browser to determine, before laying the page out,...
<spacer> - HTML: Hypertext Markup Language
hich was something web designers used to use to add white spaces to web pages without actually using an image. however, <spacer> no longer supported by any major browser and the same effects can now be achieved using simple css. firefox, which is the descendant of netscape's browsers, removed support for <spacer> in version 4. attributes like all other html elements, this element supports the
global attributes. type this attribute determines type of spacer. possible values are horizontal, vertical and block. size this attribute can be used for defining size of spacer in pixels when type is horizontal or vertical. width this attribute can be used for defining width of spacer in pixels when type is block. height this attribute can be used for defining height of spacer in pixels when ...
<span> - HTML: Hypertext Markup Language
none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlspanelement (before html5, the interface was htmlelement) attributes this element only includes the
global attributes. example example 1 html <p><span>some text</span></p> result example 2 html <li><span> <a href="portfolio.html" target="_blank">see my portfolio</a> </span></li> css li span { background: gold; } result specifications specification status comment html living standardthe definition of '<span>' in that specification. living standar...
<strike> - HTML: Hypertext Markup Language
the html <strike> element (or html strikethrough element) places a strikethrough (horizontal line) over text. usage note: this element is deprecated in html 4 and xhtml 1, and obsoleted in html5. if semantically appropriate, i.e., if it represents deleted content, use <del> instead. in all other cases use <s>. dom interface htmlelement attributes this element includes the
global attributes. example <strike>: <strike>today's special: salmon</strike> sold out<br /> <s>: <s>today's special: salmon</s> sold out the result of this code is: specifications specification status comment html5the definition of '<strike>' in that specification. recommendation make obsolete in favor of <del> and <s>. html 4.01 specificat...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
ted content phrasing content. tag omission none, must have both a start tag and an end tag. permitted parents any element that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes the <strong> element is for content that is of "strong importance," including things of great seriousness or urgency (such as warnings). this could be a sentence that is of great importance to the whole page, or you could merely try to point out that some words are of greater importance compared to nearby content. typically this element is rendered by default using a bo...
<style>: The Style Information element - HTML: Hypertext Markup Language
they are included in the document — make sure you include them in the correct order, to avoid unexpected cascade issues. in the same manner as <link> elements, <style> elements can include media attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width. attributes this element includes the
global attributes. type this attribute defines the styling language as a mime type (charset should not be specified). this attribute is optional and defaults to text/css if it is not specified; values other than the empty string or text/css are not used. note: there is very little reason to include this attribute in modern web documents. media this attribute defines which media the style should be...
<sub>: The Subscript element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes the <sub> element should be used only for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. for example, using <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, css shoul...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
quest. permitted content phrasing content or one element of heading content tag omission none, both the start tag and the end tag are mandatory. permitted parents the <details> element. implicit aria role button permitted aria roles no role permitted dom interface htmlelement attributes this element only includes the
global attributes. usage notes the <summary> element's contents can be any heading content, plain text, or html that can be used within a paragraph. a <summary> element may only be used as the first child of a <details> element. when the user clicks on the summary, the parent <details> element is toggled open or closed, and then a toggle event is sent to the <details> element, which can be used to le...
<sup>: The Superscript element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes the <sup> element should only be used for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. for example, to style the wordmark of a business or product which uses a raised baseline should be done using css (most likely vertical-align) rath...
<table>: The Table element - HTML: Hypertext Markup Language
one or more <tr> elements an optional <tfoot> element tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role table permitted aria roles any dom interface htmltableelement attributes this element includes the
global attributes. deprecated attributes align this enumerated attribute indicates how the table must be aligned inside the containing document. it may have the following values: left: the table is displayed on the left side of the document; center: the table is displayed in the center of the document; right: the table is displayed on the right side of the document. set margin-left...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
sent, if its parent <table> element has a <tr> element as a child. permitted parents within the required parent <table> element, the <tbody> element can be added after a <caption>, <colgroup>, and a <thead> element. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the
global attributes. deprecated attributes align this enumerated attribute specifies how horizontal alignment of each cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is ju...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
datory. the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element includes the
global attributes. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribute contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to thi...
<template>: The Content Template element - HTML: Hypertext Markup Language
permitted parents any element that accepts metadata content, phrasing content, or script-supporting elements. also allowed as a child of a <colgroup> element that does not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltemplateelement attributes this element only includes the
global attributes. however, the htmltemplateelement has a content property, which is a read-only documentfragment containing the dom subtree which the template represents. note that directly using the value of the content could lead to unexpected behavior, see avoiding documentfragment pitfall section below. examples first we start with the html portion of the example. <table id="producttable"> <t...
<textarea> - HTML: Hypertext Markup Language
to take. setting these is a good idea for consistency, as browser defaults can differ. default content entered between the opening and closing tags. <textarea> does not support the value attribute. the <textarea> element also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required. attributes this element includes the
global attributes. autocapitalize this is a non-standard attribute supported by webkit on ios (therefore nearly all browsers running on ios, including safari, firefox, and chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. the non-deprecated values are available in ios 5 and later. possible values are: none: completel...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
or <tr> element. note that this is the requirement as of html5. html 4 the <tfoot> element cannot be placed after any <tbody> and <tr> element. note that this directly contradicts the above normative requirement from html5. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the
global attributes. deprecated attributes align deprecated since html4obsolete since html5 this enumerated attribute specifies how horizontal alignment of each cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the ...
<th> - HTML: Hypertext Markup Language
art tag is mandatory. the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role columnheader or rowheader permitted aria roles any dom interface htmltableheadercellelement attributes this element includes the
global attributes. abbr this attribute contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and ...
<thead>: The Table Head element - HTML: Hypertext Markup Language
wed by a <tbody> or <tfoot> element. permitted parents a <table> element. the <thead> must appear after any <caption> or <colgroup> element, even implicitly defined, but before any <tbody>, <tfoot> and <tr> element. implicit aria role rowgroup permitted aria roles any dom interface htmltablesectionelement attributes this element includes the
global attributes. deprecated attributes align in html 4, in html5 this enumerated attribute specifies how horizontal alignment of each cell content will be handled. possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so ...
<title>: The Document Title element - HTML: Hypertext Markup Language
closing tags are required. note that leaving off </title> should cause the browser to ignore the rest of the page. permitted parents a <head> element that contains no other <title> element. implicit aria role no corresponding role permitted aria roles no role permitted. dom interface htmltitleelement attributes this element only includes the
global attributes. usage notes the <title> element is always used within a page's <head> block. page titles and seo the contents of a page title can have significant implications for search engine optimization (seo). in general, a longer, descriptive title performs better than short or generic titles. the content of the title is one of the components used by search engine algorithms to decide the or...
<tr>: The Table Row element - HTML: Hypertext Markup Language
table row. this can take a little practice to get right when building your tables. we have some examples below, but for more examples and an in-depth tutorial, see the html tables series in our learn web development area, where you'll learn how to use the table elements and their attributes to get just the right layout and formatting for your tabular data. attributes this element includes the
global attributes. there are also several deprecated attributes, which you should avoid but may need to know when reading older code. deprecated attributes the following attributes may still be implemented in browsers but are no longer part of the html specification and may be missing or may not work as expected. they should be avoided. alignobsolete since html5 a domstring which specifies how the...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
empty element. tag omission as it is a void element, the start tag must be present and the end tag must not be present. permitted parents a media element, <audio> or <video>. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltrackelement attributes this element includes the
global attributes. default this attribute indicates that the track should be enabled unless the user's preferences indicate that another track is more appropriate. this may only be used on one track element per media element. kind how the text track is meant to be used. if omitted the default kind is subtitles. if the attribute contains an invalid value, it will use metadata (versions of chrome ea...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes examples basic example this example uses <tt> to show text entered into, and output by, a terminal application. <p>enter the following at the telnet command prompt: <code>set localecho</code><br /> the telnet client should display: <tt>local echo is on</tt></p> result overriding the default font you can override the browser's default font—if the browser permits you to do s...
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes along with other pure styling elements, the original html underline (<u>) element was deprecated in html 4; however, <u> was restored in html 5 with a new, semantic, meaning: to mark text as having some form of non-textual annotation applied. be careful to avoid using the <u> element with its default styling (of underlined text) in such a way as to be confused with a h...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlulistelement attributes this element includes the
global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent, and it doesn't work in all browsers. warning: do not use this attribute, as it has been deprecated: use css instead. to give a similar effect as the compact attribute, the css property line-height can be used with a value of...
<var>: The Variable element - HTML: Hypertext Markup Language
nt, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. usage notes related elements other elements that are used in contexts in which <var> is commonly used include: <code>: the html code element <kbd>: the html keyboard input element <samp>: the html sample output element if you encounter code that is mistakenly using <var> for style purposes rather than semantic purposes, you should either use a <span> with appropriate css or,...
<wbr> - HTML: Hypertext Markup Language
ontent. permitted content empty tag omission it is an empty element; it must have a start tag, but must not have an end tag. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the
global attributes. notes on utf-8 encoded pages, <wbr> behaves like the u+200b zero-width space code point. in particular, it behaves like a unicode bidi bn code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123. for the same reason, the <wbr> element does not introduce a hyphen at the line break poi...
<xmp> - HTML: Hypertext Markup Language
e> element or, if semantically adequate, the <code> element instead. note that you will need to escape the '<' character as '<' to make sure it is not interpreted as markup. a monospaced font can also be obtained on any element, by applying an adequate css style using monospace as the generic-font value for the font-family property. attributes this element has no other attributes than the
global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. ...
accesskey - HTML: Hypertext Markup Language
the attribute value must consist of a single printable character (which includes accented and other characters that can be generated by the keyboard). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: in the whatwg spec, it says you can specify multiple space-separated characters, and the browser will use the first one it supports. however, this does not work in most browsers. ie/edge uses the first one it supports without problems, provided there are no conflicts with other commands. ...
autocapitalize - HTML: Hypertext Markup Language
the attribute must take one of the following values: off or none: no autocapitalization is applied (all letters default to lowercase) on or sentences: the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words: the first letter of each word defaults to a capital letter; all other letters default to lowercase characters: all letters should default to uppercase the autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard. ...
contenteditable - HTML: Hypertext Markup Language
if so, the browser modifies its widget to allow editing. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the attribute must take one of the following values: true or an empty string, which indicates that the element is editable. false, which indicates that the element is not editable. if the attribute is given without a value, like <label contenteditable>example label</label>, its value is treated as an empty string. ...
contextmenu - HTML: Hypertext Markup Language
a context menu is a menu that appears upon user interaction, such as a right-click. html5 now allows us to customize this menu. here are some implementation examples, including nested menus. ...
data-* - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. all such custom data are available via the htmlelement interface of the element the attribute is set on. the htmlelement.dataset property gives access to them. ...
draggable - HTML: Hypertext Markup Language
draggable can have the following values: true: the element can be dragged. false: the element cannot be dragged. this attribute is enumerated and not boolean. a value of true or false is mandatory, and shorthand like <img draggable> is forbidden. the correct usage is <img draggable="false">. if this attribute is not set, its default value is auto, which means drag behavior is the default browser behavior: only text selections, images, and links can be dragged. for other elements, the event ondragstart must be set for drag and drop to work, as shown in this comprehensive example. ...
dropzone - HTML: Hypertext Markup Language
it can have the following values: copy, which indicates that dropping will create a copy of the element that was dragged. move, which indicates that the element that was dragged will be moved to this new location. link, which will create a link to the dragged data. specifications specification status comment html 5.1the definition of 'dropzone' in that specification. ...
hidden - HTML: Hypertext Markup Language
for example, it can be used to hide elements of the page that can't be used until the login process has been completed. browsers won't render elements with the hidden attribute set. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the hidden attribute must not be used to hide content just from one presentation. if something is marked hidden, it is hidden from all presentations, including, for instance, screen readers. ...
inputmode - HTML: Hypertext Markup Language
it can have the following values: none no virtual keyboard. for when the page implements its own keyboard input control. text (default value) standard input keyboard for the user's current locale. decimal fractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically . or ,). devices may or may not show a minus key (-). numeric numeric input keyboard, but only requires the digits 0–9. devices may or may not show a minus key. tel a telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key. ...
is - HTML: Hypertext Markup Language
this attribute can only be used if the specified custom element name has been successfully defined in the current document, and extends the element type it is being applied to. examples the following code is taken from our word-count-web-component example (see it live also). // create a class for the element class wordcount extends htmlparagraphelement { constructor() { // always call super first in constructor super(); // constructor contents ommitted for brevity ... ...
itemprop - HTML: Hypertext Markup Language
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>, 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. ...
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. ...
part - HTML: Hypertext Markup Language
part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element. see our shadow part example for a usage example. specifications specification status comment shadow partsthe definition of 'part' in that specification. ...
slot - HTML: Hypertext Markup Language
for examples, see our using templates and slots guide. specifications specification status comment html living standardthe definition of 'slot attribute' in that specification. living standard domthe definition of 'slot attribute' in that specification. ...
spellcheck - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors. note: the spellcheck attribute is an enumerated one and not a boolean one. ...
translate - HTML: Hypertext Markup Language
it can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized. "no", which indicates that the element must not be translated. although not all browsers recognize this attribute, it is respected by automatic translation systems such as google translate, and may also be respected by tools used by human translators. as such it's important that web authors use this attribute to mark content that should not be translated. ...
Microdata - HTML: Hypertext Markup Language
ws) and hproduct (product data) and provides its own format for the definition of the terms and 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 el...
HTML reference - HTML: Hypertext Markup Language
this html reference describes all elements and attributes of html, including
global attributes that apply to all elements. html element reference this page lists all the html elements, which are created using tags. html attribute reference elements in html have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want.
global attributes
global attributes are attributes common to all html elements; they can be used on all elements, though they may have no effect on some elements. link types in html, the following link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, or <link> element. content categories every html element is a member of on...
HTML: Hypertext Markup Language
s. references html reference html consists of elements, each of which may be modified by some number of attributes. html documents are connected to each other with links. html element reference browse a list of all html elements. html attribute reference elements in html have attributes. these are additional values that configure the elements or adjust their behavior in various ways.
global attributes
global attributes may be specified on all html elements, even those not specified in the standard. this means that any non-standard elements must still permit these attributes, even though those elements make the document html5-noncompliant. inline elements and block-level elements html elements are usually "inline" or "block-level" elements. an inline element occupies only the spac...
Using HTTP cookies - HTTP
er settings or extensions. cookie blocking can cause some third-party components (such as social media widgets) to not function as intended. cookie-related regulations legislation or regulations that cover the use of cookies include: the general data privacy regulation (gdpr) in the european union the eprivacy directive in the eu the california consumer privacy act these regulations have
global reach, because they apply to any site on the world wide web that is accessed by users from these jurisdictions (the eu and california, with the caveat that california's law applies only to entities with gross revenue over 25 million usd, among other things.) these regulations include requirements such as: notifying users that your site uses cookies. allowing users to opt out of receiving som...
Content-Language - HTTP
english), which is optionally followed by a series of subtags that refine or narrow that language's range (e.g., "en-ca" = the variety of english as communicated in canada). note: language tags are formaly defined in rfc 5646, which rely on the iso 639 standard (quite often the iso 639-1 code list) for language codes to be used. examples indicating the language a document is written in the
global lang attribute is used on html elements to indicate the language of an entire html document or parts of it. <html lang="de"> do not use this meta element like this for stating a document language: <!-- /!\ this is bad practice --> <meta http-equiv="content-language" content="de"> indicating a target audience for a resource the content-language header is used to specify the intended audience...
Content-Security-Policy-Report-Only - HTTP
ve whose enforcement caused the violation. original-policy the original policy as specified by the content-security-policy-report-only http header. referrer the referrer of the document in which the violation occurred. script-sample the first 40 characters of the inline script, event handler, or style that caused the violation. status-code the http status code of the resource on which the
global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. content-security-policy-report-only: default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports the ht...
Content-Security-Policy - HTTP
ure legacy urls that need to be rewritten. csp in workers workers are in general not governed by the content security policy of the document (or parent worker) that created them. to specify a content security policy for the worker, set a content-security-policy response header for the request which requested the worker script itself. the exception to this is if the worker script's origin is a
globally unique identifier (for example, if its url has a scheme of data or blob). in this case, the worker does inherit the content security policy of the document or worker that created it. multiple content security policies the csp mechanism allows multiple policies being specified for a resource, including via the content-security-policy header, the content-security-policy-report-only header and a...
Cross-Origin-Opener-Policy - HTTP
if a cross-origin document with coop is opened in a new window, the opening document will not have a reference to it, and the window.opener property of the new window will be null. ...
Expressions and operators - JavaScript
rty. 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 true (can delete ...
Indexed collections - JavaScript
ake a callback are known as iterative methods, because they iterate over the entire array in some fashion. each one takes an optional second argument called thisobject. if provided, thisobject becomes the value of the this keyword inside the body of the callback function. if not provided, as with other cases where a function is invoked outside of an explicit object context, this will refer to the
global object (window) when using arrow function as callback, or undefined when using normal function as callback. the callback function is called with two arguments, that are array's elements. the function below compares two values and returns one of three values: for instance, the following will sort by the last letter of a string: let sortfn = function(a, b) { if (a[a.length - 1] < b[b.length -...
JavaScript modules - JavaScript
trict mode automatically. there is no need to use the defer attribute (see <script> attributes) when loading a module script; modules are deferred automatically. modules are only executed once, even if they have been referenced in multiple <script> tags. last but not least, let's make this clear — module features are imported into the scope of a single script — they aren't available in the
global scope. therefore, you will only be able to access imported features in the script they are imported into, and you won't be able to access them from the javascript console, for example. you'll still get syntax errors shown in the devtools, but you'll not be able to use some of the debugging techniques you might have expected to use. default exports versus named exports the functionality we've e...
Working with objects - JavaScript
can remove a non-inherited property by using the delete operator. the following code shows how to remove a property. // creates a new object, myobj, with two properties, a and b. var myobj = new object; myobj.a = 5; myobj.b = 12; // removes the a property, leaving myobj with only the b property. delete myobj.a; console.log ('a' in myobj); // output: "false" you can also use delete to delete a
global variable if the var keyword was not used to declare the variable: g = 17; delete g; comparing objects in javascript, objects are a reference type. two distinct objects are never equal, even if they have the same properties. only comparing the same object reference with itself yields true. // two variables, two distinct objects with the same properties var fruit = {name: 'apple'}; var fruitbe...
JavaScript technologies overview - JavaScript
uage is also used in non-browser environments, for example in node.js. what falls under the ecmascript scope? among other things, ecmascript defines: language syntax (parsing rules, keywords, control flow, object literal initialization, ...) error handling mechanisms (throw, try...catch, ability to create user-defined error types) types (boolean, number, string, function, object, ...) the
global object. in a browser, this
global object is the window object, but ecmascript only defines the apis not specific to browsers, e.g. parseint, parsefloat, decodeuri, encodeuri... a prototype-based inheritance mechanism built-in objects and functions (json, math, array.prototype methods, object introspection methods, etc.) strict mode browser support as of october 2016, the current versions of...
Classes - JavaScript
static eat() { return this; } } let obj = new animal(); obj.speak(); // the animal object let speak = obj.speak; speak(); // undefined animal.eat() // class animal let eat = animal.eat; eat(); // undefined if we rewrite the above using traditional function-based syntax in non–strict mode, then this method calls is automatically bound to the initial this value, which by default is the
global object. in strict mode, autobinding will not happen; the value of this remains as passed. function animal() { } animal.prototype.speak = function() { return this; } animal.eat = function() { return this; } let obj = new animal(); let speak = obj.speak; speak(); //
global object (in non–strict mode) let eat = animal.eat; eat(); //
global object (in non-strict mode) instance properties...
Deprecated and obsolete features - JavaScript
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 whether or not to search in strings across multiple lines. source the text of the pattern.
SyntaxError: invalid regular expression flag "x" - JavaScript
n the constructor function of the regexp object (second parameter). regular expression flags can be used separately or together in any order, but there are only six of them in ecmascript. to include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new regexp('pattern', 'flags'); regular expression flags flag description g
global search. i case-insensitive search. m multi-line search. s allow . to match newlines (added in ecmascript 2018) u unicode; treat pattern as a sequence of unicode code points y perform a "sticky" search that matches starting at the current position in the target string. see sticky examples there are only six valid regular expressio...
TypeError: invalid assignment to const "x" - JavaScript
r. check what was intended to be achieved with the constant in question. rename if you meant to declare another constant, pick another name and re-name. this constant name is already taken in this scope. const columns = 80; const wide_columns = 120; const, let or var? do not use const if you weren't meaning to declare a constant. maybe you meant to declare a block-scoped variable with let or
global variable with var. let columns = 80; // ... let columns = 120; scoping check if you are in the correct scope. should this constant appear in this scope or was it meant to appear in a function, for example? const columns = 80; function setupbigscreenenvironment() { const columns = 120; } const and immutability the const declaration creates a read-only reference to a value. it does not ...
SyntaxError: missing = in const declaration - JavaScript
ixing the error there are multiple options to fix this error. check what was intended to be achieved with the constant in question. adding a constant value specify the constant value in the same statement in which it's declared: const columns = 80; const, let or var? do not use const if you weren't meaning to declare a constant. maybe you meant to declare a block-scoped variable with let or
global variable with var. both don't require an initial value. let columns; ...
TypeError: "x" is not a constructor - JavaScript
is not a constructor typeerror: reflect is not a constructor typeerror: intl is not a constructor typeerror: atomics is 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 no...
ReferenceError: assignment to undeclared variable "x" - JavaScript
e was an assignment without the var keyword. there are some differences between declared and undeclared variables, which might lead to unexpected results and that's why javascript presents an error in strict mode. three things to note about declared and undeclared variables: declared variables are constrained in the execution context in which they are declared. undeclared variables are always
global. declared variables are created before any code is executed. undeclared variables do not exist until the code assigning to them is executed. declared variables are a non-configurable property of their execution context (function or
global). undeclared variables are configurable (e.g. can be deleted). for more details and examples, see the var reference page. errors about undeclared variable ...
Method definitions - JavaScript
examples simple test case const obj = { a: 'foo', b() { return this.a } }; console.log(obj.b()) // "foo" computed property names the shorthand syntax also supports computed property names. const bar = { foo0: function() { return 0 }, foo1() { return 1 }, ['foo' + 2]() { return 2 } } console.log(bar.foo0()) // 0 console.log(bar.foo1()) // 1 console.log(bar.foo2()) // 2 // a
global function function foo() { return 1 } let name = 'foo' console.log(window[name]()) // 1 specifications specification ecmascript (ecma-262)the definition of 'method definitions' in that specification. ...
Array - JavaScript
description arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. neither the length of a javascript array nor the types of its elements are fixed. since an array's length can change at any time, and data can be stored at non-contiguous locations in the array, javascript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. ...
Atomics - JavaScript
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. ...
Date - JavaScript
~ september 13, 275760 ce) can be represented by the standard date object (equivalent to ±8,640,000,000,000,000 milliseconds). date format and time zone conversions there are a number of methods available to obtain a date in various formats, as well as to perform time zone conversions. particularly useful are the functions that output the date and time in coordinated universal time (utc), the
global standard time defined by the world time standard. (this time is historically known as greenwich mean time, as utc lies along the meridian that includes london—and nearby greenwich—in the united kingdom.) the user's device provides the local time. in addition to methods to read and alter individual components of the local date and time (such as getday() and sethours()), there are also version...
Error.prototype.stack - JavaScript
the non-standard stack property of error objects offer a trace of which functions were called, in what order, from which line and file, and with what arguments. the stack string proceeds from the most recent calls to earlier ones, leading back to the original
global scope call. description each step will be separated by a newline, with the first part of the line being the function name (if not a call from the
global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line number. (note that the error object also possesses the filename, linenumber and columnnumber properties for retrieving these from the error thrown (but only the error, and not its trace).) ...
Error - JavaScript
exceptions. see below for standard built-in error types. description runtime errors result in new error objects being created and thrown. error types besides the generic error constructor, there are seven other core error constructors in javascript. for client-side exceptions, see exception handling statements. evalerror creates an instance representing an error that occurs regarding the
global function eval(). internalerror creates an instance representing an error that occurs when an internal error in the javascript engine is thrown. e.g. "too much recursion". rangeerror creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid range. referenceerror creates an instance representing an error that occurs when de-referencing...
EvalError() constructor - JavaScript
this exception is not thrown by javascript anymore, however the evalerror object remains for compatibility. syntax new evalerror([message[, filename[, linenumber]]]) parameters message optional. human-readable description of the error filename optional. the name of the file containing the code that caused the exception linenumber optional. the line number of the code that caused the exception examples evalerror is not used in the current ecmascript specification and will thus not be thrown by the runtime. however, the object itself remains for backwards compatibility with earlier versions of the specification. ...
EvalError - JavaScript
this exception is not thrown by javascript anymore, however the evalerror object remains for compatibility. constructor evalerror() creates a new evalerror object. instance properties evalerror.prototype.message error message. although ecma-262 specifies that evalerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. evalerror.prototype.name error name. inherited from error. evalerror.prototype.filename path to file that raised this error. inherited from error. evalerror.prototype.linenumber line number in file that raised this error. inherited from error. ...
Math - JavaScript
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. ...
Number.NEGATIVE_INFINITY - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.negative_infinity writable no enumerable no configurable no description the value of number.negative_infinity is the same as the negative value of the
global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. any negative value, including negative_infinity, multiplied by negative_infinity is positive_infinity. any positive value divided by negative_infinity is negative zero. any negative value divid...
Number.POSITIVE_INFINITY - JavaScript
ribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.positive_infinity writable no enumerable no configurable no description the value of number.positive_infinity is the same as the value of the
global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by positive_infinity is positive_infinity. any negative value, including negative_infinity, multiplied by positive_infinity is negative_infinity. any positive number divided by positive_infinity is positive zero. any negative number div...
Number.parseFloat() - JavaScript
ing abstract operation. leading whitespace in this argument is ignored. return value a floating point number parsed from the given string. or nan when the first non-whitespace character cannot be converted to a number. polyfill if (number.parsefloat === undefined) { number.parsefloat = parsefloat; } examples number.parsefloat vs parsefloat this method has the same functionality as the
global parsefloat() function: number.parsefloat === parsefloat; // true this method is also part of ecmascript 2015. (its purpose is modularization of
globals.) see parsefloat() for more detail and examples. specifications specification ecmascript (ecma-262)the definition of 'number.parsefloat' in that specification. ...
Number.parseInt() - JavaScript
is does not default to 10! return value an integer parsed from the given string. if the radix is smaller than 2 or bigger than 36, and the first non-whitespace character cannot be converted to a number, nan is returned. polyfill if (number.parseint === undefined) { number.parseint = window.parseint } examples number.parseint vs parseint this method has the same functionality as the
global parseint() function: number.parseint === parseint // true and is part of ecmascript 2015 (its purpose is modularization of
globals). please see parseint() for more detail and examples. specifications specification ecmascript (ecma-262)the definition of 'number.parseint' in that specification. ...
Number.prototype.toLocaleString() - JavaScript
d with arguments. a check that works in all hosts, including those supporting ecma-262 prior to ed 5.1, is to test for the features specified in ecma-402 that are required to support regional options for number.prototype.tolocalestring directly: function tolocalestringsupportsoptions() { return !!(typeof intl == 'object' && intl && typeof intl.numberformat == 'function'); } this tests for a
global intl object, checks that it's not null and that it has a numberformat property that is a function. using locales this example shows some of the variations in localized number formats. in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: var number = 123456...
Number - JavaScript
ct. 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 is the same as the
global parsefloat() function. number.parseint(string, [radix]) this is the same as the
global parseint() function. instance methods number.prototype.toexponential(fractiondigits) returns a string representing the number in exponential notation. number.prototype.tofixed(digits) returns a string representing the number in fixed-point notation. number.prototype.tolocalestring([locales [, options...
Object.getOwnPropertySymbols() - JavaScript
ynames() 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.getownpropertysymbols(obj); console.log(objectsymbols.length); // 2 console.log(objectsymbols); // [symbol(a), symbol(b)] console.log(objectsymbols[0]); // symbol(a) specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertysymbols' in that specification. ...
Object.keys() - JavaScript
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. ...
Proxy - JavaScript
/* var doccookies = ... get the "doccookies" object here: https://developer.mozilla.org/docs/dom/document.cookie#a_little_framework.3a_a_complete_cookies_reader.2fwriter_with_full_unicode_support */ var doccookies = new proxy(doccookies, { get: function (otarget, skey) { return otarget[skey] || otarget.get...
Reflect - JavaScript
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. ...
RegExp() constructor - JavaScript
ains the flags to add. alternatively, if an object is supplied for the pattern, the flags string will replace any of that object's flags (and lastindex will be reset to 0) (as of es2015). if flags is not specified and a regular expressions object is supplied, that object's flags (and lastindex value) will be copied over. flags may contain any combination of the following characters: g (
global match) find all matches rather than stopping after the first match. i (ignore case) if u flag is also enabled, use unicode case folding. m (multiline) treat beginning and end characters (^ and $) as working over multiple lines. in other words, match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string. s ("dotall") a...
RegExp.prototype.compile() - JavaScript
the deprecated compile() method is used to (re-)compile a regular expression during execution of a script. it is basically the same as the regexp constructor. syntax regexobj.compile(pattern, flags) parameters pattern the text of the regular expression. flags if specified, flags can have any combination of the following values: g
global match i ignore case m multiline; treat beginning and end characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string) y sticky; matches only from the index indicated by the lastindex property of this regular expression in the target string (and does not attempt to match from any later indexes). descrip...
RegExpInstance.lastIndex - JavaScript
eger property of regular expression instances that specifies the index at which to start the next match. property attributes of regexpinstance.lastindex writable yes enumerable no configurable no description this property is set only if the regular expression instance used the g flag to indicate a
global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. if lastindex is equal to or less than the length of the string and if the regular expression matches the empty string, then the regular expression matches input starting from lastindex. if lastindex is equal t...
RegExp.prototype.sticky - JavaScript
no configurable yes description the value of sticky is a boolean and true if the "y" flag was used; otherwise, false. the "y" flag indicates that it matches only from the index indicated by the lastindex property of this regular expression in the target string (and does not attempt to match from any later indexes). a regular expression defined as both sticky and
global ignores the
global flag. you cannot change this property directly. it is read-only. examples using a regular expression with the sticky flag var str = '#foo#'; var regex = /foo/y; regex.lastindex = 1; regex.test(str); // true regex.lastindex = 5; regex.test(str); // false (lastindex is taken into account with sticky flag) regex.lastindex; // 0 (reset after match failure) anchored sticky fl...
Planned changes to shared memory - JavaScript
t access between two top-level window contexts will essentially only work if they are same-origin and carry the same two headers with the same two values. api changes as a result of this newly required environment, there are a couple api implications: the atomics object is always available. sharedarraybuffer objects are in principle always available, but unfortunately the constructor on the
global object is hidden, unless the two headers mentioned above are set, for compatibility with web content. there is hope that this restriction can be removed in the future. webassembly.memory can still be used to get an instance. unless the two headers mentioned above are set, the various postmessage() apis will throw for sharedarraybuffer objects. if they are set, postmessage() on window objects and...
String.prototype.matchAll() - JavaScript
e string is scanned. const regexp = regexp('[a-c]','g'); regexp.lastindex = 1; const str = 'abc'; array.from(str.matchall(regexp), m => `${regexp.lastindex} ${m[0]}`); // array [ "1 b", "1 c" ] better access to capturing groups (than string.prototype.match()) another compelling reason for matchall is the improved access to capture groups. ...
Symbol.prototype.description - JavaScript
it does not contain the enclosing "symbol()" string. see the examples. examples using description symbol('desc').tostring(); // "symbol(desc)" symbol('desc').description; // "desc" symbol('').description; // "" symbol().description; // undefined // well-known symbols symbol.iterator.tostring(); // "symbol(symbol.iterator)" symbol.iterator.description; // "symbol.iterator" //
global symbols symbol.for('foo').tostring(); // "symbol(foo)" symbol.for('foo').description; // "foo" specifications specification ecmascript (ecma-262)the definition of 'get symbol.prototype.description' in that specification. ...
Symbol.prototype.toString() - JavaScript
thod returns a string representation of the object. no string concatenation while you can call tostring() on symbols, you cannot use string concatenation with them: symbol('foo') + 'bar' // typeerror: can't convert symbol to string examples using tostring symbol('desc').tostring() // "symbol(desc)" // well-known symbols symbol.iterator.tostring() // "symbol(symbol.iterator) //
global symbols symbol.for('foo').tostring() // "symbol(foo)" specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.tostring' in that specification. ...
TypedArray.prototype.fill() - JavaScript
escription the elements interval to fill is [start, end). the fill method takes up to three arguments value, start and end. the start and end arguments are optional with default values of 0 and the length of the this object. if start is negative, it is treated as length+start where length is the length of the array. if end is negative, it is treated as length+end. polyfill since there is no
global object with the name typedarray, polyfilling must be done on an "as needed" basis. use the following "polyfill" along with the array.prototype.fill() polyfill. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill if (!uint8array.prototype.fill) { uint8array.prototype.fill = array.prototype.fill; } examples using fill new uint8array([1, 2, 3]).fill(4); // uint8array [4...
TypedArray.prototype.join() - JavaScript
ithub.com/mdn/interactive-examples and send us a pull request. syntax typedarray.join([separator = ',']); parameters separator optional. specifies a string to separate each element. the separator is converted to a string if necessary. if omitted, the typed array elements are separated with a comma (","). return value a string with all array elements joined. polyfill since there is no
global object with the name typedarray, polyfilling must be done on an "as needed" basis. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join if (!uint8array.prototype.join) { object.defineproperty(uint8array.prototype, 'join', { value: array.prototype.join }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to ...
TypedArray.prototype.slice() - JavaScript
equence. if end is omitted, slice extracts through the end of the sequence (typedarray.length). return value a new typed array containing the extracted elements. description the slice method does not alter. it returns a shallow copy of elements from the original typed array. if a new element is added to either typed array, the other typed array is not affected. polyfill since there is no
global object with the name typedarray, polyfilling must be done on an "as needed" basis. if (!uint8array.prototype.slice) { object.defineproperty(uint8array.prototype, 'slice', { value: function (begin, end) { return new uint8array(array.prototype.slice.call(this, begin, end)); } }); } if you need to support truly obsolete javascript engines that don't support object.define...
TypedArray.prototype.some() - JavaScript
ameter is provided to some, it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. some does not mutate the typed array on which it is called. polyfill since there is no
global object with the name typedarray, polyfilling must be done on an "as needed" basis. // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some if (!uint8array.prototype.some) { object.defineproperty(uint8array.prototype, 'some', { value: array.prototype.some }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to ...
URIError() constructor - JavaScript
syntax new urierror([message[, filename[, linenumber]]]) parameters message optional optional. human-readable description of the error. filename optional optional. the name of the file containing the code that caused the exception. linenumber optional optional. the line number of the code that caused the exception. ...
URIError - JavaScript
constructor urierror() creates a new urierror object. instance properties urierror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. urierror.prototype.name error name. inherited from error. urierror.prototype.filename path to file that raised this error. inherited from error. urierror.prototype.linenumber line number in file that raised this error. inherited from error. urierror.prototype.columnnumber column number in line that raised this error. inherited from error. urierror.prototype.stack stack trace. ...
WebAssembly.compileStreaming() - JavaScript
mise rejects with a webassembly.compileerror. examples compile streaming the following example (see our compile-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles it to a webassembly.module object. because the compilestreaming() function accepts a promise for a response object, you can directly pass it a windoworworker
globalscope.fetch() call, and it will pass the response into the function when it fulfills. var importobject = { imports: { imported_func: arg => console.log(arg) } }; webassembly.compilestreaming(fetch('simple.wasm')) .then(module => webassembly.instantiate(module, importobject)) .then(instance => instance.exports.exported_func()); the resulting module instance is then instantiated using webassembly...
WebAssembly.instantiateStreaming() - JavaScript
. examples instantiating streaming the following example (see our instantiate-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a resultobject. because the instantiatestreaming() function accepts a promise for a response object, you can directly pass it a windoworworker
globalscope.fetch() call, and it will pass the response into the function when it fulfills. var importobject = { imports: { imported_func: arg => console.log(arg) } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the resultobject's instance member is then accessed, and the contained exported function invoked. note: for this...
escape() - JavaScript
gits, and the form \xhh\xhh is used for higher-plane unicode characters.) escaped characters in string literals can be expanded by replacing the \x with %, then using the decodeuricomponent() function. syntax escape(str) parameters str a string to be encoded. return value a new string in which certain characters have been escaped. description the escape function is a property of the
global object. special characters are encoded with the exception of: @*_+-./ the hexadecimal form for characters, whose code unit value is 0xff or less, is a two-digit escape sequence: %xx. for characters with a greater code unit, the four-digit format %uxxxx is used. examples using escape escape('abc123'); // "abc123" escape('äöü'); // "%e4%f6%fc" escape('ć'); // "%u0107" /...
isFinite() - JavaScript
if needed, the parameter is first converted to a number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax isfinite(testvalue) parameters testvalue the value to be tested for finiteness. return value false if the argument is positive or negative infinity or nan or undefined; otherwise, true. description isfinite is a top-level function and is not associated with any object. you can use this function to determine whether a number is a finite number. the isfinite function examines the number in its argument. ...
null - JavaScript
and is treated as falsy for boolean operations. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax null description the value null is written with a literal: null. null is not an identifier for a property of the
global object, like undefined can be. instead, null expresses a lack of identification, indicating that a variable points to no object. in apis, null is often retrieved in a place where an object can be expected but no object is relevant. // foo does not exist. it is not defined and has never been initialized: foo; //referenceerror: foo is not defined // foo is known to exist now but it has no type o...
unescape() - JavaScript
cape sequences might be introduced by a function like escape. usually, decodeuri or decodeuricomponent are preferred over unescape. note: do not use unescape to decode uris, use decodeuri instead. syntax unescape(str) parameters str a string to be decoded. return value a new string in which certain characters have been unescaped. description the unescape function is a property of the
global object. examples using unescape unescape('abc123'); // "abc123" unescape('%e4%f6%fc'); // "äöü" unescape('%u0107'); // "ć" specifications specification ecmascript (ecma-262)the definition of 'unescape' in that specification. ...
void operator - JavaScript
github.com/mdn/interactive-examples and send us a pull request. syntax void expression description this operator allows evaluating expressions that produce a value into places where an expression that evaluates to undefined is desired. the void operator is often used merely to obtain the undefined primitive value, usually using "void(0)" (which is equivalent to "void 0"). in these cases, the
global variable undefined can be used. it should be noted that the precedence of the void operator should be taken into account and that parentheses can help clarify the resolution of the expression following the void operator: void 2 == '2'; // (void 2) == '2', returns false void (2 == '2'); // void (2 == '2'), returns undefined examples immediately invoked function expressions when using an im...
function declaration - JavaScript
urn 1; } } // in chrome: // 'foo' name is hoisted. typeof foo is undefined // // in firefox: // 'foo' name is hoisted. typeof foo is undefined // // in edge: // 'foo' name is not hoisted. typeof foo is undefined // // in safari: // 'foo' name is hoisted. typeof foo is function function declaration hoisting function declarations in javascript are hoisted to the top of the enclosing function or
global scope. you can use the function before you declared it: hoisted(); // logs "foo" function hoisted() { console.log('foo'); } note that function expressions are not hoisted: nothoisted(); // typeerror: nothoisted is not a function var nothoisted = function() { console.log('bar'); }; examples using function the following code declares a function that returns the total amount of sales,...
import - JavaScript
from '/modules/my-module.js'; rename multiple exports during import import multiple exports from a module with convenient aliases. import { reallyreallylongmoduleexportname as shortname, anotherlongmodulename as short } from '/modules/my-module.js'; import a module for its side effects only import an entire module for side effects only, without importing anything. this runs the module's
global code, but doesn't actually import any values. import '/modules/my-module.js'; this works with dynamic imports as well: (async () => { if (somethingistrue) { // import module for side effects await import('/modules/my-module.js'); } })(); if your project uses packages that export esm, you can also import them for side effects only. this will run the code in the package entry point...
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. ...
Web video codec guide - Web media technologies
pensation. to minimize the number of pixels that are different, here we take into account the panning of the camera by first shifting the first frame to the right by two pixels, then by taking the difference. this compensates for the panning of the camera, allowing for more overlap between the two frames. images from wikipedia there are two general types of motion compensation:
global motion compensation and block motion compensation.
global motion compensation generally adjusts for camera movements such as tracking, dolly movements, panning, tilting, rolling, and up and down movements. block motion compensation handles localized changes, looking for smaller sections of the image that can be encoded using motion compensation. these blocks are normally of a fixed size, in a gri...
Codecs used by WebRTC - Web media technologies
on to the mandatory audio codecs, some browsers support additional codecs as well. those are listed in the following table. other audio codecs codec name browser compatibility g.722 chrome, firefox, safari ilbc[1] chrome, safari isac[2] chrome, safari [1] internet low bitrate codec (ilbc) is an open-source narrow-band codec developed by
global ip solutions and now google, designed specifically for streaming voice audio. google and some other browser developers have adopted it for webrtc, but it is not available in all browsers and is not one of the mandatory codecs. [2] the internet speech audio codec (isac) is another codec developed by
global ip solutions and now owned by google, which has open-sourced it. it's used by google talk, ...
stroke-opacity - SVG: Scalable Vector Graphics
values for stroke-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1]. it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. to avoid this effect, it is possible to apply a
global opacity with the opacity attribute or to put the stroke behind the fill with the paint-order attribute. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid web...
SVG Attribute reference - SVG: Scalable Vector Graphics
ng attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by, autoreverse, accelerate, decelerate animation addition attributes additive, accumulate event attributes animation event attributes onbegin, onend, onrepeat document event attributes onabort, onerror, onresize, onscroll, onunload
global event attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleav...
<altGlyphDef> - SVG: Scalable Vector Graphics
the <altglyphdef> svg element defines a substitution representation for glyphs. usage context categoriestext content elementpermitted contenteither: one or more <glyphref> elements, or one or more <altglyphitem> elements attributes
global attributes core attributes specific attributes none dom interface this element implements the svgaltglyphdefelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<altglyphdef>' in that specification. recommendation initial definition ...
<altGlyphItem> - SVG: Scalable Vector Graphics
the <altglyphitem> element provides a set of candidates for glyph substitution by the <altglyph> element. usage context categoriestext content elementpermitted contentone or more <glyphref> elements example attributes
global attributes core attributes specific attributes none dom interface this element implements the svgaltglyphitemelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<altglyphitem>' in that specification. recommendation initial definition ...
<animateColor> - SVG: Scalable Vector Graphics
on of svg. it provides no features not already available by using the <animate> element. so, authors should use the <animate> element instead. the <animatecolor> svg element specifies a color transformation over time. usage context categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:descriptive elements attributes
global attributes conditional processing attributes core attributes animation event attributes xlink attributes animation attribute target attributes animation timing attributes animation value attributes animation addition attributes externalresourcesrequired specific attributes by from to dom interface this element implements the svganimatecolorelement interface. example svg <s...
<animateTransform> - SVG: Scalable Vector Graphics
<polygon points="60,30 90,90 30,90"> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="0 60 70" to="360 60 70" dur="10s" repeatcount="indefinite"/> </polygon> </svg> live sample attributes
global attributes conditional processing attributes » core attributes » animation event attributes » xlink attributes » animation attribute target attributes » animation timing attributes » animation value attributes » animation addition attributes » externalresourcesrequired specific attributes by from to type dom interface this element implements the svganimatetransformel...
<clipPath> - SVG: Scalable Vector Graphics
er-events are not dispatched on clipped regions. for example, a circle with a radius of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius. attributes clippathunits defines the coordinate system for the contents of the <clippath> element. ...
<color-profile> - SVG: Scalable Vector Graphics
the <color-profile> element allows describing the color profile used for the image. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes
global attributes core attributes » xlink attributes » specific attributes local name rendering-intent xlink:href dom interface this element implements the svgcolorprofileelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<color-profile>' in that specification. recommendation initial definition ...
<cursor> - SVG: Scalable Vector Graphics
rectangle. typically, the other pixel information (e.g., the r, g and b channels) defines the colors for those parts of the cursor which are not masked out. note that cursors usually contain at least two colors so that the cursor can be visible over most backgrounds. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes
global attributes conditional processing attributes core attributes xlink attributes externalresourcesrequired specific attributes x y xlink:href dom interface this element implements the svgcursorelement interface. specifications specification status comment scalable vector graphics (svg) 2the definition of '<cursor>' in that specification. candidate rec...
<defs> - SVG: Scalable Vector Graphics
ects to use --> <defs> <circle id="mycircle" cx="0" cy="0" r="5" /> <lineargradient id="mygradient" gradienttransform="rotate(90)"> <stop offset="20%" stop-color="gold" /> <stop offset="90%" stop-color="red" /> </lineargradient> </defs> <!-- using my graphical objects --> <use x="5" y="5" xlink:href="#mycircle" fill="url('#mygradient')" /> </svg> attributes
global attributes core attributes most notably: id lang styling attributes class, style event attributes
global event attributes, document element event attributes, graphical event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-render...
<discard> - SVG: Scalable Vector Graphics
discarded, thereby reducing the resources required by an svg user agent. this is particularly useful to help svg viewers conserve memory while displaying long-running documents. the <discard> element may occur wherever the <animate> element may. usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<script> attributes
global attributes conditional processing attributes core attributes aria attributes specific attributes begin href (but note that <discard> has never supported xlink:href) specifications specification status comment svg animations level 2the definition of '<discard>' in that specification. editor's draft initial definition ...
<feBlend> - SVG: Scalable Vector Graphics
the <feblend> svg filter primitive composes two objects together ruled by a certain blending mode. this is similar to what is known from image editing software when blending two layers. the mode is defined by the mode attribute. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 mode dom interface this element implements the svgfeblendelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <feflood result="floodfill" x="0" y="0"...
<feColorMatrix> - SVG: Scalable Vector Graphics
trix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 150 500" preserveaspectratio="xmidymid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.
<feComponentTransfer> - SVG: Scalable Vector Graphics
g. the calculations are performed on non-premultiplied color values. the colors are modified by changing each channel (r, g, b, and a) to the result of what the children <fefuncr>, <fefuncb>, <fefuncg>, and <fefunca> return. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<fefunca>, <fefuncr>, <fefuncb>, <fefuncg> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfecomponenttransferelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 600 300"> <defs> <lineargradient id="rainbow" gradientunits="userspaceonuse" x1="0" y1="0" x2="100%" y2="0"> ...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
texture image using the multiply term of the arithmetic operator of the <fecomposite> filter primitive. multiple light sources can be simulated by adding several of these light maps together before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentany number of descriptive elements and exactly one light source element, in any order. attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale diffuseconstant kernelunitlength dom interface this element implements the svgfediffuselightingelement interface. example the following example show the effect of the <fediffuselighting> element on a circle with each light source available. each time, ...
<feDisplacementMap> - SVG: Scalable Vector Graphics
,y) ← p( x + scale * (xc(x,y) - 0.5), y + scale * (yc(x,y) - 0.5)) where p(x,y) is the input image, in, and p'(x,y) is the destination. xc(x,y) and yc(x,y) are the component values of the channel designated by xchannelselector and ychannelselector. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 scale xchannelselector ychannelselector dom interface this element implements the svgfedisplacementmapelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> ...
<feDistantLight> - SVG: Scalable Vector Graphics
the <fedistantlight> filter primitive defines a distant light source that can be used within a lighting filter primitive: <fediffuselighting> or <fespecularlighting>. usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes specific attributes azimuth elevation dom interface this element implements the svgfedistantlightelement interface. specifications specification status comment filter effects module level 1the definition of '<fedistantlight>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fedistantlight>' in that specification. recommendation ...
<feDropShadow> - SVG: Scalable Vector Graphics
dx this attribute defines the x offset of the drop shadow. value type: <number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. value type: <number>; default value: 2; animatable: yes stddeviation this attribute defines the standard deviation for the blur operation in the drop shadow. ...
<feFlood> - SVG: Scalable Vector Graphics
the <feflood> svg filter primitive fills the filter subregion with the color and opacity defined by flood-color and flood-opacity. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <animatecolor>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes flood-color flood-opacity dom interface this element implements the svgfefloodelement interface. example html content <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> <defs> <filter id="floodfilter" filterunits="userspaceonuse"> <feflood x="50" y="50" width="100" height="100" flood-color="green" flood-opacity="0.5"/> </filter> ...
<feFuncA> - SVG: Scalable Vector Graphics
the <fefunca> svg filter primitive defines the transfer function for the alpha component of the input graphic of its parent <fecomponenttransfer> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncaelement interface. specifications specification status comment filter effects module level 1the definition of '<fefunca>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fefunca>' in that specification. recommendation initial definition ...
<feFuncB> - SVG: Scalable Vector Graphics
the <fefuncb> svg filter primitive defines the transfer function for the blue component of the input graphic of its parent <fecomponenttransfer> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncbelement interface. specifications specification status comment filter effects module level 1the definition of '<fefuncb>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fefuncb>' in that specification. recommendation initial definition ...
<feFuncG> - SVG: Scalable Vector Graphics
the <fefuncg> svg filter primitive defines the transfer function for the green component of the input graphic of its parent <fecomponenttransfer> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncgelement interface. specifications specification status comment filter effects module level 1the definition of '<fefuncg>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fefuncg>' in that specification. recommendation initial definition ...
<feFuncR> - SVG: Scalable Vector Graphics
the <fefuncr> svg filter primitive defines the transfer function for the red component of the input graphic of its parent <fecomponenttransfer> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncrelement interface. specifications specification status comment filter effects module level 1the definition of '<fefuncr>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fefuncr>' in that specification. recommendation initial definition ...
<feGaussianBlur> - SVG: Scalable Vector Graphics
the <fegaussianblur> svg filter primitive blurs the input image by the amount specified in stddeviation, which defines the bell-curve. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in stddeviation edgemode dom interface this element implements the svgfegaussianblurelement interface. example simple example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="blurme"> <fegaussianblur in="sourcegraphic" stddeviation="5" /> </filter> <circle cx="60" cy="60" r="50" fill="green"...
<feMergeNode> - SVG: Scalable Vector Graphics
specifications specification status comment filter effects module level 1the definition of '<femergenode>' in that specification. working draft scalable vector graphics (svg) 1.1 (second edition)the definition of ...
<feMorphology> - SVG: Scalable Vector Graphics
the <femorphology> svg filter primitive is used to erode or dilate the input image. its usefulness lies especially in fattening or thinning effects. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in operator radius dom interface this element implements the svgfemorphologyelement interface. examples filtering svg content svg <svg xmlns="http://www.w3.org/2000/svg" width="300" height="180"> <filter id="erode"> <femorphology operator="erode" radius="1"/> </filter> <filter id="dilate"> <femorphology operator="dilate" radius="2"/> </filter> <text...
<feOffset> - SVG: Scalable Vector Graphics
the <feoffset> svg filter primitive allows to offset the input image. the input image as a whole is offset by the values specified in the dx and dy attributes. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dx dy dom interface this element implements the svgfeoffsetelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="offset" width="180" height="180"> <feoffset in="sourcegraphic" dx="60" dy="60" /> </filter> </defs> <rect x="0" y="0" width="100" height="100" stroke="black" fi...
<fePointLight> - SVG: Scalable Vector Graphics
the <fepointlight> filter primitive defines a light source which allows to create a point light effect. it that can be used within a lighting filter primitive: <fediffuselighting> or <fespecularlighting>. usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes specific attributes x y z dom interface this element implements the svgfepointlightelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <fespecularlighting result="spotlight" specularconstant="1.5" specularexponent="80" lighting-color="#fff"> <fepointlig...
<feSpecularLighting> - SVG: Scalable Vector Graphics
h a map is intended to be combined with a texture using the add term of the arithmetic <fecomposite> method. multiple light sources can be simulated by adding several of these light maps before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentexactly one light source element first and any number of descriptive elements in any order. attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale specularconstant specularexponent kernelunitlength dom interface this element implements the svgfespecularlightingelement interface. example <svg height="200" width="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id = "fi...
<feSpotLight> - SVG: Scalable Vector Graphics
the <fespotlight> svg filter primitive defines a light source which allows to create a spotlight effect. it that can be used within a lighting filter primitive: <fediffuselighting> or <fespecularlighting>. usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes specific attributes x y z pointsatx pointsaty pointsatz specularexponent limitingconeangle dom interface this element implements the svgfespotlightelement interface. example html content <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <fespecularlighting result="spotlight" specularconstant...
<feTile> - SVG: Scalable Vector Graphics
the <fetile> svg filter primitive allows to fill a target rectangle with a repeated, tiled pattern of an input image. the effect is similar to the one of a <pattern>. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfetileelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="tile" x="0" y="0" width="100%" height="100%"> <fetile in="sourcegraphic" x="50" y="50" width="100" height="100" /> ...
<feTurbulence> - SVG: Scalable Vector Graphics
the <feturbulence> svg filter primitive creates an image using the perlin turbulence function. it allows the synthesis of artificial textures like clouds or marble. the resulting image will fill the entire filter primitive subregion. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes
global attributes core attributes presentation attributes filter primitive attributes class style specific attributes basefrequency numoctaves seed stitchtiles type dom interface this element implements the svgfeturbulenceelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="t...
<filter> - SVG: Scalable Vector Graphics
<filter> svg element defines a custom filter effect by grouping atomic filter primitives. it is never rendered itself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elementsfilter primitive elements<animate>, <set> attributes
global attributes core attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes x y width height filterres filterunits primitiveunits xlink:href dom interface this element implements the svgfilterelement interface. example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg"> <filter id="blurme"> <fegaussi...
<font-face-format> - SVG: Scalable Vector Graphics
the <font-face-format> svg element describes the type of font referenced by its parent <font-face-uri>. usage context categoriesfont elementpermitted contentempty attributes
global attributes core attributes specific attributes string dom interface this element implements the svgfontfaceformatelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font-face-format>' in that specification. recommendation initial definition ...
<font-face-name> - SVG: Scalable Vector Graphics
the <font-face-name> element points to a locally installed copy of this font, identified by its name. usage context categoriesnonepermitted contentempty attributes
global attributes core attributes » specific attributes name dom interface this element implements the svgfontfacenameelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font-face-name>' in that specification. recommendation initial definition ...
<font-face-src> - SVG: Scalable Vector Graphics
the <font-face-src> svg element corresponds to the src descriptor in css @font-face rules. it serves as container for <font-face-name>, pointing to locally installed copies of this font, and <font-face-uri>, utilizing remotely defined fonts. usage context categoriesfont elementpermitted contentone or more of the following elements, in any order:<font-face-name>, <font-face-uri> attributes
global attributes core attributes specific attributes none dom interface this element implements the svgfontfacesrcelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font-face-src>' in that specification. recommendation initial definition ...
<font-face-uri> - SVG: Scalable Vector Graphics
the <font-face-uri> svg element points to a remote definition of the current font. usage context categoriesfont elementpermitted contentany number of the following elements, in any order:<font-face-format> attributes
global attributes core attributes xlink attributes specific attributes xlink:href dom interface this element implements the svgfontfaceurielement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font-face-uri>' in that specification. recommendation initial definition ...
<font-face> - SVG: Scalable Vector Graphics
the <font-face> svg element corresponds to the css @font-face rule. it defines a font's outer properties. usage context categoriesfont elementpermitted contentany number of descriptive elements » and at most one <font-face> element, in any order. ...
<font> - SVG: Scalable Vector Graphics
the <font> svg element defines a font to be used for text layout. usage context categoriesfont elementpermitted contentany number of the following elements, in any order:descriptive elements<font-face>, <glyph>, <hkern>, <missing-glyph>, <vkern> attributes
global attributes core attributes presentation attributes class style externalresourcesrequired specific attributes horiz-origin-x horiz-origin-y horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgfontelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font>' in that specification. recommendation initial definition ...
<glyphRef> - SVG: Scalable Vector Graphics
the glyphref element provides a single possible glyph to the referencing <altglyph> substitution. usage context categoriestext content elementpermitted contentempty attributes
global attributes core attributes » presentation attributes » xlink attributes » class style specific attributes x y dx dy glyphref format xlink:href dom interface this element implements the svgglyphrefelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<glyphref>' in that specification. recommendation initial definition ...
<hatch> - SVG: Scalable Vector Graphics
fill and stroke css properties on a given graphics element to indicate that the given element shall be filled or stroked with the hatch. paths are defined by <hatchpath> elements. usage context categoriesnever-rendered element, paint server elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<hatchpath>, <script>, <style> attributes
global attributes core attributes
global event attributes presentation attributes style attributes specific attributes x y pitch rotate hatchunits hatchcontentunits transform href dom interface this element implements the svghatchelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hatchunits="userspaceonu...
<hatchpath> - SVG: Scalable Vector Graphics
the <hatchpath> svg element defines a hatch path used by the <hatch> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<script>, <style> attributes
global attributes core attributes
global event attributes presentation attributes style attributes specific attributes d offset dom interface this element implements the svghatchpathelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hatchunits="userspaceonuse" pitch="5" rotate="135"> <hatchpath stroke="#a080ff" stroke-width="2"/> </hatch> </defs> <rect fill="url(#hatch)" stroke="black" stroke-width="2" x="10%" y="10%" width...
<hkern> - SVG: Scalable Vector Graphics
the <hkern> svg element allows to fine-tweak the horizontal distance between two glyphs. this process is known as kerning. usage context categoriesfont elementpermitted contentempty attributes
global attributes core attributes specific attributes u1 g1 u2 g2 k dom interface this element implements the svghkernelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<hkern>' in that specification. recommendation initial definition ...
<image> - SVG: Scalable Vector Graphics
try <object> inside of <foreignobject>. note: the html spec defines <image> as a synonym for <img> while parsing html. this specific element and its behavior only apply inside svg documents or inline svg. usage context categoriesgraphics element, graphics referencing elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements attributes
global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired transform specific attributes x: positions the image horizontally from the origin. y: positions the image vertically from the origin. width: the width the image renders at. unlike html's <img>, this attribute is re...
<marker> - SVG: Scalable Vector Graphics
: left|center|right|<coordinate> ; default value: 0; animatable: yes refy this attribute defines the y coordinate for the reference point of the marker. value type: top|center|bottom|<coordinate> ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
<mask> - SVG: Scalable Vector Graphics
rdinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes y this attribute defines the y-axis coordinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
<missing-glyph> - SVG: Scalable Vector Graphics
te <glyph>. usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> attributes
global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgmissingglyphelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<missing-glyph>' in that ...
<mpath> - SVG: Scalable Vector Graphics
the <mpath> sub-element for the <animatemotion> element provides the ability to reference an external <path> element as the definition of a motion path. usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements attributes
global attributes core attributes » xlink attributes » externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgmpathelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 500 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="1" y="1" width="498" height="298" fill="none" stroke="blue" stroke-width="2" /> <!-- draw the outline of the motion path in blue...
<pattern> - SVG: Scalable Vector Graphics
ern that provides default values for the <pattern> attributes. value type: <url>; default value: none; animatable: yes note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
<script> - SVG: Scalable Vector Graphics
; default value: ?; animatable: yes href the url to the script to load. value type: <url> ; default value: none; animatable: no type this attribute defines type of the script language to use. value type: <string>; default value: application/ecmascript; animatable: no xlink:href deprecated since svg 2 the url to the script to load. value type: <url> ; default value: none; animatable: no
global attributes core attributes most notably: id styling attributes class, style event attributes
global event attributes, document element event attributes usage notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<script>' in that specification. c...
<solidcolor> - SVG: Scalable Vector Graphics
gle color for use in multiple places in an svg document. it is also useful as away of animating a palette colors. note: this is an experimental technology, and not yet implemented in browsers. a workaround is to use a <lineargradient> with only one color stop. this is less elegant, and unlike <solidcolor>, cannot itself be used in the definition of gradients. usage context missing attributes
global attributes core attributes
global event attributes presentation attributes style attributes specific attributes none. dom interface this element implements the svgsolidcolorelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 300 200" height="150"> <defs> <!-- solidcolor is experimental. --> <solidcolor id="mycolor" solid-color="gold" solid-o...
<style> - SVG: Scalable Vector Graphics
language to use as a media type string. value type: <string>; default value: text/css; animatable: no media this attribute defines to which media the style applies. value type: <string>; default value: all; animatable: no title this attribute the title of the style sheet which can be used to switch between alternate style sheets. value type: <string>; default value: none; animatable: no
global attributes core attributes most notably: id styling attributes class, style event attributes
global event attributes, document element event attributes usage notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<style>' in that specification. ca...
<switch> - SVG: Scalable Vector Graphics
e 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> attributes
global attributes conditional processing attributes core attributes graphical event attributes presentation attributes class style externalresourcesrequired transform dom interface this element implements the svgswitchelement interface. svg <switch> example this example demonstrates showing different text content depending on the browser's language settings. the switch element will displa...
<tref> - SVG: Scalable Vector Graphics
ement can be either character data directly embedded within the <text> element or the character data content of a referenced element, where the referencing is specified with a <tref> element. usage context categoriestext content element, text content child elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatecolor>, <set> attributes
global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgtrefelement interface. example <svg width="100%" height="100%" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns...